wayland: Add support for stable xdg-shell

This commit adds support for xdg_shell (the stable version). This was
done by first copying the old xdg-shell unstable v6 implementation into
a separate .c .h file pair (including various symbol renaming) then
porting the old xdg-shell unstable v6 implementation to the new stable
version.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=791938
This commit is contained in:
Jonas Ådahl 2017-12-22 16:37:44 +08:00
parent 514c7028f4
commit d714a94d97
10 changed files with 2397 additions and 178 deletions

2
.gitignore vendored
View File

@ -98,6 +98,8 @@ src/keyboard-shortcuts-inhibit-unstable-v*-protocol.c
src/keyboard-shortcuts-inhibit-unstable-v*-server-protocol.h src/keyboard-shortcuts-inhibit-unstable-v*-server-protocol.h
src/linux-dmabuf-unstable-v*-protocol.c src/linux-dmabuf-unstable-v*-protocol.c
src/linux-dmabuf-unstable-v*-server-protocol.h src/linux-dmabuf-unstable-v*-server-protocol.h
src/xdg-shell-protocol.c
src/xdg-shell-server-protocol.h
src/meta/meta-version.h src/meta/meta-version.h
src/libmutter-*.pc src/libmutter-*.pc
doc/reference/*.args doc/reference/*.args

View File

@ -68,6 +68,8 @@ mutter_built_sources += \
gtk-shell-server-protocol.h \ gtk-shell-server-protocol.h \
gtk-primary-selection-protocol.c \ gtk-primary-selection-protocol.c \
gtk-primary-selection-server-protocol.h \ gtk-primary-selection-server-protocol.h \
xdg-shell-protocol.c \
xdg-shell-server-protocol.h \
xdg-shell-unstable-v6-protocol.c \ xdg-shell-unstable-v6-protocol.c \
xdg-shell-unstable-v6-server-protocol.h \ xdg-shell-unstable-v6-server-protocol.h \
relative-pointer-unstable-v1-protocol.c \ relative-pointer-unstable-v1-protocol.c \
@ -454,6 +456,8 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \
wayland/meta-window-xwayland.h \ wayland/meta-window-xwayland.h \
wayland/meta-wayland-xdg-shell.c \ wayland/meta-wayland-xdg-shell.c \
wayland/meta-wayland-xdg-shell.h \ wayland/meta-wayland-xdg-shell.h \
wayland/meta-wayland-legacy-xdg-shell.c \
wayland/meta-wayland-legacy-xdg-shell.h \
wayland/meta-wayland-wl-shell.c \ wayland/meta-wayland-wl-shell.c \
wayland/meta-wayland-wl-shell.h \ wayland/meta-wayland-wl-shell.h \
wayland/meta-wayland-gtk-shell.c \ wayland/meta-wayland-gtk-shell.c \
@ -742,7 +746,7 @@ backends/native/meta-default-modes.h: backends/native/gen-default-modes.py Makef
.SECONDEXPANSION: .SECONDEXPANSION:
define protostability define protostability
$(shell echo $1 | sed 's/.*\(\<unstable\>\|\<stable\>\).*/\1/') $(if $(findstring unstable,$1),unstable,stable)
endef endef
define protoname define protoname

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2013-2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_WAYLAND_LEGACY_XDG_SHELL_H
#define META_WAYLAND_LEGACY_XDG_SHELL_H
#include "wayland/meta-wayland-surface.h"
#include "wayland/meta-wayland-shell-surface.h"
#define META_TYPE_WAYLAND_ZXDG_SURFACE_V6 (meta_wayland_zxdg_surface_v6_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaWaylandZxdgSurfaceV6,
meta_wayland_zxdg_surface_v6,
META, WAYLAND_ZXDG_SURFACE_V6,
MetaWaylandShellSurface)
struct _MetaWaylandZxdgSurfaceV6Class
{
MetaWaylandShellSurfaceClass parent_class;
void (*shell_client_destroyed) (MetaWaylandZxdgSurfaceV6 *xdg_surface);
};
#define META_TYPE_WAYLAND_ZXDG_TOPLEVEL_V6 (meta_wayland_zxdg_toplevel_v6_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandZxdgToplevelV6,
meta_wayland_zxdg_toplevel_v6,
META, WAYLAND_ZXDG_TOPLEVEL_V6,
MetaWaylandZxdgSurfaceV6);
#define META_TYPE_WAYLAND_ZXDG_POPUP_V6 (meta_wayland_zxdg_popup_v6_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandZxdgPopupV6,
meta_wayland_zxdg_popup_v6,
META, WAYLAND_ZXDG_POPUP_V6,
MetaWaylandZxdgSurfaceV6);
void meta_wayland_legacy_xdg_shell_init (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_LEGACY_XDG_SHELL_H */

View File

@ -43,6 +43,7 @@
#include "meta-wayland-data-device.h" #include "meta-wayland-data-device.h"
#include "meta-wayland-outputs.h" #include "meta-wayland-outputs.h"
#include "meta-wayland-xdg-shell.h" #include "meta-wayland-xdg-shell.h"
#include "meta-wayland-legacy-xdg-shell.h"
#include "meta-wayland-wl-shell.h" #include "meta-wayland-wl-shell.h"
#include "meta-wayland-gtk-shell.h" #include "meta-wayland-gtk-shell.h"
@ -1199,6 +1200,21 @@ window_position_changed (MetaWindow *window,
meta_wayland_surface_update_outputs_recursively (surface); meta_wayland_surface_update_outputs_recursively (surface);
} }
void
meta_wayland_surface_create_surface_actor (MetaWaylandSurface *surface)
{
MetaSurfaceActor *surface_actor;
surface_actor = meta_surface_actor_wayland_new (surface);
surface->surface_actor = g_object_ref_sink (surface_actor);
}
void
meta_wayland_surface_clear_surface_actor (MetaWaylandSurface *surface)
{
g_clear_object (&surface->surface_actor);
}
MetaWaylandSurface * MetaWaylandSurface *
meta_wayland_surface_create (MetaWaylandCompositor *compositor, meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_client *client, struct wl_client *client,
@ -1269,6 +1285,7 @@ void
meta_wayland_shell_init (MetaWaylandCompositor *compositor) meta_wayland_shell_init (MetaWaylandCompositor *compositor)
{ {
meta_wayland_xdg_shell_init (compositor); meta_wayland_xdg_shell_init (compositor);
meta_wayland_legacy_xdg_shell_init (compositor);
meta_wayland_wl_shell_init (compositor); meta_wayland_wl_shell_init (compositor);
meta_wayland_gtk_shell_init (compositor); meta_wayland_gtk_shell_init (compositor);
} }

View File

@ -231,6 +231,10 @@ void meta_wayland_surface_unref_buffer_use_count (MetaWaylandSurf
void meta_wayland_surface_set_window (MetaWaylandSurface *surface, void meta_wayland_surface_set_window (MetaWaylandSurface *surface,
MetaWindow *window); MetaWindow *window);
void meta_wayland_surface_create_surface_actor (MetaWaylandSurface *surface);
void meta_wayland_surface_clear_surface_actor (MetaWaylandSurface *surface);
void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface, void meta_wayland_surface_configure_notify (MetaWaylandSurface *surface,
int new_x, int new_x,
int new_y, int new_y,

View File

@ -37,7 +37,8 @@
/* Global/master objects (version exported by wl_registry and negotiated through bind) */ /* Global/master objects (version exported by wl_registry and negotiated through bind) */
#define META_WL_COMPOSITOR_VERSION 4 #define META_WL_COMPOSITOR_VERSION 4
#define META_WL_DATA_DEVICE_MANAGER_VERSION 3 #define META_WL_DATA_DEVICE_MANAGER_VERSION 3
#define META_XDG_SHELL_VERSION 1 #define META_XDG_WM_BASE_VERSION 1
#define META_ZXDG_SHELL_V6_VERSION 1
#define META_WL_SHELL_VERSION 1 #define META_WL_SHELL_VERSION 1
#define META_WL_SEAT_VERSION 5 #define META_WL_SEAT_VERSION 5
#define META_WL_OUTPUT_VERSION 2 #define META_WL_OUTPUT_VERSION 2

View File

@ -32,6 +32,7 @@
#include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-private.h"
#include "wayland/meta-wayland-versions.h" #include "wayland/meta-wayland-versions.h"
#include "wayland/meta-wayland-xdg-shell.h" #include "wayland/meta-wayland-xdg-shell.h"
#include "wayland/meta-wayland-legacy-xdg-shell.h"
#include "xdg-foreign-unstable-v1-server-protocol.h" #include "xdg-foreign-unstable-v1-server-protocol.h"
@ -145,6 +146,7 @@ xdg_exporter_export (struct wl_client *client,
if (!surface->role || if (!surface->role ||
!META_IS_WAYLAND_XDG_SURFACE (surface->role) || !META_IS_WAYLAND_XDG_SURFACE (surface->role) ||
!META_IS_WAYLAND_ZXDG_SURFACE_V6 (surface->role) ||
!surface->window) !surface->window)
{ {
wl_resource_post_error (resource, wl_resource_post_error (resource,
@ -254,6 +256,9 @@ is_valid_child (MetaWaylandSurface *surface)
if (!META_IS_WAYLAND_XDG_SURFACE (surface->role)) if (!META_IS_WAYLAND_XDG_SURFACE (surface->role))
return FALSE; return FALSE;
if (!META_IS_WAYLAND_ZXDG_SURFACE_V6 (surface->role))
return FALSE;
if (!surface->window) if (!surface->window)
return FALSE; return FALSE;
@ -376,7 +381,9 @@ xdg_importer_import (struct wl_client *client,
xdg_imported_destructor); xdg_imported_destructor);
exported = g_hash_table_lookup (foreign->exported_surfaces, handle); exported = g_hash_table_lookup (foreign->exported_surfaces, handle);
if (!exported || !META_IS_WAYLAND_XDG_SURFACE (exported->surface->role)) if (!exported ||
(!META_IS_WAYLAND_XDG_SURFACE (exported->surface->role) &&
!META_IS_WAYLAND_ZXDG_SURFACE_V6 (exported->surface->role)))
{ {
zxdg_imported_v1_send_destroyed (resource); zxdg_imported_v1_send_destroyed (resource);
return; return;

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,7 @@ struct _MetaWaylandXdgSurfaceClass
MetaWaylandShellSurfaceClass parent_class; MetaWaylandShellSurfaceClass parent_class;
void (*shell_client_destroyed) (MetaWaylandXdgSurface *xdg_surface); void (*shell_client_destroyed) (MetaWaylandXdgSurface *xdg_surface);
void (*reset) (MetaWaylandXdgSurface *xdg_surface);
}; };
#define META_TYPE_WAYLAND_XDG_TOPLEVEL (meta_wayland_xdg_toplevel_get_type ()) #define META_TYPE_WAYLAND_XDG_TOPLEVEL (meta_wayland_xdg_toplevel_get_type ())