[mutter] wayland: Make gtk_shell handle our private window states
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Make gtk_shell handle our private window states
- Date: Thu, 25 Aug 2016 04:45:40 +0000 (UTC)
commit a8d86b4876174be29c341b7265b9b4aa44e36330
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Jun 28 14:57:27 2016 +0800
wayland: Make gtk_shell handle our private window states
Instead of using the "allocated" state ranges of xdg_shell, lets just
use our own gtk_shell by adding a state enum and a configure event.
https://bugzilla.gnome.org/show_bug.cgi?id=769936
src/wayland/meta-wayland-gtk-shell.c | 42 ++++++++++++++++++++++++++++++++-
src/wayland/meta-wayland-xdg-shell.c | 14 -----------
src/wayland/protocol/gtk-shell.xml | 10 ++++++++
3 files changed, 50 insertions(+), 16 deletions(-)
---
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
index 6079c28..d6e249f 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);
}
@@ -143,6 +148,34 @@ gtk_surface_surface_destroyed (MetaWaylandGtkSurface *gtk_surface)
}
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,
guint32 id,
@@ -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 0adc3df..643147f 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 2e750ea..5cfdd42 100644
--- a/src/wayland/protocol/gtk-shell.xml
+++ b/src/wayland/protocol/gtk-shell.xml
@@ -46,6 +46,16 @@
<request name="present">
<arg name="time" type="uint"/>
</request>
+
+ <!-- Version 2 additions -->
+
+ <enum name="state">
+ <entry name="tiled" value="1"/>
+ </enum>
+
+ <event name="configure">
+ <arg name="states" type="array"/>
+ </event>
</interface>
</protocol>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]