[mutter] wayland: Move calc-showing window logic to roles having windows



commit df642eb150a2760bc0de84186d2eea0fa4c48f4e
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Oct 9 09:56:34 2019 +0200

    wayland: Move calc-showing window logic to roles having windows
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/835

 src/wayland/meta-wayland-shell-surface.c | 17 +++++++++++++++++
 src/wayland/meta-wayland-surface.c       |  6 ------
 src/wayland/meta-xwayland-surface.c      | 16 ++++++++++++++++
 3 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
index 5a299b406..07dbfa9da 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -146,6 +146,21 @@ meta_wayland_shell_surface_assigned (MetaWaylandSurfaceRole *surface_role)
   surface_role_class->assigned (surface_role);
 }
 
+static void
+meta_wayland_shell_surface_surface_pre_apply_state (MetaWaylandSurfaceRole  *surface_role,
+                                                    MetaWaylandSurfaceState *pending)
+{
+  MetaWaylandSurface *surface =
+    meta_wayland_surface_role_get_surface (surface_role);
+  MetaWindow *window;
+
+  window = meta_wayland_surface_get_window (surface);
+  if (pending->newly_attached &&
+      !surface->buffer_ref.buffer &&
+      window)
+    meta_window_queue (window, META_QUEUE_CALC_SHOWING);
+}
+
 static void
 meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole  *surface_role,
                                                 MetaWaylandSurfaceState *pending)
@@ -277,6 +292,8 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
   object_class->finalize = meta_wayland_shell_surface_finalize;
 
   surface_role_class->assigned = meta_wayland_shell_surface_assigned;
+  surface_role_class->pre_apply_state =
+    meta_wayland_shell_surface_surface_pre_apply_state;
   surface_role_class->apply_state =
     meta_wayland_shell_surface_surface_apply_state;
   surface_role_class->notify_subsurface_state_changed =
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index d93141bdc..752e193e7 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -633,12 +633,6 @@ meta_wayland_surface_apply_state (MetaWaylandSurface      *surface,
 
   if (state->newly_attached)
     {
-      MetaWindow *window;
-
-      window = meta_wayland_surface_get_window (surface);
-      if (!surface->buffer_ref.buffer && window)
-        meta_window_queue (window, META_QUEUE_CALC_SHOWING);
-
       /* Always release any previously held buffer. If the buffer held is same
        * as the newly attached buffer, we still need to release it here, because
        * wl_surface.attach+commit and wl_buffer.release on the attached buffer
diff --git a/src/wayland/meta-xwayland-surface.c b/src/wayland/meta-xwayland-surface.c
index 874d123ba..2e56c95cb 100644
--- a/src/wayland/meta-xwayland-surface.c
+++ b/src/wayland/meta-xwayland-surface.c
@@ -94,6 +94,21 @@ meta_xwayland_surface_assigned (MetaWaylandSurfaceRole *surface_role)
   surface_role_class->assigned (surface_role);
 }
 
+static void
+meta_xwayland_surface_pre_apply_state (MetaWaylandSurfaceRole  *surface_role,
+                                       MetaWaylandSurfaceState *pending)
+{
+  MetaWaylandSurface *surface =
+    meta_wayland_surface_role_get_surface (surface_role);
+  MetaWindow *window;
+
+  window = meta_wayland_surface_get_window (surface);
+  if (pending->newly_attached &&
+      surface->buffer_ref.buffer &&
+      window)
+    meta_window_queue (window, META_QUEUE_CALC_SHOWING);
+}
+
 static void
 meta_xwayland_surface_get_relative_coordinates (MetaWaylandSurfaceRole *surface_role,
                                                 float                   abs_x,
@@ -175,6 +190,7 @@ meta_xwayland_surface_class_init (MetaXwaylandSurfaceClass *klass)
   object_class->finalize = meta_xwayland_surface_finalize;
 
   surface_role_class->assigned = meta_xwayland_surface_assigned;
+  surface_role_class->pre_apply_state = meta_xwayland_surface_pre_apply_state;
   surface_role_class->get_relative_coordinates =
     meta_xwayland_surface_get_relative_coordinates;
   surface_role_class->get_toplevel = meta_xwayland_surface_get_toplevel;


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