diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c index 6079c2826..d6e249f02 100644 --- a/src/wayland/meta-wayland-gtk-shell.c +++ b/src/wayland/meta-wayland-gtk-shell.c @@ -40,6 +40,7 @@ typedef struct _MetaWaylandGtkSurface struct wl_resource *resource; MetaWaylandSurface *surface; gboolean is_modal; + gulong configure_handler_id; } MetaWaylandGtkSurface; static void @@ -48,8 +49,12 @@ gtk_surface_destructor (struct wl_resource *resource) MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource); if (gtk_surface->surface) - g_object_steal_qdata (G_OBJECT (gtk_surface->surface), - quark_gtk_surface_data); + { + g_object_steal_qdata (G_OBJECT (gtk_surface->surface), + quark_gtk_surface_data); + g_signal_handler_disconnect (gtk_surface->surface, + gtk_surface->configure_handler_id); + } g_free (gtk_surface); } @@ -142,6 +147,34 @@ gtk_surface_surface_destroyed (MetaWaylandGtkSurface *gtk_surface) gtk_surface->surface = NULL; } +static void +fill_states (struct wl_array *states, + MetaWindow *window) +{ + uint32_t *s; + + if (window->tile_mode == META_TILE_LEFT || + window->tile_mode == META_TILE_RIGHT) + { + s = wl_array_add (states, sizeof *s); + *s = GTK_SURFACE1_STATE_TILED; + } +} + +static void +on_configure (MetaWaylandSurface *surface, + MetaWaylandGtkSurface *gtk_surface) +{ + struct wl_array states; + + wl_array_init (&states); + fill_states (&states, surface->window); + + gtk_surface1_send_configure (gtk_surface->resource, &states); + + wl_array_release (&states); +} + static void gtk_shell_get_gtk_surface (struct wl_client *client, struct wl_resource *resource, @@ -170,6 +203,11 @@ gtk_shell_get_gtk_surface (struct wl_client *client, &meta_wayland_gtk_surface_interface, gtk_surface, gtk_surface_destructor); + gtk_surface->configure_handler_id = g_signal_connect (surface, + "configure", + G_CALLBACK (on_configure), + gtk_surface); + g_object_set_qdata_full (G_OBJECT (surface), quark_gtk_surface_data, gtk_surface, diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 0adc3df0c..643147f8c 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -35,13 +35,6 @@ #include "wayland/meta-window-wayland.h" #include "xdg-shell-unstable-v5-server-protocol.h" -/* - * Define GNOME additional states to xdg-shell - * The current reserved range for GNOME is 0x1000 - 0x1FFF - */ - -#define XDG_SURFACE_STATE_GNOME_TILED 0x1000 - struct _MetaWaylandXdgSurface { MetaWaylandSurfaceRoleShellSurface parent; @@ -406,13 +399,6 @@ fill_states (struct wl_array *states, MetaWindow *window) s = wl_array_add (states, sizeof *s); *s = XDG_SURFACE_STATE_ACTIVATED; } - /* GNOME extension to xdg-shell states */ - if (window->tile_mode == META_TILE_LEFT || - window->tile_mode == META_TILE_RIGHT) - { - s = wl_array_add (states, sizeof *s); - *s = XDG_SURFACE_STATE_GNOME_TILED; - } } static void diff --git a/src/wayland/protocol/gtk-shell.xml b/src/wayland/protocol/gtk-shell.xml index 2e750ea0f..5cfdd42c2 100644 --- a/src/wayland/protocol/gtk-shell.xml +++ b/src/wayland/protocol/gtk-shell.xml @@ -46,6 +46,16 @@ + + + + + + + + + +