From 3cc44b1f048e17d015fec4af0666c5eedfc991d1 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 21 Feb 2024 15:09:16 +0100 Subject: [PATCH] cleanup: Guard x11 headers includes Part-of: --- src/backends/meta-backend.c | 1 - src/backends/meta-monitor-manager.c | 5 ++++- src/backends/meta-remote-desktop-session.c | 1 - src/compositor/meta-dnd.c | 4 +++- src/core/display.c | 1 + src/core/meta-context-main.c | 11 +++++++++-- src/core/prefs.c | 1 - src/core/restart.c | 1 - src/core/startup-notification.c | 1 - src/core/window-private.h | 1 - src/core/window.c | 2 +- src/core/workspace.c | 1 - src/x11/events.c | 1 + src/x11/meta-sync-counter.h | 1 + 14 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 0afdf3344..6e3b70b66 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -66,7 +66,6 @@ #include "backends/meta-remote-access-controller-private.h" #include "backends/meta-settings-private.h" #include "backends/meta-stage-private.h" -#include "backends/x11/meta-backend-x11.h" #include "clutter/clutter-mutter.h" #include "clutter/clutter-seat-private.h" #include "compositor/meta-dnd-private.h" diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 24995edb6..50238515d 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -55,7 +55,6 @@ #include "backends/meta-orientation-manager.h" #include "backends/meta-output.h" #include "backends/meta-virtual-monitor.h" -#include "backends/x11/meta-monitor-manager-xrandr.h" #include "clutter/clutter.h" #include "core/util-private.h" #include "meta/main.h" @@ -63,6 +62,10 @@ #include "meta-dbus-display-config.h" +#ifdef HAVE_X11 +#include "backends/x11/meta-monitor-manager-xrandr.h" +#endif + #define DEFAULT_DISPLAY_CONFIGURATION_TIMEOUT 20 enum diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c index ec7298ba2..72b54f14f 100644 --- a/src/backends/meta-remote-desktop-session.c +++ b/src/backends/meta-remote-desktop-session.c @@ -37,7 +37,6 @@ #include "backends/meta-logical-monitor.h" #include "backends/meta-screen-cast-session.h" #include "backends/meta-remote-access-controller-private.h" -#include "backends/x11/meta-backend-x11.h" #include "cogl/cogl.h" #include "core/display-private.h" #include "core/meta-selection-private.h" diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c index c0205fde9..2425dac0c 100644 --- a/src/compositor/meta-dnd.c +++ b/src/compositor/meta-dnd.c @@ -25,10 +25,12 @@ #include "compositor/compositor-private.h" #include "core/display-private.h" #include "backends/meta-dnd-private.h" + +#ifdef HAVE_X11 #include "backends/x11/meta-backend-x11.h" -#include "backends/x11/meta-clutter-backend-x11.h" #include "backends/x11/meta-stage-x11.h" #include "x11/meta-x11-display-private.h" +#endif struct _MetaDndClass { diff --git a/src/core/display.c b/src/core/display.c index 9e6457583..e9197304c 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -69,6 +69,7 @@ #include "backends/x11/cm/meta-backend-x11-cm.h" #include "backends/x11/nested/meta-backend-x11-nested.h" #include "compositor/meta-compositor-x11.h" +#include "meta/group.h" #include "x11/meta-startup-notification-x11.h" #include "x11/meta-x11-display-private.h" #include "x11/window-x11.h" diff --git a/src/core/meta-context-main.c b/src/core/meta-context-main.c index 38e7f5b7e..30c410918 100644 --- a/src/core/meta-context-main.c +++ b/src/core/meta-context-main.c @@ -29,18 +29,25 @@ #include #endif +#include "backends/meta-monitor.h" #include "backends/meta-monitor-manager-private.h" #include "backends/meta-virtual-monitor.h" -#include "backends/x11/cm/meta-backend-x11-cm.h" #include "meta/meta-backend.h" + +#ifdef HAVE_X11 +#include "backends/x11/cm/meta-backend-x11-cm.h" #include "x11/session.h" +#endif #ifdef HAVE_NATIVE_BACKEND #include "backends/native/meta-backend-native.h" #endif -#ifdef HAVE_WAYLAND +#if defined (HAVE_X11) && defined (HAVE_WAYLAND) #include "backends/x11/nested/meta-backend-x11-nested.h" +#endif + +#ifdef HAVE_WAYLAND #include "wayland/meta-wayland.h" #endif diff --git a/src/core/prefs.c b/src/core/prefs.c index 99854f156..dbbe72b29 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -39,7 +39,6 @@ #include "core/prefs-private.h" #include "core/util-private.h" #include "meta/prefs.h" -#include "x11/meta-x11-display-private.h" /* If you add a key, it needs updating in init() and in the gsettings * notify listener and of course in the .schemas file. diff --git a/src/core/restart.c b/src/core/restart.c index 2097e8251..9cd4d02b0 100644 --- a/src/core/restart.c +++ b/src/core/restart.c @@ -43,7 +43,6 @@ #include "core/display-private.h" #include "core/util-private.h" #include "meta/main.h" -#include "x11/meta-x11-display-private.h" static gboolean restart_helper_started = FALSE; static gboolean restart_message_shown = FALSE; diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c index e91bc3244..27797ce07 100644 --- a/src/core/startup-notification.c +++ b/src/core/startup-notification.c @@ -29,7 +29,6 @@ #include "core/display-private.h" #include "core/startup-notification-private.h" #include "core/util-private.h" -#include "x11/meta-x11-display-private.h" /* This should be fairly long, as it should never be required unless * apps or .desktop files are buggy, and it's confusing if diff --git a/src/core/window-private.h b/src/core/window-private.h index aa302167d..069280dc7 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -39,7 +39,6 @@ #include "meta/util.h" #include "meta/window.h" #include "wayland/meta-wayland-types.h" -#include "x11/group-private.h" typedef struct _MetaWindowQueue MetaWindowQueue; diff --git a/src/core/window.c b/src/core/window.c index 04bba58ec..248f33dcb 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -82,10 +82,10 @@ #include "meta/meta-cursor-tracker.h" #include "meta/meta-enum-types.h" #include "meta/prefs.h" -#include "mtk/mtk-x11.h" #ifdef HAVE_X11_CLIENT #include "meta/group.h" +#include "mtk/mtk-x11.h" #include "x11/meta-x11-display-private.h" #include "x11/window-props.h" #include "x11/window-x11-private.h" diff --git a/src/core/workspace.c b/src/core/workspace.c index 2e626c0b5..0afb83cc7 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -46,7 +46,6 @@ #include "core/meta-workspace-manager-private.h" #include "core/workspace-private.h" #include "meta/prefs.h" -#include "x11/meta-x11-display-private.h" void meta_workspace_queue_calc_showing (MetaWorkspace *workspace); static void focus_ancestor_or_mru_window (MetaWorkspace *workspace, diff --git a/src/x11/events.c b/src/x11/events.c index fcf69e076..9f5c466df 100644 --- a/src/x11/events.c +++ b/src/x11/events.c @@ -39,6 +39,7 @@ #include "core/meta-workspace-manager-private.h" #include "core/window-private.h" #include "core/workspace-private.h" +#include "meta/group.h" #include "meta/meta-backend.h" #include "meta/meta-context.h" #include "mtk/mtk-x11.h" diff --git a/src/x11/meta-sync-counter.h b/src/x11/meta-sync-counter.h index e20b4ed8e..57f555773 100644 --- a/src/x11/meta-sync-counter.h +++ b/src/x11/meta-sync-counter.h @@ -22,6 +22,7 @@ #include "meta/window.h" #include +#include #include typedef struct