[gtk+] wayland: consider edge constraints in surface configuration
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: consider edge constraints in surface configuration
- Date: Mon, 18 Sep 2017 02:17:26 +0000 (UTC)
commit e9cc77ecc8cb095827e77ccb3ed2ddd6bb2e83f4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Aug 17 00:35:52 2017 -0300
wayland: consider edge constraints in surface configuration
Now that GTK windows have the ability to properly handle
per-edge tiling constraints, this patch extends GTK's
internal Wayland protocol to have a proper enum with the
relevant edge data.
Once this approach is validated, we can think of upstreaming
this work as an official Wayland protocol extension.
https://bugzilla.gnome.org/show_bug.cgi?id=783669
gdk/wayland/gdkwindow-wayland.c | 54 +++++++++++++++++++++++++++++++++++-
gdk/wayland/protocol/gtk-shell.xml | 20 ++++++++++++-
2 files changed, 71 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 1b01534..bca70be 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -2896,6 +2896,57 @@ gtk_surface_configure (void *data,
case GTK_SURFACE1_STATE_TILED:
new_state |= GDK_WINDOW_STATE_TILED;
break;
+
+ /* Since v2 */
+ case GTK_SURFACE1_STATE_TILED_TOP:
+ new_state |= GDK_WINDOW_STATE_TOP_TILED;
+ break;
+ case GTK_SURFACE1_STATE_TILED_RIGHT:
+ new_state |= GDK_WINDOW_STATE_RIGHT_TILED;
+ break;
+ case GTK_SURFACE1_STATE_TILED_BOTTOM:
+ new_state |= GDK_WINDOW_STATE_BOTTOM_TILED;
+ break;
+ case GTK_SURFACE1_STATE_TILED_LEFT:
+ new_state |= GDK_WINDOW_STATE_LEFT_TILED;
+ break;
+ default:
+ /* Unknown state */
+ break;
+ }
+ }
+
+ impl->pending.state |= new_state;
+}
+
+static void
+gtk_surface_configure_edges (void *data,
+ struct gtk_surface1 *gtk_surface,
+ struct wl_array *edge_constraints)
+{
+ 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, edge_constraints)
+ {
+ uint32_t constraint = *p;
+
+ switch (constraint)
+ {
+ case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_TOP:
+ new_state |= GDK_WINDOW_STATE_TOP_RESIZABLE;
+ break;
+ case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_RIGHT:
+ new_state |= GDK_WINDOW_STATE_TOP_TILED;
+ break;
+ case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_BOTTOM:
+ new_state |= GDK_WINDOW_STATE_BOTTOM_RESIZABLE;
+ break;
+ case GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_LEFT:
+ new_state |= GDK_WINDOW_STATE_LEFT_RESIZABLE;
+ break;
default:
/* Unknown state */
break;
@@ -2906,7 +2957,8 @@ gtk_surface_configure (void *data,
}
static const struct gtk_surface1_listener gtk_surface_listener = {
- gtk_surface_configure
+ gtk_surface_configure,
+ gtk_surface_configure_edges
};
static void
diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml
index 5cfdd42..8191fa9 100644
--- a/gdk/wayland/protocol/gtk-shell.xml
+++ b/gdk/wayland/protocol/gtk-shell.xml
@@ -1,6 +1,6 @@
<protocol name="gtk">
- <interface name="gtk_shell1" version="1">
+ <interface name="gtk_shell1" version="2">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@@ -30,7 +30,7 @@
</request>
</interface>
- <interface name="gtk_surface1" version="1">
+ <interface name="gtk_surface1" version="2">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
@@ -51,11 +51,27 @@
<enum name="state">
<entry name="tiled" value="1"/>
+
+ <entry name="tiled_top" value="2" since="2" />
+ <entry name="tiled_right" value="3" since="2" />
+ <entry name="tiled_bottom" value="4" since="2" />
+ <entry name="tiled_left" value="5" since="2" />
+ </enum>
+
+ <enum name="edge_constraint" since="2">
+ <entry name="resizable_top" value="1"/>
+ <entry name="resizable_right" value="2"/>
+ <entry name="resizable_bottom" value="3"/>
+ <entry name="resizable_left" value="4"/>
</enum>
<event name="configure">
<arg name="states" type="array"/>
</event>
+
+ <event name="configure_edges" since="2">
+ <arg name="constraints" type="array"/>
+ </event>
</interface>
</protocol>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]