[mutter/bilelmoussaoui/x11-build-guards-2: 10/12] core/stack-tracker: Guard X11 types




commit d4e9acc50b44386e8bea36ef0ed6d02c6d1f2ecb
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Fri Jun 17 11:20:06 2022 +0200

    core/stack-tracker: Guard X11 types

 src/core/stack-tracker.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index 9c217a08ca..0abfba1950 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -41,9 +41,12 @@
 #include "core/display-private.h"
 #include "core/frame.h"
 #include "meta/compositor.h"
-#include "meta/meta-x11-errors.h"
 #include "meta/util.h"
+
+#ifdef HAVE_X11_CLIENT
+#include "meta/meta-x11-errors.h"
 #include "x11/meta-x11-display-private.h"
+#endif
 
 /* The complexity here comes from resolving two competing factors:
  *
@@ -493,6 +496,7 @@ copy_stack (GArray *stack)
   return copy;
 }
 
+#ifdef HAVE_X11_CLIENT
 static void
 query_xserver_stack (MetaDisplay      *display,
                      MetaStackTracker *tracker)
@@ -554,6 +558,7 @@ drop_x11_windows (MetaDisplay      *display,
       l = next;
     }
 }
+#endif /* HAVE_X11_CLIENT */
 
 MetaStackTracker *
 meta_stack_tracker_new (MetaDisplay *display)
@@ -566,6 +571,7 @@ meta_stack_tracker_new (MetaDisplay *display)
   tracker->verified_stack = g_array_new (FALSE, FALSE, sizeof (guint64));
   tracker->unverified_predictions = g_queue_new ();
 
+#ifdef HAVE_X11_CLIENT
   g_signal_connect (display,
                     "x11-display-setup",
                     G_CALLBACK (query_xserver_stack),
@@ -574,6 +580,7 @@ meta_stack_tracker_new (MetaDisplay *display)
                     "x11-display-closing",
                     G_CALLBACK (drop_x11_windows),
                     tracker);
+#endif
 
   meta_stack_tracker_dump (tracker);
 
@@ -594,12 +601,14 @@ meta_stack_tracker_free (MetaStackTracker *tracker)
   g_queue_free (tracker->unverified_predictions);
   tracker->unverified_predictions = NULL;
 
+#ifdef HAVE_X11_CLIENT
   g_signal_handlers_disconnect_by_func (tracker->display,
                                         (gpointer)query_xserver_stack,
                                         tracker);
   g_signal_handlers_disconnect_by_func (tracker->display,
                                         drop_x11_windows,
                                         tracker);
+#endif
 
   g_free (tracker);
 }
@@ -843,12 +852,16 @@ static gboolean
 meta_stack_tracker_is_guard_window (MetaStackTracker *tracker,
                                     uint64_t          stack_id)
 {
+#ifdef HAVE_X11_CLIENT
   MetaX11Display *x11_display = tracker->display->x11_display;
 
   if (!x11_display)
     return FALSE;
 
   return stack_id == x11_display->guard_window;
+#else
+  return FALSE;
+#endif
 }
 
 /**
@@ -932,6 +945,7 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
     {
       guint64 window = windows[i];
 
+#ifdef HAVE_X11_CLIENT
       if (META_STACK_ID_IS_X11 (window))
         {
           MetaX11Display *x11_display = tracker->display->x11_display;
@@ -952,6 +966,7 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
             meta_windows = g_list_prepend (meta_windows, meta_window);
         }
       else
+#endif
         meta_windows = g_list_prepend (meta_windows,
                                        meta_display_lookup_stamp (tracker->display, window));
     }
@@ -1001,6 +1016,7 @@ meta_stack_tracker_queue_sync_stack (MetaStackTracker *tracker)
  * otherwise it searches downwards looking for the nearest X window.
  *
  * If no X based sibling could be found return NULL. */
+#ifdef HAVE_X11_CLIENT
 static Window
 find_x11_sibling_downwards (MetaStackTracker *tracker,
                             guint64           sibling)
@@ -1058,6 +1074,7 @@ find_x11_sibling_upwards (MetaStackTracker *tracker,
 
   return None;
 }
+#endif /* HAVE_X11_CLIENT */
 
 static void
 meta_stack_tracker_lower_below (MetaStackTracker *tracker,
@@ -1065,6 +1082,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
                                 guint64           sibling)
 {
   gulong serial = 0;
+#ifdef HAVE_X11_CLIENT
   MetaX11Display *x11_display = tracker->display->x11_display;
 
   if (META_STACK_ID_IS_X11 (window))
@@ -1088,6 +1106,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
           meta_x11_error_trap_pop (x11_display);
         }
     }
+#endif
 
   meta_stack_tracker_record_lower_below (tracker,
                                          window, sibling,
@@ -1100,6 +1119,8 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
                                 guint64           sibling)
 {
   gulong serial = 0;
+
+#ifdef HAVE_X11_CLIENT
   MetaX11Display *x11_display = tracker->display->x11_display;
 
   if (META_STACK_ID_IS_X11 (window))
@@ -1123,6 +1144,7 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
           meta_x11_error_trap_pop (x11_display);
         }
     }
+#endif
 
   meta_stack_tracker_record_raise_above (tracker, window,
                                          sibling, serial);


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