[mutter/bilelmoussaoui/x11-build-guards-2: 35/42] wayland: Move surface check to MetaWaylandSurface




commit 62bef903b096d9c759d24e241fdfc1d8a6273ffa
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Wed Jun 1 10:45:20 2022 +0200

    wayland: Move surface check to MetaWaylandSurface

 src/wayland/meta-wayland-cursor-surface.c      | 2 +-
 src/wayland/meta-wayland-pointer-constraints.c | 8 ++++----
 src/wayland/meta-wayland-surface.c             | 9 +++++++++
 src/wayland/meta-wayland-surface.h             | 2 ++
 src/wayland/meta-xwayland-dnd.c                | 2 +-
 src/wayland/meta-xwayland.c                    | 9 ---------
 src/wayland/meta-xwayland.h                    | 3 ---
 7 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/wayland/meta-wayland-cursor-surface.c b/src/wayland/meta-wayland-cursor-surface.c
index 87d55535cb..da8bd17d18 100644
--- a/src/wayland/meta-wayland-cursor-surface.c
+++ b/src/wayland/meta-wayland-cursor-surface.c
@@ -89,7 +89,7 @@ cursor_sprite_prepare_at (MetaCursorSprite         *cursor_sprite,
   MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_surface);
   MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role);
 
-  if (!meta_xwayland_is_xwayland_surface (surface))
+  if (!meta_wayland_surface_is_xwayland (surface))
     {
       MetaBackend *backend = meta_get_backend ();
       MetaMonitorManager *monitor_manager =
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index df460f9bfc..0559de220e 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -187,7 +187,7 @@ surface_constraint_data_new (MetaWaylandSurface *surface)
       connect_window (data, window);
     }
 #ifdef HAVE_XWAYLAND
-  else if (meta_xwayland_is_xwayland_surface (surface))
+  else if (meta_wayland_surface_is_xwayland (surface))
     {
       data->window_associated_handler_id =
         g_signal_connect (surface->role, "window-associated",
@@ -469,7 +469,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
        * associate the X11 Window with the wl_surface.
        */
 #ifdef HAVE_XWAYLAND
-      g_warn_if_fail (meta_xwayland_is_xwayland_surface (constraint->surface));
+      g_warn_if_fail (meta_wayland_surface_is_xwayland (constraint->surface));
 #endif
       return FALSE;
     }
@@ -481,7 +481,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
     return FALSE;
 
 #ifdef HAVE_XWAYLAND
-  if (meta_xwayland_is_xwayland_surface (constraint->surface))
+  if (meta_wayland_surface_is_xwayland (constraint->surface))
     {
       MetaDisplay *display = meta_get_display ();
 
@@ -627,7 +627,7 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
       int actual_width, actual_height;
 
 #ifdef HAVE_XWAYLAND
-      g_assert (meta_xwayland_is_xwayland_surface (constraint->surface));
+      g_assert (meta_wayland_surface_is_xwayland (constraint->surface));
 #endif
       actual_width = window->buffer_rect.width - (frame->child_x +
                                                   frame->right_width);
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 2279e894b6..fcb1c2d9bd 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -2268,3 +2268,12 @@ meta_wayland_surface_get_geometry_scale (MetaWaylandSurface *surface)
   actor_surface = META_WAYLAND_ACTOR_SURFACE (surface->role);
   return meta_wayland_actor_surface_get_geometry_scale (actor_surface);
 }
+
+gboolean
+meta_wayland_surface_is_xwayland (MetaWaylandSurface *surface)
+{
+  MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
+  MetaXWaylandManager *manager = &compositor->xwayland_manager;
+
+  return wl_resource_get_client (surface->resource) == manager->client;
+}
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index 2f8c9bd118..995ecf8898 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -371,6 +371,8 @@ meta_wayland_surface_can_scanout_untransformed (MetaWaylandSurface *surface,
 
 int meta_wayland_surface_get_geometry_scale (MetaWaylandSurface *surface);
 
+gboolean meta_wayland_surface_is_xwayland (MetaWaylandSurface *surface);
+
 static inline GNode *
 meta_get_next_subsurface_sibling (GNode *n)
 {
diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c
index 0aa4c5efba..ecd84f331a 100644
--- a/src/wayland/meta-xwayland-dnd.c
+++ b/src/wayland/meta-xwayland-dnd.c
@@ -987,7 +987,7 @@ meta_xwayland_dnd_handle_xfixes_selection_notify (MetaWaylandCompositor *composi
   focus = compositor->seat->pointer->focus_surface;
 
   if (event->owner != None && event->owner != x11_display->selection.xwindow &&
-      focus && meta_xwayland_is_xwayland_surface (focus))
+      focus && meta_wayland_surface_is_xwayland (focus))
     {
       dnd->source = meta_wayland_data_source_xwayland_new (dnd);
       meta_wayland_data_device_set_dnd_source (&compositor->seat->data_device,
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 968467558f..ba412f592d 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -131,15 +131,6 @@ meta_xwayland_handle_wl_surface_id (MetaWindow *window,
     }
 }
 
-gboolean
-meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface)
-{
-  MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
-  MetaXWaylandManager *manager = &compositor->xwayland_manager;
-
-  return wl_resource_get_client (surface->resource) == manager->client;
-}
-
 static gboolean
 try_display (int      display,
              char   **filename_out,
diff --git a/src/wayland/meta-xwayland.h b/src/wayland/meta-xwayland.h
index cbe27b1837..06f68ea2dc 100644
--- a/src/wayland/meta-xwayland.h
+++ b/src/wayland/meta-xwayland.h
@@ -39,9 +39,6 @@ void
 meta_xwayland_handle_wl_surface_id (MetaWindow *window,
                                     guint32     surface_id);
 
-gboolean
-meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface);
-
 void
 meta_xwayland_handle_xwayland_grab (MetaWindow *window,
                                     gboolean    allow);


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