[mutter] monitor-manager: Move logical monitor into its own file



commit 4e812410ccb9a2ff1c5470b463aebd9945b540e5
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Dec 13 10:37:11 2016 +0800

    monitor-manager: Move logical monitor into its own file
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777732

 src/Makefile.am                                |    2 +
 src/backends/meta-backend.c                    |    2 +-
 src/backends/meta-logical-monitor.c            |   36 ++++++++++++
 src/backends/meta-logical-monitor.h            |   69 ++++++++++++++++++++++++
 src/backends/meta-monitor-manager-private.h    |   46 ----------------
 src/backends/meta-monitor-manager.c            |   13 +----
 src/backends/native/meta-backend-native.c      |    1 +
 src/backends/native/meta-renderer-native.c     |    1 +
 src/backends/x11/meta-monitor-manager-xrandr.c |    1 +
 src/backends/x11/meta-renderer-x11.c           |    1 +
 src/compositor/meta-surface-actor-wayland.c    |    1 +
 src/compositor/meta-window-actor.c             |    1 +
 src/core/constraints.c                         |    1 +
 src/core/display.c                             |    1 +
 src/core/keybindings.c                         |    1 +
 src/core/place.c                               |    1 +
 src/core/screen.c                              |    1 +
 src/core/stack.c                               |    1 +
 src/core/window.c                              |    1 +
 src/core/workspace.c                           |    1 +
 src/tests/monitor-unit-tests.c                 |    1 +
 src/wayland/meta-wayland-outputs.c             |    1 +
 src/wayland/meta-wayland-surface-role-cursor.c |    1 +
 src/wayland/meta-wayland-xdg-shell.c           |    1 +
 src/wayland/meta-window-wayland.c              |    1 +
 src/x11/window-x11.c                           |    1 +
 26 files changed, 129 insertions(+), 59 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 15f6077..b2509ad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,6 +101,8 @@ libmutter_la_SOURCES =                              \
        backends/meta-idle-monitor-dbus.h       \
        backends/meta-input-settings.c          \
        backends/meta-input-settings-private.h  \
+       backends/meta-logical-monitor.c         \
+       backends/meta-logical-monitor.h         \
        backends/meta-monitor-config.c          \
        backends/meta-monitor-config.h          \
        backends/meta-monitor-manager.c         \
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 6891794..d4ec4e6 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -41,7 +41,7 @@
 #endif
 
 #include "backends/meta-idle-monitor-private.h"
-
+#include "backends/meta-logical-monitor.h"
 #include "backends/meta-monitor-manager-dummy.h"
 
 static MetaBackend *_backend;
diff --git a/src/backends/meta-logical-monitor.c b/src/backends/meta-logical-monitor.c
new file mode 100644
index 0000000..19ca43d
--- /dev/null
+++ b/src/backends/meta-logical-monitor.c
@@ -0,0 +1,36 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2016 Red Hat
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include "backends/meta-logical-monitor.h"
+
+G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
+
+static void
+meta_logical_monitor_init (MetaLogicalMonitor *logical_monitor)
+{
+}
+
+static void
+meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass)
+{
+}
diff --git a/src/backends/meta-logical-monitor.h b/src/backends/meta-logical-monitor.h
new file mode 100644
index 0000000..42002bc
--- /dev/null
+++ b/src/backends/meta-logical-monitor.h
@@ -0,0 +1,69 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2016 Red Hat
+ *
+ * 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_LOGICAL_MONITOR_H
+#define META_LOGICAL_MONITOR_H
+
+#include <glib-object.h>
+
+#include "backends/meta-monitor-manager-private.h"
+#include "meta/boxes.h"
+
+#define META_MAX_OUTPUTS_PER_MONITOR 4
+
+struct _MetaLogicalMonitor
+{
+  GObject parent;
+
+  int number;
+  MetaRectangle rect;
+  /* for tiled monitors these are calculated, from untiled just copied */
+  float refresh_rate;
+  int width_mm;
+  int height_mm;
+  gboolean is_primary;
+  gboolean is_presentation; /* XXX: not yet used */
+  gboolean in_fullscreen;
+  int scale;
+
+  /* The primary or first output for this monitor, 0 if we can't figure out.
+     It can be matched to a winsys_id of a MetaOutput.
+
+     This is used as an opaque token on reconfiguration when switching from
+     clone to extened, to decide on what output the windows should go next
+     (it's an attempt to keep windows on the same monitor, and preferably on
+     the primary one).
+  */
+  glong winsys_id;
+
+  guint32 tile_group_id;
+
+  int monitor_winsys_xid;
+  int n_outputs;
+  MetaOutput *outputs[META_MAX_OUTPUTS_PER_MONITOR];
+};
+
+#define META_TYPE_LOGICAL_MONITOR (meta_logical_monitor_get_type ())
+G_DECLARE_FINAL_TYPE (MetaLogicalMonitor, meta_logical_monitor,
+                      META, LOGICAL_MONITOR,
+                      GObject)
+
+#endif /* META_LOGICAL_MONITOR_H */
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 16b59c6..53f1e4e 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -59,11 +59,6 @@ typedef struct _MetaCrtcInfo MetaCrtcInfo;
 typedef struct _MetaOutputInfo MetaOutputInfo;
 typedef struct _MetaTileInfo MetaTileInfo;
 
