monitor-manager: Move logical monitor into its own file

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2016-12-13 10:37:11 +08:00
parent 0873e3812b
commit 4e812410cc
26 changed files with 129 additions and 59 deletions

View File

@ -101,6 +101,8 @@ libmutter_la_SOURCES = \
backends/meta-idle-monitor-dbus.h \ backends/meta-idle-monitor-dbus.h \
backends/meta-input-settings.c \ backends/meta-input-settings.c \
backends/meta-input-settings-private.h \ 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.c \
backends/meta-monitor-config.h \ backends/meta-monitor-config.h \
backends/meta-monitor-manager.c \ backends/meta-monitor-manager.c \

View File

@ -41,7 +41,7 @@
#endif #endif
#include "backends/meta-idle-monitor-private.h" #include "backends/meta-idle-monitor-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-dummy.h" #include "backends/meta-monitor-manager-dummy.h"
static MetaBackend *_backend; static MetaBackend *_backend;

View File

@ -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)
{
}

View File

@ -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 */

View File

@ -59,11 +59,6 @@ typedef struct _MetaCrtcInfo MetaCrtcInfo;
typedef struct _MetaOutputInfo MetaOutputInfo; typedef struct _MetaOutputInfo MetaOutputInfo;
typedef struct _MetaTileInfo MetaTileInfo; 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 { typedef enum {
META_MONITOR_TRANSFORM_NORMAL, META_MONITOR_TRANSFORM_NORMAL,
META_MONITOR_TRANSFORM_90, META_MONITOR_TRANSFORM_90,
@ -202,47 +197,6 @@ struct _MetaCrtcMode
GDestroyNotify driver_notify; 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: * MetaCrtcInfo:
* This represents the writable part of a CRTC, as deserialized from DBus * This represents the writable part of a CRTC, as deserialized from DBus

View File

@ -37,11 +37,10 @@
#include <meta/errors.h> #include <meta/errors.h>
#include "edid.h" #include "edid.h"
#include "meta-monitor-config.h" #include "meta-monitor-config.h"
#include "backends/meta-logical-monitor.h"
#include "backends/x11/meta-monitor-manager-xrandr.h" #include "backends/x11/meta-monitor-manager-xrandr.h"
#include "meta-backend-private.h" #include "meta-backend-private.h"
G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
enum { enum {
CONFIRM_DISPLAY_CHANGE, CONFIRM_DISPLAY_CHANGE,
SIGNALS_LAST 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); 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)
{
}

View File

@ -37,6 +37,7 @@
#include "meta-cursor-renderer-native.h" #include "meta-cursor-renderer-native.h"
#include "meta-launcher.h" #include "meta-launcher.h"
#include "backends/meta-cursor-tracker-private.h" #include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-private.h" #include "backends/meta-monitor-manager-private.h"
#include "backends/meta-pointer-constraint.h" #include "backends/meta-pointer-constraint.h"
#include "backends/meta-stage.h" #include "backends/meta-stage.h"

View File

@ -50,6 +50,7 @@
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-egl.h" #include "backends/meta-egl.h"
#include "backends/meta-egl-ext.h" #include "backends/meta-egl-ext.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-renderer-view.h" #include "backends/meta-renderer-view.h"
#include "backends/native/meta-monitor-manager-kms.h" #include "backends/native/meta-monitor-manager-kms.h"
#include "backends/native/meta-renderer-native.h" #include "backends/native/meta-renderer-native.h"

View File

@ -42,6 +42,7 @@
#include <meta/main.h> #include <meta/main.h>
#include <meta/errors.h> #include <meta/errors.h>
#include "meta-monitor-config.h" #include "meta-monitor-config.h"
#include "backends/meta-logical-monitor.h"
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1) #define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)

View File

@ -32,6 +32,7 @@
#include "cogl/winsys/cogl-winsys-glx-private.h" #include "cogl/winsys/cogl-winsys-glx-private.h"
#include "cogl/winsys/cogl-winsys-egl-x11-private.h" #include "cogl/winsys/cogl-winsys-egl-x11-private.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-renderer.h" #include "backends/meta-renderer.h"
#include "backends/meta-renderer-view.h" #include "backends/meta-renderer-view.h"
#include "backends/x11/meta-renderer-x11.h" #include "backends/x11/meta-renderer-x11.h"

View File

@ -30,6 +30,7 @@
#include <cogl/cogl-wayland-server.h> #include <cogl/cogl-wayland-server.h>
#include "meta-shaped-texture-private.h" #include "meta-shaped-texture-private.h"
#include "backends/meta-logical-monitor.h"
#include "wayland/meta-wayland-buffer.h" #include "wayland/meta-wayland-buffer.h"
#include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-private.h"
#include "wayland/meta-window-wayland.h" #include "wayland/meta-window-wayland.h"

View File

@ -29,6 +29,7 @@
#include "meta-window-actor-private.h" #include "meta-window-actor-private.h"
#include "meta-texture-rectangle.h" #include "meta-texture-rectangle.h"
#include "region-utils.h" #include "region-utils.h"
#include "backends/meta-logical-monitor.h"
#include "meta-monitor-manager-private.h" #include "meta-monitor-manager-private.h"
#include "meta-cullable.h" #include "meta-cullable.h"

View File

@ -28,6 +28,7 @@
#include "place.h" #include "place.h"
#include <meta/prefs.h> #include <meta/prefs.h>
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-private.h" #include "backends/meta-monitor-manager-private.h"
#include <stdlib.h> #include <stdlib.h>

View File

@ -50,6 +50,7 @@
#include "meta-idle-monitor-dbus.h" #include "meta-idle-monitor-dbus.h"
#include "meta-cursor-tracker-private.h" #include "meta-cursor-tracker-private.h"
#include <meta/meta-backend.h> #include <meta/meta-backend.h>
#include "backends/meta-logical-monitor.h"
#include "backends/native/meta-backend-native.h" #include "backends/native/meta-backend-native.h"
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
#include "backends/meta-stage.h" #include "backends/meta-stage.h"

View File

@ -44,6 +44,7 @@
#define KEY_GRAVE 0x29 /* assume the use of xf86-input-keyboard */ #define KEY_GRAVE 0x29 /* assume the use of xf86-input-keyboard */
#endif #endif
#include "backends/meta-logical-monitor.h"
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
#include "x11/window-x11.h" #include "x11/window-x11.h"

View File

@ -27,6 +27,7 @@
#include "boxes-private.h" #include "boxes-private.h"
#include "place.h" #include "place.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include <meta/meta-backend.h> #include <meta/meta-backend.h>
#include <meta/workspace.h> #include <meta/workspace.h>
#include <meta/prefs.h> #include <meta/prefs.h>

View File

@ -45,6 +45,7 @@
#include "meta-cursor-tracker-private.h" #include "meta-cursor-tracker-private.h"
#include "boxes-private.h" #include "boxes-private.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>

View File

@ -33,6 +33,7 @@
#include <meta/group.h> #include <meta/group.h>
#include <meta/prefs.h> #include <meta/prefs.h>
#include <meta/workspace.h> #include <meta/workspace.h>
#include "backends/meta-logical-monitor.h"
#include <X11/Xatom.h> #include <X11/Xatom.h>

View File

@ -63,6 +63,7 @@
#endif #endif
#include "backends/meta-backend-private.h" #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 /* Windows that unmaximize to a size bigger than that fraction of the workarea
* will be scaled down to that size (while maintaining aspect ratio). * will be scaled down to that size (while maintaining aspect ratio).

View File

@ -33,6 +33,7 @@
#include <config.h> #include <config.h>
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "screen-private.h" #include "screen-private.h"
#include <meta/workspace.h> #include <meta/workspace.h>
#include "workspace-private.h" #include "workspace-private.h"

View File

@ -22,6 +22,7 @@
#include "tests/monitor-unit-tests.h" #include "tests/monitor-unit-tests.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "tests/meta-monitor-manager-test.h" #include "tests/meta-monitor-manager-test.h"
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1) #define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)

