[mutter] wayland/xdg-shell: Add support implicit popup moving



commit 5c37f5104e58d670294b92a9dc866a6c6abfedeb
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Feb 14 11:11:10 2020 +0100

    wayland/xdg-shell: Add support implicit popup moving
    
    This sets the `is_reactive` flag on the window placement rules, causing
    the popups to be reconfigured as they are affected by environmental
    changes, such as the parent moving in a way making the popup partially
    offscreen.
    
    As with synchronization, the implementation is dormant, as the
    version of the advertised global isn't bumped yet, as the new protocol
    version is not yet fully implemented.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/705

 meson.build                          |  2 +-
 src/wayland/meta-wayland-xdg-shell.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index ababd6eb2..c0859a47d 100644
--- a/meson.build
+++ b/meson.build
@@ -43,7 +43,7 @@ gudev_req = '>= 232'
 
 # wayland version requirements
 wayland_server_req = '>= 1.13.0'
-wayland_protocols_req = '>= 1.18'
+wayland_protocols_req = '>= 1.19'
 
 # native backend version requirements
 libinput_req = '>= 1.7'
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index 8f4b7a0e7..3aad9fe5b 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -66,6 +66,8 @@ typedef struct _MetaWaylandXdgPositioner
   uint32_t constraint_adjustment;
   int32_t offset_x;
   int32_t offset_y;
+
+  gboolean is_reactive;
 } MetaWaylandXdgPositioner;
 
 typedef struct _MetaWaylandXdgSurfaceConstructor
@@ -1913,6 +1915,8 @@ meta_wayland_xdg_positioner_to_placement (MetaWaylandXdgPositioner *xdg_position
     .width = xdg_positioner->width,
     .height = xdg_positioner->height,
 
+    .is_reactive = xdg_positioner->is_reactive,
+
     .parent_rect = parent_rect,
   };
 }
@@ -2037,6 +2041,15 @@ xdg_positioner_set_offset (struct wl_client   *client,
   positioner->offset_y = y;
 }
 
+static void
+xdg_positioner_set_reactive (struct wl_client   *client,
+                             struct wl_resource *resource)
+{
+  MetaWaylandXdgPositioner *positioner = wl_resource_get_user_data (resource);
+
+  positioner->is_reactive = TRUE;
+}
+
 static const struct xdg_positioner_interface meta_wayland_xdg_positioner_interface = {
   xdg_positioner_destroy,
   xdg_positioner_set_size,
@@ -2045,6 +2058,7 @@ static const struct xdg_positioner_interface meta_wayland_xdg_positioner_interfa
   xdg_positioner_set_gravity,
   xdg_positioner_set_constraint_adjustment,
   xdg_positioner_set_offset,
+  xdg_positioner_set_reactive,
 };
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]