-#define META_TYPE_LOGICAL_MONITOR (meta_logical_monitor_get_type ())
-G_DECLARE_FINAL_TYPE (MetaLogicalMonitor, meta_logical_monitor,
-                      META, LOGICAL_MONITOR,
-                      GObject)
-
 typedef enum {
   META_MONITOR_TRANSFORM_NORMAL,
   META_MONITOR_TRANSFORM_90,
@@ -202,47 +197,6 @@ struct _MetaCrtcMode
   GDestroyNotify driver_notify;
 };
 
-#define META_MAX_OUTPUTS_PER_MONITOR 4
-/**
- * MetaLogicalMonitor:
- *
- * A structure with high-level information about regions of the whole screen
- * output. It corresponds to a subset of the compositor coordinate space, and
- * may have one or more actual monitors associated with it. No two logical
- * monitors will cover the same screen output.
- */
-struct _MetaLogicalMonitor
-{
-  GObject parent;
-
-  int number;
-  MetaRectangle rect;
-  /* for tiled monitors these are calculated, from untiled just copied */
-  float refresh_rate;
-  int width_mm;
-  int height_mm;
-  gboolean is_primary;
-  gboolean is_presentation; /* XXX: not yet used */
-  gboolean in_fullscreen;
-  int scale;
-
-  /* The primary or first output for this monitor, 0 if we can't figure out.
-     It can be matched to a winsys_id of a MetaOutput.
-
-     This is used as an opaque token on reconfiguration when switching from
-     clone to extened, to decide on what output the windows should go next
-     (it's an attempt to keep windows on the same monitor, and preferably on
-     the primary one).
-  */
-  glong winsys_id;
-
-  guint32 tile_group_id;
-
-  int monitor_winsys_xid;
-  int n_outputs;
-  MetaOutput *outputs[META_MAX_OUTPUTS_PER_MONITOR];
-};
-
 /*
  * MetaCrtcInfo:
  * This represents the writable part of a CRTC, as deserialized from DBus
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 2f9efaa..588c084 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -37,11 +37,10 @@
 #include <meta/errors.h>
 #include "edid.h"
 #include "meta-monitor-config.h"
+#include "backends/meta-logical-monitor.h"
 #include "backends/x11/meta-monitor-manager-xrandr.h"
 #include "meta-backend-private.h"
 
-G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
-
 enum {
   CONFIRM_DISPLAY_CHANGE,
   SIGNALS_LAST
@@ -1756,13 +1755,3 @@ meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
 
   return meta_monitor_config_get_is_builtin_display_on (manager->config);
 }
-
-static void
-meta_logical_monitor_init (MetaLogicalMonitor *logical_monitor)
-{
-}
-
-static void
-meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass)
-{
-}
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index afc0845..83060d1 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -37,6 +37,7 @@
 #include "meta-cursor-renderer-native.h"
 #include "meta-launcher.h"
 #include "backends/meta-cursor-tracker-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "backends/meta-monitor-manager-private.h"
 #include "backends/meta-pointer-constraint.h"
 #include "backends/meta-stage.h"
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 82c4aaa..5b46cee 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -50,6 +50,7 @@
 #include "backends/meta-backend-private.h"
 #include "backends/meta-egl.h"
 #include "backends/meta-egl-ext.h"
+#include "backends/meta-logical-monitor.h"
 #include "backends/meta-renderer-view.h"
 #include "backends/native/meta-monitor-manager-kms.h"
 #include "backends/native/meta-renderer-native.h"
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 8bddbe5..ec4ccd5 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -42,6 +42,7 @@
 #include <meta/main.h>
 #include <meta/errors.h>
 #include "meta-monitor-config.h"
+#include "backends/meta-logical-monitor.h"
 
 #define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
 
diff --git a/src/backends/x11/meta-renderer-x11.c b/src/backends/x11/meta-renderer-x11.c
index bdafc2e..7d2080d 100644
--- a/src/backends/x11/meta-renderer-x11.c
+++ b/src/backends/x11/meta-renderer-x11.c
@@ -32,6 +32,7 @@
 #include "cogl/winsys/cogl-winsys-glx-private.h"
 #include "cogl/winsys/cogl-winsys-egl-x11-private.h"
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "backends/meta-renderer.h"
 #include "backends/meta-renderer-view.h"
 #include "backends/x11/meta-renderer-x11.h"
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index cd89759..cd38fcb 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -30,6 +30,7 @@
 #include <cogl/cogl-wayland-server.h>
 #include "meta-shaped-texture-private.h"
 
+#include "backends/meta-logical-monitor.h"
 #include "wayland/meta-wayland-buffer.h"
 #include "wayland/meta-wayland-private.h"
 #include "wayland/meta-window-wayland.h"
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 658a177..6b1b3c3 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -29,6 +29,7 @@
 #include "meta-window-actor-private.h"
 #include "meta-texture-rectangle.h"
 #include "region-utils.h"
+#include "backends/meta-logical-monitor.h"
 #include "meta-monitor-manager-private.h"
 #include "meta-cullable.h"
 
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 2aa2764..281fddd 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -28,6 +28,7 @@
 #include "place.h"
 #include <meta/prefs.h>
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "backends/meta-monitor-manager-private.h"
 
 #include <stdlib.h>
diff --git a/src/core/display.c b/src/core/display.c
index 998fbae..a71be59 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -50,6 +50,7 @@
 #include "meta-idle-monitor-dbus.h"
 #include "meta-cursor-tracker-private.h"
 #include <meta/meta-backend.h>
+#include "backends/meta-logical-monitor.h"
 #include "backends/native/meta-backend-native.h"
 #include "backends/x11/meta-backend-x11.h"
 #include "backends/meta-stage.h"
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index b73c794..b7853e2 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -44,6 +44,7 @@
 #define KEY_GRAVE 0x29 /* assume the use of xf86-input-keyboard */
 #endif
 
