[gtk+] wayland: Get tiled state from gtk_shell instead of xdg_shell
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Get tiled state from gtk_shell instead of xdg_shell
- Date: Thu, 25 Aug 2016 04:44:46 +0000 (UTC)
commit e53d381430dd2eeaf8bb04ca4ffc7a9107fbb9ac
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Jun 28 15:01:22 2016 +0800
wayland: Get tiled state from gtk_shell instead of xdg_shell
Use our the 'tiled' entry from our new 'state' enum sent via
xdg_surface.configure.
https://bugzilla.gnome.org/show_bug.cgi?id=769937
gdk/wayland/gdkwindow-wayland.c | 53 ++++++++++++++++++++++++++++-------
gdk/wayland/protocol/gtk-shell.xml | 10 +++++++
2 files changed, 52 insertions(+), 11 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index dc8ab41..df6fa6b 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -45,13 +45,6 @@ enum {
static guint signals[LAST_SIGNAL];
-/*
- * Define GNOME additional states to xdg-shell
- * The current reserved range for GNOME is 0x1000 - 0x1FFF
- */
-
-#define XDG_SURFACE_STATE_GNOME_TILED 0x1000
-
#define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
@@ -182,6 +175,10 @@ struct _GdkWindowImplWayland
gint rect_anchor_dx;
gint rect_anchor_dy;
} pending_move_to_rect;
+
+ struct {
+ GdkWindowState state;
+ } pending;
};
struct _GdkWindowImplWaylandClass
@@ -1252,16 +1249,15 @@ xdg_surface_configure (void *data,
break;
case XDG_SURFACE_STATE_RESIZING:
break;
- /* GNOME additional states to xdg-shell */
- case XDG_SURFACE_STATE_GNOME_TILED:
- new_state |= GDK_WINDOW_STATE_TILED;
- break;
default:
/* Unknown state */
break;
}
}
+ new_state |= impl->pending.state;
+ impl->pending.state = 0;
+
fixed_size =
new_state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_TILED);
@@ -2204,6 +2200,38 @@ gdk_wayland_window_get_type_hint (GdkWindow *window)
}
static void
+gtk_surface_configure (void *data,
+ struct gtk_surface1 *gtk_surface,
+ struct wl_array *states)
+{
+ GdkWindow *window = GDK_WINDOW (data);
+ GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+ GdkWindowState new_state = 0;
+ uint32_t *p;
+
+ wl_array_for_each (p, states)
+ {
+ uint32_t state = *p;
+
+ switch (state)
+ {
+ case GTK_SURFACE1_STATE_TILED:
+ new_state |= GDK_WINDOW_STATE_TILED;
+ break;
+ default:
+ /* Unknown state */
+ break;
+ }
+ }
+
+ impl->pending.state |= new_state;
+}
+
+static const struct gtk_surface1_listener gtk_surface_listener = {
+ gtk_surface_configure
+};
+
+static void
gdk_wayland_window_init_gtk_surface (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
@@ -2220,6 +2248,9 @@ gdk_wayland_window_init_gtk_surface (GdkWindow *window)
impl->display_server.gtk_surface =
gtk_shell1_get_gtk_surface (display->gtk_shell,
impl->display_server.wl_surface);
+ gtk_surface1_add_listener (impl->display_server.gtk_surface,
+ >k_surface_listener,
+ window);
}
static void
diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml
index 2e750ea..5cfdd42 100644
--- a/gdk/wayland/protocol/gtk-shell.xml
+++ b/gdk/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]