[mutter] monitor-transform: Move helper functions into their own file
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-transform: Move helper functions into their own file
- Date: Sat, 5 Jan 2019 13:35:31 +0000 (UTC)
commit 676a8da005eadf58243025a9a977fbf5d924631c
Author: Robert Mader <robert mader posteo de>
Date: Sat Jan 5 14:15:23 2019 +0100
monitor-transform: Move helper functions into their own file
The existing ones are statically inlined, so there is no .c file
right now.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/366
src/Makefile.am | 1 +
src/backends/meta-backend-types.h | 12 +------
src/backends/meta-crtc.h | 1 +
src/backends/meta-monitor-manager-private.h | 16 +--------
src/backends/meta-monitor-transform.h | 53 +++++++++++++++++++++++++++++
src/compositor/region-utils.c | 1 +
src/meson.build | 1 +
7 files changed, 59 insertions(+), 26 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 6e7c01158..f37d095c2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -160,6 +160,7 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
backends/meta-monitor-manager-private.h \
backends/meta-monitor-manager-dummy.c \
backends/meta-monitor-manager-dummy.h \
+ backends/meta-monitor-transform.h \
backends/meta-orientation-manager.c \
backends/meta-orientation-manager.h \
backends/meta-output.c \
diff --git a/src/backends/meta-backend-types.h b/src/backends/meta-backend-types.h
index 8eeba981d..66b6ae238 100644
--- a/src/backends/meta-backend-types.h
+++ b/src/backends/meta-backend-types.h
@@ -33,17 +33,7 @@ typedef struct _MetaMonitorTiled MetaMonitorTiled;
typedef struct _MetaMonitorSpec MetaMonitorSpec;
typedef struct _MetaLogicalMonitor MetaLogicalMonitor;
-typedef enum _MetaMonitorTransform
-{
- META_MONITOR_TRANSFORM_NORMAL,
- META_MONITOR_TRANSFORM_90,
- META_MONITOR_TRANSFORM_180,
- META_MONITOR_TRANSFORM_270,
- META_MONITOR_TRANSFORM_FLIPPED,
- META_MONITOR_TRANSFORM_FLIPPED_90,
- META_MONITOR_TRANSFORM_FLIPPED_180,
- META_MONITOR_TRANSFORM_FLIPPED_270,
-} MetaMonitorTransform;
+typedef enum _MetaMonitorTransform MetaMonitorTransform;
typedef struct _MetaMonitorMode MetaMonitorMode;
diff --git a/src/backends/meta-crtc.h b/src/backends/meta-crtc.h
index 8ef24551a..ecd02bc21 100644
--- a/src/backends/meta-crtc.h
+++ b/src/backends/meta-crtc.h
@@ -23,6 +23,7 @@
#include <glib-object.h>
#include "backends/meta-backend-types.h"
+#include "backends/meta-monitor-transform.h"
#include "meta/boxes.h"
/* Same as KMS mode flags and X11 randr flags */
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 4d0aca55f..69c3036c4 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -41,6 +41,7 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-cursor.h"
#include "backends/meta-display-config-shared.h"
+#include "backends/meta-monitor-transform.h"
#include "meta/display.h"
#include "meta/meta-monitor-manager.h"
@@ -335,19 +336,4 @@ void meta_monitor_manager_clear_output (MetaOutput *output);
void meta_monitor_manager_clear_mode (MetaCrtcMode *mode);
void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
-/* Returns true if transform causes width and height to be inverted
- This is true for the odd transforms in the enum */
-static inline gboolean
-meta_monitor_transform_is_rotated (MetaMonitorTransform transform)
-{
- return (transform % 2);
-}
-
-/* Returns true if transform involves flipping */
-static inline gboolean
-meta_monitor_transform_is_flipped (MetaMonitorTransform transform)
-{
- return (transform >= META_MONITOR_TRANSFORM_FLIPPED);
-}
-
#endif /* META_MONITOR_MANAGER_PRIVATE_H */
diff --git a/src/backends/meta-monitor-transform.h b/src/backends/meta-monitor-transform.h
new file mode 100644
index 000000000..87aa9c761
--- /dev/null
+++ b/src/backends/meta-monitor-transform.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2018 Robert Mader
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef META_MONITOR_TRANSFORM_H
+#define META_MONITOR_TRANSFORM_H
+
+#include <glib-object.h>
+
+#include "backends/meta-backend-types.h"
+
+enum _MetaMonitorTransform
+{
+ META_MONITOR_TRANSFORM_NORMAL,
+ META_MONITOR_TRANSFORM_90,
+ META_MONITOR_TRANSFORM_180,
+ META_MONITOR_TRANSFORM_270,
+ META_MONITOR_TRANSFORM_FLIPPED,
+ META_MONITOR_TRANSFORM_FLIPPED_90,
+ META_MONITOR_TRANSFORM_FLIPPED_180,
+ META_MONITOR_TRANSFORM_FLIPPED_270,
+};
+
+/* Returns true if transform causes width and height to be inverted
+ This is true for the odd transforms in the enum */
+static inline gboolean
+meta_monitor_transform_is_rotated (MetaMonitorTransform transform)
+{
+ return (transform % 2);
+}
+
+/* Returns true if transform involves flipping */
+static inline gboolean
+meta_monitor_transform_is_flipped (MetaMonitorTransform transform)
+{
+ return (transform >= META_MONITOR_TRANSFORM_FLIPPED);
+}
+
+#endif /* META_MONITOR_TRANSFORM_H */
diff --git a/src/compositor/region-utils.c b/src/compositor/region-utils.c
index 4d2ae1df0..1719a4500 100644
--- a/src/compositor/region-utils.c
+++ b/src/compositor/region-utils.c
@@ -20,6 +20,7 @@
#include "config.h"
+#include "backends/meta-monitor-transform.h"
#include "compositor/region-utils.h"
#include <math.h>
diff --git a/src/meson.build b/src/meson.build
index ca08e25da..c0db00bb8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -202,6 +202,7 @@ mutter_sources = [
'backends/meta-monitor-manager-dummy.c',
'backends/meta-monitor-manager-dummy.h',
'backends/meta-monitor-manager-private.h',
+ 'backends/meta-monitor-transform.h',
'backends/meta-orientation-manager.c',
'backends/meta-orientation-manager.h',
'backends/meta-output.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]