[mutter] wayland: Use helper to set shell surface window



commit 514c7028f4582aa3a8a49f3e6cbf1b944835b1c1
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Dec 22 16:26:24 2017 +0800

    wayland: Use helper to set shell surface window
    
    The helper deals with updating the surface output state.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/5
    https://bugzilla.gnome.org/show_bug.cgi?id=791938

 src/wayland/meta-wayland-shell-surface.c | 13 +++++++++++++
 src/wayland/meta-wayland-shell-surface.h |  3 +++
 src/wayland/meta-wayland-wl-shell.c      |  4 +++-
 src/wayland/meta-wayland-xdg-shell.c     | 10 ++++++----
 4 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
index becaecb08..a33aa1647 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -73,6 +73,19 @@ meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_su
   *out_geometry = geometry;
 }
 
+void
+meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
+                                       MetaWindow              *window)
+{
+  MetaWaylandSurfaceRole *surface_role =
+    META_WAYLAND_SURFACE_ROLE (shell_surface);
+  MetaWaylandSurface *surface =
+    meta_wayland_surface_role_get_surface (surface_role);
+
+  meta_wayland_surface_set_window (surface, window);
+  meta_window_update_monitor (window, FALSE);
+}
+
 void
 meta_wayland_shell_surface_configure (MetaWaylandShellSurface *shell_surface,
                                       int                      new_x,
diff --git a/src/wayland/meta-wayland-shell-surface.h b/src/wayland/meta-wayland-shell-surface.h
index 0cfb5b69d..fbed72908 100644
--- a/src/wayland/meta-wayland-shell-surface.h
+++ b/src/wayland/meta-wayland-shell-surface.h
@@ -64,4 +64,7 @@ void meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface,
 void meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_surface,
                                                     MetaRectangle           *out_geometry);
 
+void meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
+                                            MetaWindow              *window);
+
 #endif /* META_WAYLAND_SHELL_SURFACE_H */
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c
index 4b93c95c8..ba54e0084 100644
--- a/src/wayland/meta-wayland-wl-shell.c
+++ b/src/wayland/meta-wayland-wl-shell.c
@@ -474,12 +474,14 @@ create_wl_shell_surface_window (MetaWaylandSurface *surface)
 {
   MetaWaylandWlShellSurface *wl_shell_surface =
     META_WAYLAND_WL_SHELL_SURFACE (surface->role);
+  MetaWaylandShellSurface *shell_surface =
+    META_WAYLAND_SHELL_SURFACE (wl_shell_surface);
   MetaWaylandSurface *parent;
   MetaWindow *window;
   GList *l;
 
   window = meta_window_wayland_new (meta_get_display (), surface);
-  meta_wayland_surface_set_window (surface, window);
+  meta_wayland_shell_surface_set_window (shell_surface, window);
 
   if (wl_shell_surface->title)
     meta_window_set_title (surface->window, wl_shell_surface->title);
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index 855d31342..fe564531e 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -782,6 +782,8 @@ static void
 finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
 {
   MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_popup);
+  MetaWaylandShellSurface *shell_surface =
+    META_WAYLAND_SHELL_SURFACE (xdg_surface);
   MetaWaylandSurfaceRole *surface_role = META_WAYLAND_SURFACE_ROLE (xdg_popup);
   struct wl_resource *xdg_shell_resource =
     meta_wayland_xdg_surface_get_shell_resource (xdg_surface);
@@ -833,8 +835,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
                                     &xdg_popup->parent_destroy_listener);
 
   window = meta_window_wayland_new (display, surface);
-  meta_wayland_surface_set_window (surface, window);
-  meta_window_update_monitor (window, FALSE);
+  meta_wayland_shell_surface_set_window (shell_surface, window);
 
   scaled_placement_rule = xdg_popup->setup.placement_rule;
   scale_placement_rule (&scaled_placement_rule, surface);
@@ -1498,6 +1499,7 @@ xdg_surface_constructor_get_toplevel (struct wl_client   *client,
   MetaWaylandSurface *surface = constructor->surface;
   MetaWaylandXdgToplevel *xdg_toplevel;
   MetaWaylandXdgSurface *xdg_surface;
+  MetaWaylandShellSurface *shell_surface;
   MetaWindow *window;
 
   if (!meta_wayland_surface_assign_role (surface,
@@ -1526,8 +1528,8 @@ xdg_surface_constructor_get_toplevel (struct wl_client   *client,
   meta_wayland_xdg_surface_constructor_finalize (constructor, xdg_surface);
 
   window = meta_window_wayland_new (meta_get_display (), surface);
-  meta_wayland_surface_set_window (surface, window);
-  meta_window_update_monitor (window, FALSE);
+  shell_surface = META_WAYLAND_SHELL_SURFACE (xdg_surface);
+  meta_wayland_shell_surface_set_window (shell_surface, window);
 }
 
 static void


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