View File

@ -27,6 +27,7 @@
#include "meta-wayland-outputs.h" #include "meta-wayland-outputs.h"
#include "meta-wayland-private.h" #include "meta-wayland-private.h"
#include "backends/meta-logical-monitor.h"
#include "meta-monitor-manager-private.h" #include "meta-monitor-manager-private.h"
#include <string.h> #include <string.h>

View File

@ -29,6 +29,7 @@
#include "screen-private.h" #include "screen-private.h"
#include "meta-wayland-private.h" #include "meta-wayland-private.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
typedef struct _MetaWaylandSurfaceRoleCursorPrivate MetaWaylandSurfaceRoleCursorPrivate; typedef struct _MetaWaylandSurfaceRoleCursorPrivate MetaWaylandSurfaceRoleCursorPrivate;

View File

@ -25,6 +25,7 @@
#include "wayland/meta-wayland-xdg-shell.h" #include "wayland/meta-wayland-xdg-shell.h"
#include "backends/meta-logical-monitor.h"
#include "core/window-private.h" #include "core/window-private.h"
#include "wayland/meta-wayland.h" #include "wayland/meta-wayland.h"
#include "wayland/meta-wayland-popup.h" #include "wayland/meta-wayland-popup.h"

View File

@ -36,6 +36,7 @@
#include "meta-wayland-surface.h" #include "meta-wayland-surface.h"
#include "meta-wayland-xdg-shell.h" #include "meta-wayland-xdg-shell.h"
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "compositor/meta-surface-actor-wayland.h" #include "compositor/meta-surface-actor-wayland.h"
struct _MetaWindowWayland struct _MetaWindowWayland

View File

@ -50,6 +50,7 @@
#include "session.h" #include "session.h"
#include "workspace-private.h" #include "workspace-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
struct _MetaWindowX11Class struct _MetaWindowX11Class