[mutter] main: Move MetaCompositorType to a new meta-enums.h



commit bf84b2423db573f624f9d1b3e1f8b574dbfc17ad
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 10:11:42 2021 +0100

    main: Move MetaCompositorType to a new meta-enums.h
    
    It'll be part of and owned by MetaContext, intending to replace
    `meta_is_wayland_compositor()`, but place it in a new file for public
    enums so that it can be used from wherever.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/core/main-private.h                   |  9 +--------
 src/core/main.c                           |  1 +
 src/core/mutter.c                         |  1 +
 src/meta/meson.build                      |  1 +
 src/meta/meta-enums.h                     | 30 ++++++++++++++++++++++++++++++
 src/tests/clutter/interactive/test-main.c |  1 +
 src/tests/headless-start-test.c           |  1 +
 src/tests/native-headless.c               |  1 +
 src/tests/ref-test-sanity.c               |  1 +
 src/tests/stage-view-tests.c              |  1 +
 src/tests/unit-tests.c                    |  1 +
 11 files changed, 40 insertions(+), 8 deletions(-)
---
diff --git a/src/core/main-private.h b/src/core/main-private.h
index 5b552b3cd4..eb07cf128c 100644
--- a/src/core/main-private.h
+++ b/src/core/main-private.h
@@ -21,14 +21,7 @@
 #define META_MAIN_PRIVATE_H
 
 #include "core/util-private.h"
-
-typedef enum _MetaCompositorType
-{
-#ifdef HAVE_WAYLAND
-  META_COMPOSITOR_TYPE_WAYLAND,
-#endif
-  META_COMPOSITOR_TYPE_X11,
-} MetaCompositorType;
+#include "meta/meta-enums.h"
 
 typedef enum _MetaX11DisplayPolicy
 {
diff --git a/src/core/main.c b/src/core/main.c
index 3d82773ba6..302a2a86ad 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -83,6 +83,7 @@
 #include "core/util-private.h"
 #include "meta/compositor.h"
 #include "meta/meta-backend.h"
+#include "meta/meta-enums.h"
 #include "meta/meta-x11-errors.h"
 #include "ui/ui.h"
 #include "x11/session.h"
diff --git a/src/core/mutter.c b/src/core/mutter.c
index c6dd2e75b1..811e1f92be 100644
--- a/src/core/mutter.c
+++ b/src/core/mutter.c
@@ -25,6 +25,7 @@
 
 #include "compositor/meta-plugin-manager.h"
 #include "meta/main.h"
+#include "meta/meta-enums.h"
 #include "meta/util.h"
 
 static gboolean
diff --git a/src/meta/meson.build b/src/meta/meson.build
index 631857e2de..3076f75327 100644
--- a/src/meta/meson.build
+++ b/src/meta/meson.build
@@ -18,6 +18,7 @@ mutter_public_headers = [
   'meta-cursor-tracker.h',
   'meta-context.h',
   'meta-dnd.h',
+  'meta-enums.h',
   'meta-idle-monitor.h',
   'meta-inhibit-shortcuts-dialog.h',
   'meta-launch-context.h',
diff --git a/src/meta/meta-enums.h b/src/meta/meta-enums.h
new file mode 100644
index 0000000000..373d144515
--- /dev/null
+++ b/src/meta/meta-enums.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016-2021 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#ifndef META_ENUMS_H
+#define META_ENUMS_H
+
+typedef enum _MetaCompositorType
+{
+  META_COMPOSITOR_TYPE_WAYLAND,
+  META_COMPOSITOR_TYPE_X11,
+} MetaCompositorType;
+
+#endif /* META_ENUMS_H */
diff --git a/src/tests/clutter/interactive/test-main.c b/src/tests/clutter/interactive/test-main.c
index f3d3084630..681d4ba956 100644
--- a/src/tests/clutter/interactive/test-main.c
+++ b/src/tests/clutter/interactive/test-main.c
@@ -8,6 +8,7 @@
 #include "backends/x11/nested/meta-backend-x11-nested.h"
 #include "core/main-private.h"
 #include "meta/main.h"
+#include "meta/meta-enums.h"
 #include "wayland/meta-wayland.h"
 #include "wayland/meta-xwayland.h"
 #include "test-unit-names.h"
diff --git a/src/tests/headless-start-test.c b/src/tests/headless-start-test.c
index 072dd8f209..ca06524d6b 100644
--- a/src/tests/headless-start-test.c
+++ b/src/tests/headless-start-test.c
@@ -26,6 +26,7 @@
 #include "core/display-private.h"
 #include "core/main-private.h"
 #include "meta/main.h"
+#include "meta/meta-enums.h"
 #include "tests/meta-backend-test.h"
 #include "tests/meta-monitor-manager-test.h"
 #include "tests/test-utils.h"
diff --git a/src/tests/native-headless.c b/src/tests/native-headless.c
index 6b5da665c1..a20cd1a673 100644
--- a/src/tests/native-headless.c
+++ b/src/tests/native-headless.c
@@ -26,6 +26,7 @@
 #include "core/main-private.h"
 #include "meta/main.h"
 #include "meta/meta-backend.h"
+#include "meta/meta-enums.h"
 #include "tests/native-screen-cast.h"
 #include "tests/native-virtual-monitor.h"
 #include "tests/test-utils.h"
diff --git a/src/tests/ref-test-sanity.c b/src/tests/ref-test-sanity.c
index 91710feeb8..74cecfd0c2 100644
--- a/src/tests/ref-test-sanity.c
+++ b/src/tests/ref-test-sanity.c
@@ -23,6 +23,7 @@
 #include "compositor/meta-plugin-manager.h"
 #include "core/main-private.h"
 #include "meta/main.h"
+#include "meta/meta-enums.h"
 #include "tests/meta-ref-test.h"
 #include "tests/test-utils.h"
 
diff --git a/src/tests/stage-view-tests.c b/src/tests/stage-view-tests.c
index 4131abfb8c..007d621d26 100644
--- a/src/tests/stage-view-tests.c
+++ b/src/tests/stage-view-tests.c
@@ -22,6 +22,7 @@
 #include "compositor/meta-plugin-manager.h"
 #include "core/main-private.h"
 #include "meta/main.h"
+#include "meta/meta-enums.h"
 #include "tests/meta-backend-test.h"
 #include "tests/monitor-test-utils.h"
 #include "tests/test-utils.h"
diff --git a/src/tests/unit-tests.c b/src/tests/unit-tests.c
index 880956f340..88e3a5b8a6 100644
--- a/src/tests/unit-tests.c
+++ b/src/tests/unit-tests.c
@@ -28,6 +28,7 @@
 #include "compositor/meta-plugin-manager.h"
 #include "core/boxes-private.h"
 #include "core/main-private.h"
+#include "meta/meta-enums.h"
 #include "tests/boxes-tests.h"
 #include "tests/meta-backend-test.h"
 #include "tests/monitor-config-migration-unit-tests.h"


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