mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 04:10:13 +00:00
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
This commit is contained in:
parent
45f4844880
commit
e9cc77ecc8
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user