[mutter/bilelmoussaoui/keybindings: 121/124] core: Guard MetaGroup usage




commit f28b50251640b6ce87470883c2e5983218846f73
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Fri Jun 17 11:45:33 2022 +0200

    core: Guard MetaGroup usage
    
    It is X11 specific

 src/core/display.c |  8 +++++++-
 src/core/stack.c   | 13 ++++++++++---
 src/core/window.c  | 33 +++++++++++++++++++++++++++------
 3 files changed, 44 insertions(+), 10 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index a54165feaf..b0c80e0aa7 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -2315,7 +2315,7 @@ meta_display_pong_for_serial (MetaDisplay    *display,
         }
     }
 }
-
+#ifdef HAVE_X11_CLIENT
 static MetaGroup *
 get_focused_group (MetaDisplay *display)
 {
@@ -2330,6 +2330,12 @@ get_focused_group (MetaDisplay *display)
     || ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focused_group (w->display))) \
     || ((t) == META_TAB_LIST_NORMAL_ALL && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w)))
 
+#else
+#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
+    || ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
+    || ((t) == META_TAB_LIST_NORMAL_ALL && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w)))
+#endif /* HAVE_X11_CLIENT */
+
 static MetaWindow*
 find_tab_forward (MetaDisplay   *display,
                   MetaTabList    type,
diff --git a/src/core/stack.c b/src/core/stack.c
index 481e722327..6b241e9da2 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -35,10 +35,13 @@
 #include "core/meta-workspace-manager-private.h"
 #include "core/window-private.h"
 #include "core/workspace-private.h"
-#include "meta/group.h"
 #include "meta/prefs.h"
 #include "meta/workspace.h"
+
+#ifdef HAVE_X11_CLIENT
+#include "meta/group.h"
 #include "x11/meta-x11-display-private.h"
+#endif
 
 #define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w)        \
   (meta_window_has_transient_type (w) && w->transient_for == NULL)
@@ -123,6 +126,7 @@ on_stack_changed (MetaStack *stack)
       g_array_append_val (all_root_children_stacked, stack_id);
     }
 
+#ifdef HAVE_X11_CLIENT
   if (display->x11_display)
     {
       uint64_t guard_window_id;
@@ -132,7 +136,7 @@ on_stack_changed (MetaStack *stack)
       guard_window_id = display->x11_display->guard_window;
       g_array_append_val (hidden_stack_ids, guard_window_id);
     }
