From 25a1c237c140fe350282aebf427b610c43fc8040 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 17 Jun 2022 11:45:33 +0200 Subject: 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 e74cacef0..1256511fa 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1887,7 +1887,7 @@ meta_display_pong_for_serial (MetaDisplay *display, } } } - +#ifdef HAVE_X11_CLIENT static MetaGroup * get_focused_group (MetaDisplay *display) { @@ -1902,6 +1902,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 2481adf78..18f5d8917 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) @@ -124,6 +127,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; @@ -133,7 +137,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", @@ -585,6 +589,7 @@ create_constraints (Constraint **constraints, continue; } +#ifdef HAVE_X11_CLIENT if (WINDOW_TRANSIENT_FOR_WHOLE_GROUP (w)) { GSList *group_windows; @@ -633,7 +638,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 de7fad58a..472da0a1d 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -63,7 +63,9 @@ #include #include #include +#ifdef HAVE_11_CLIENT #include +#endif #include "backends/meta-backend-private.h" #include "backends/meta-logical-monitor.h" @@ -79,15 +81,18 @@ #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 "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" @@ -1043,7 +1048,9 @@ meta_window_constructed (GObject *object) meta_stack_freeze (display->stack); /* 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; @@ -1471,16 +1478,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); } @@ -1488,7 +1495,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 @@ -4467,6 +4476,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; @@ -4476,7 +4486,7 @@ meta_window_get_startup_id (MetaWindow *window) if (group != NULL) return meta_group_get_startup_id (group); } - +#endif return window->startup_id; } @@ -5929,6 +5939,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); @@ -5936,6 +5947,9 @@ meta_window_same_application (MetaWindow *window, group!=NULL && other_group!=NULL && group==other_group; +#else + return FALSE; +#endif } /** @@ -6113,13 +6127,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); } @@ -7351,10 +7370,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); -- cgit v1.2.1