diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 380611c7b1..3814157557 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -82,6 +82,8 @@ #define MIN_SYSTEM_BELL_DELAY_MS 20 +#define GTK_SHELL1_VERSION 2 + static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland); G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY) @@ -371,7 +373,7 @@ gdk_registry_handle_global (void *data, display_wayland->gtk_shell = wl_registry_bind(display_wayland->wl_registry, id, >k_shell1_interface, - 1); + MIN (version, GTK_SHELL1_VERSION)); _gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen); display_wayland->gtk_shell_version = version; } diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index e25c782d0f..77a6e978f8 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -2961,6 +2961,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; @@ -2971,7 +3022,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 5cfdd42c23..8191fa9cfb 100644 --- a/gdk/wayland/protocol/gtk-shell.xml +++ b/gdk/wayland/protocol/gtk-shell.xml @@ -1,6 +1,6 @@ - + gtk_shell is a protocol extension providing additional features for clients implementing it. @@ -30,7 +30,7 @@ - + @@ -51,11 +51,27 @@ + + + + + + + + + + + + + + + +