-
+#endif
   /* Sync to server */
 
   meta_topic (META_DEBUG_STACK, "Restacking %u windows",
@@ -584,6 +588,7 @@ create_constraints (Constraint **constraints,
           continue;
         }
 
+#ifdef HAVE_X11_CLIENT
       if (WINDOW_TRANSIENT_FOR_WHOLE_GROUP (w))
         {
           GSList *group_windows;
@@ -632,7 +637,9 @@ create_constraints (Constraint **constraints,
 
           g_slist_free (group_windows);
         }
-      else if (w->transient_for != NULL)
+      else
+#endif /* HAVE_X11_CLIENT */
+      if (w->transient_for != NULL)
         {
           MetaWindow *parent;
 
diff --git a/src/core/window.c b/src/core/window.c
index ca864c06ed..3fd01fc3fc 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -63,7 +63,9 @@
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_11_CLIENT
 #include <X11/Xatom.h>
+#endif
 
 #include "backends/meta-backend-private.h"
 #include "backends/meta-logical-monitor.h"
@@ -79,16 +81,19 @@
 #include "core/util-private.h"
 #include "core/workspace-private.h"
 #include "meta/compositor-mutter.h"
-#include "meta/group.h"
 #include "meta/meta-cursor-tracker.h"
 #include "meta/meta-enum-types.h"
-#include "meta/meta-x11-errors.h"
 #include "meta/prefs.h"
+
+#ifdef HAVE_X11_CLIENT
+#include "meta/group.h"
 #include "ui/ui.h"
+#include "meta/meta-x11-errors.h"
 #include "x11/meta-x11-display-private.h"
 #include "x11/window-props.h"
 #include "x11/window-x11.h"
 #include "x11/xprops.h"
+#endif
 
 #ifdef HAVE_WAYLAND
 #include "wayland/meta-wayland-private.h"
@@ -1032,7 +1037,9 @@ _meta_window_shared_new (MetaDisplay         *display,
   window->size_hints.width = attrs->width;
   window->size_hints.height = attrs->height;
   /* initialize the remaining size_hints as if size_hints.flags were zero */
+#ifdef HAVE_X11_CLIENT
   meta_set_normal_hints (window, NULL);
+#endif
 
   /* And this is our unmaximized size */
   window->saved_rect = window->rect;
@@ -1483,16 +1490,16 @@ meta_window_unmanage (MetaWindow  *window,
 
   if (window->fullscreen)
     {
-      MetaGroup *group;
-
       /* If the window is fullscreen, it may be forcing
        * other windows in its group to a higher layer
        */
 
       meta_stack_freeze (window->display->stack);
-      group = meta_window_get_group (window);
+#ifdef HAVE_X11_CLIENT
+      MetaGroup *group = meta_window_get_group (window);
       if (group)
         meta_group_update_layers (group);
+#endif
       meta_stack_thaw (window->display->stack);
     }
 
@@ -1500,7 +1507,9 @@ meta_window_unmanage (MetaWindow  *window,
 
   /* safe to do this early as group.c won't re-add to the
    * group if window->unmanaging */
+#ifdef HAVE_X11_CLIENT
   meta_window_shutdown_group (window);
+#endif
 
   /* If we have the focus, focus some other window.
    * This is done first, so that if the unmap causes
@@ -4462,6 +4471,7 @@ meta_window_get_titlebar_rect (MetaWindow    *window,
 const char*
 meta_window_get_startup_id (MetaWindow *window)
 {
+#ifdef HAVE_X11_CLIENT
   if (window->startup_id == NULL)
     {
       MetaGroup *group;
@@ -4471,7 +4481,7 @@ meta_window_get_startup_id (MetaWindow *window)
       if (group != NULL)
         return meta_group_get_startup_id (group);
     }
-
+#endif
   return window->startup_id;
 }
 
@@ -6493,6 +6503,7 @@ gboolean
 meta_window_same_application (MetaWindow *window,
                               MetaWindow *other_window)
 {
+#ifdef HAVE_X11_CLIENT
   MetaGroup *group       = meta_window_get_group (window);
   MetaGroup *other_group = meta_window_get_group (other_window);
 
@@ -6500,6 +6511,9 @@ meta_window_same_application (MetaWindow *window,
     group!=NULL &&
     other_group!=NULL &&
     group==other_group;
+#else
+  return FALSE;
+#endif
 }
 
 /**
@@ -6768,13 +6782,18 @@ meta_window_get_default_layer (MetaWindow *window)
 void
 meta_window_update_layer (MetaWindow *window)
 {
+#ifdef HAVE_X11_CLIENT
   MetaGroup *group;
+#endif
 
   meta_stack_freeze (window->display->stack);
+
+#ifdef HAVE_X11_CLIENT
   group = meta_window_get_group (window);
   if (group)
     meta_group_update_layers (group);
   else
+#endif
     meta_stack_update_layer (window->display->stack, window);
   meta_stack_thaw (window->display->stack);
 }
@@ -8006,10 +8025,12 @@ meta_window_set_transient_for (MetaWindow *window,
    * equivalent to making it your group leader, to work around shortcomings
    * in programs such as xmms-- see #328211.
    */
+#ifdef HAVE_X11_CLIENT
   if (window->xtransient_for != None &&
       window->xgroup_leader != None &&
       window->xtransient_for != window->xgroup_leader)
     meta_window_group_leader_changed (window);
+#endif
 
   if (!window->constructing && !window->override_redirect)
     meta_window_queue (window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING);


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