+#include "backends/meta-logical-monitor.h"
 #include "backends/x11/meta-backend-x11.h"
 #include "x11/window-x11.h"
 
diff --git a/src/core/place.c b/src/core/place.c
index 357184f..9a58466 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -27,6 +27,7 @@
 #include "boxes-private.h"
 #include "place.h"
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 #include <meta/meta-backend.h>
 #include <meta/workspace.h>
 #include <meta/prefs.h>
diff --git a/src/core/screen.c b/src/core/screen.c
index 123a7e8..67ec51f 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -45,6 +45,7 @@
 #include "meta-cursor-tracker-private.h"
 #include "boxes-private.h"
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 
 #include <X11/extensions/Xinerama.h>
 #include <X11/extensions/Xcomposite.h>
diff --git a/src/core/stack.c b/src/core/stack.c
index a9f6d1d..5895b89 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -33,6 +33,7 @@
 #include <meta/group.h>
 #include <meta/prefs.h>
 #include <meta/workspace.h>
+#include "backends/meta-logical-monitor.h"
 
 #include <X11/Xatom.h>
 
diff --git a/src/core/window.c b/src/core/window.c
index a8def44..82a8f85 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -63,6 +63,7 @@
 #endif
 
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 
 /* Windows that unmaximize to a size bigger than that fraction of the workarea
  * will be scaled down to that size (while maintaining aspect ratio).
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 7f56b62..f6d3c96 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -33,6 +33,7 @@
 
 #include <config.h>
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "screen-private.h"
 #include <meta/workspace.h>
 #include "workspace-private.h"
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index ade1d91..9d5a75a 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -22,6 +22,7 @@
 #include "tests/monitor-unit-tests.h"
 
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "tests/meta-monitor-manager-test.h"
 
 #define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 0a74619..fd6832d 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -27,6 +27,7 @@
 #include "meta-wayland-outputs.h"
 
 #include "meta-wayland-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "meta-monitor-manager-private.h"
 
 #include <string.h>
diff --git a/src/wayland/meta-wayland-surface-role-cursor.c b/src/wayland/meta-wayland-surface-role-cursor.c
index 5b5f9d6..6b6c0a0 100644
--- a/src/wayland/meta-wayland-surface-role-cursor.c
+++ b/src/wayland/meta-wayland-surface-role-cursor.c
@@ -29,6 +29,7 @@
 #include "screen-private.h"
 #include "meta-wayland-private.h"
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 
 typedef struct _MetaWaylandSurfaceRoleCursorPrivate MetaWaylandSurfaceRoleCursorPrivate;
 
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index aa355da..f26f3be 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -25,6 +25,7 @@
 
 #include "wayland/meta-wayland-xdg-shell.h"
 
+#include "backends/meta-logical-monitor.h"
 #include "core/window-private.h"
 #include "wayland/meta-wayland.h"
 #include "wayland/meta-wayland-popup.h"
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index 04d3c1f..a5bf469 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -36,6 +36,7 @@
 #include "meta-wayland-surface.h"
 #include "meta-wayland-xdg-shell.h"
 #include "backends/meta-backend-private.h"
+#include "backends/meta-logical-monitor.h"
 #include "compositor/meta-surface-actor-wayland.h"
 
 struct _MetaWindowWayland
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index b46033c..fafa929 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -50,6 +50,7 @@
 #include "session.h"
 #include "workspace-private.h"
 
+#include "backends/meta-logical-monitor.h"
 #include "backends/x11/meta-backend-x11.h"
 
 struct _MetaWindowX11Class


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