[mutter] wayland/xdg-shell: Split out popup placement out of setup finish



commit 1bd3c13fe162052917f00fba6f14019e5d972480
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Oct 24 15:02:42 2018 +0200

    wayland/xdg-shell: Split out popup placement out of setup finish
    
    Makes the function slightly more comprehensible.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/496

 src/wayland/meta-wayland-xdg-shell.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index afd4bb94b..d747f5c07 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -921,6 +921,22 @@ scale_placement_rule (MetaPlacementRule  *placement_rule,
   placement_rule->height *= geometry_scale;
 }
 
+static void
+meta_wayland_xdg_popup_place (MetaWaylandXdgPopup *xdg_popup,
+                              MetaPlacementRule   *placement_rule)
+{
+  MetaWaylandSurfaceRole *surface_role = META_WAYLAND_SURFACE_ROLE (xdg_popup);
+  MetaWaylandSurface *surface =
+    meta_wayland_surface_role_get_surface (surface_role);
+  MetaPlacementRule scaled_placement_rule;
+
+  scaled_placement_rule = *placement_rule;
+  scale_placement_rule (&scaled_placement_rule, surface);
+
+  meta_window_place_with_placement_rule (surface->window,
+                                         &scaled_placement_rule);
+}
+
 static void
 finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
 {
@@ -933,7 +949,6 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
   MetaWaylandSurface *surface =
     meta_wayland_surface_role_get_surface (surface_role);
   MetaWaylandSurface *parent_surface;
-  MetaPlacementRule scaled_placement_rule;
   MetaWaylandSeat *seat;
   uint32_t serial;
   MetaDisplay *display = meta_get_display ();
@@ -981,9 +996,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
   window = meta_window_wayland_new (display, surface);
   meta_wayland_shell_surface_set_window (shell_surface, window);
 
-  scaled_placement_rule = xdg_popup->setup.placement_rule;
-  scale_placement_rule (&scaled_placement_rule, surface);
-  meta_window_place_with_placement_rule (window, &scaled_placement_rule);
+  meta_wayland_xdg_popup_place (xdg_popup, &xdg_popup->setup.placement_rule);
 
   if (seat)
     {


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