|
|
bfb30e |
From 078547521dd709d41ac3791322f711030ccc50e9 Mon Sep 17 00:00:00 2001
|
|
|
bfb30e |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
bfb30e |
Date: Wed, 27 Nov 2019 19:03:50 +0100
|
|
|
bfb30e |
Subject: [PATCH 1/2] monitor-manager-xrandr: Move dpms state and screen size
|
|
|
bfb30e |
updating into helpers
|
|
|
bfb30e |
|
|
|
bfb30e |
To be used by no-Xrandr fallback path.
|
|
|
bfb30e |
---
|
|
|
bfb30e |
src/backends/x11/meta-gpu-xrandr.c | 37 +++++++++++++------
|
|
|
bfb30e |
.../x11/meta-monitor-manager-xrandr.c | 18 ++++++---
|
|
|
bfb30e |
2 files changed, 38 insertions(+), 17 deletions(-)
|
|
|
bfb30e |
|
|
|
bfb30e |
diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c
|
|
|
bfb30e |
index 90b33d486..1884278ca 100644
|
|
|
bfb30e |
--- a/src/backends/x11/meta-gpu-xrandr.c
|
|
|
bfb30e |
+++ b/src/backends/x11/meta-gpu-xrandr.c
|
|
|
bfb30e |
@@ -91,6 +91,30 @@ meta_gpu_xrandr_poll_hardware (MetaGpu *gpu)
|
|
|
bfb30e |
gpu_xrandr->need_hardware_poll = TRUE;
|
|
|
bfb30e |
}
|
|
|
bfb30e |
|
|
|
bfb30e |
+static void
|
|
|
bfb30e |
+update_screen_size (MetaGpuXrandr *gpu_xrandr)
|
|
|
bfb30e |
+{
|
|
|
bfb30e |
+ MetaGpu *gpu = META_GPU (gpu_xrandr);
|
|
|
bfb30e |
+ MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
|
|
|
bfb30e |
+ MetaMonitorManagerXrandr *monitor_manager_xrandr =
|
|
|
bfb30e |
+ META_MONITOR_MANAGER_XRANDR (monitor_manager);
|
|
|
bfb30e |
+ Display *xdisplay =
|
|
|
bfb30e |
+ meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
|
|
|
bfb30e |
+ int min_width, min_height;
|
|
|
bfb30e |
+ Screen *screen;
|
|
|
bfb30e |
+
|
|
|
bfb30e |
+ XRRGetScreenSizeRange (xdisplay, DefaultRootWindow (xdisplay),
|
|
|
bfb30e |
+ &min_width,
|
|
|
bfb30e |
+ &min_height,
|
|
|
bfb30e |
+ &gpu_xrandr->max_screen_width,
|
|
|
bfb30e |
+ &gpu_xrandr->max_screen_height);
|
|
|
bfb30e |
+
|
|
|
bfb30e |
+ screen = ScreenOfDisplay (xdisplay, DefaultScreen (xdisplay));
|
|
|
bfb30e |
+ /* This is updated because we called XRRUpdateConfiguration. */
|
|
|
bfb30e |
+ monitor_manager->screen_width = WidthOfScreen (screen);
|
|
|
bfb30e |
+ monitor_manager->screen_height = HeightOfScreen (screen);
|
|
|
bfb30e |
+}
|
|
|
bfb30e |
+
|
|
|
bfb30e |
static gboolean
|
|
|
bfb30e |
meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
|
|
bfb30e |
GError **error)
|
|
|
bfb30e |
@@ -105,8 +129,6 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
|
|
bfb30e |
RROutput primary_output;
|
|
|
bfb30e |
unsigned int i, j;
|
|
|
bfb30e |
GList *l;
|
|
|
bfb30e |
- int min_width, min_height;
|
|
|
bfb30e |
- Screen *screen;
|
|
|
bfb30e |
GList *outputs = NULL;
|
|
|
bfb30e |
GList *modes = NULL;
|
|
|
bfb30e |
GList *crtcs = NULL;
|
|
|
bfb30e |
@@ -115,16 +137,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
|
|
bfb30e |
XRRFreeScreenResources (gpu_xrandr->resources);
|
|
|
bfb30e |
gpu_xrandr->resources = NULL;
|
|
|
bfb30e |
|
|
|
bfb30e |
- XRRGetScreenSizeRange (xdisplay, DefaultRootWindow (xdisplay),
|
|
|
bfb30e |
- &min_width,
|
|
|
bfb30e |
- &min_height,
|
|
|
bfb30e |
- &gpu_xrandr->max_screen_width,
|
|
|
bfb30e |
- &gpu_xrandr->max_screen_height);
|
|
|
bfb30e |
-
|
|
|
bfb30e |
- screen = ScreenOfDisplay (xdisplay, DefaultScreen (xdisplay));
|
|
|
bfb30e |
- /* This is updated because we called XRRUpdateConfiguration. */
|
|
|
bfb30e |
- monitor_manager->screen_width = WidthOfScreen (screen);
|
|
|
bfb30e |
- monitor_manager->screen_height = HeightOfScreen (screen);
|
|
|
bfb30e |
+ update_screen_size (gpu_xrandr);
|
|
|
bfb30e |
|
|
|
bfb30e |
if (gpu_xrandr->need_hardware_poll)
|
|
|
bfb30e |
{
|
|
|
bfb30e |
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
bfb30e |
index b8d6342b6..7a0b43ac4 100644
|
|
|
bfb30e |
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
bfb30e |
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
|
|
|
bfb30e |
@@ -146,12 +146,9 @@ x11_dpms_state_to_power_save (CARD16 dpms_state)
|
|
|
bfb30e |
}
|
|
|
bfb30e |
|
|
|
bfb30e |
static void
|
|
|
bfb30e |
-meta_monitor_manager_xrandr_read_current_state (MetaMonitorManager *manager)
|
|
|
bfb30e |
+meta_monitor_manager_xrandr_update_dpms_state (MetaMonitorManagerXrandr *manager_xrandr)
|
|
|
bfb30e |
{
|
|
|
bfb30e |
- MetaMonitorManagerXrandr *manager_xrandr =
|
|
|
bfb30e |
- META_MONITOR_MANAGER_XRANDR (manager);
|
|
|
bfb30e |
- MetaMonitorManagerClass *parent_class =
|
|
|
bfb30e |
- META_MONITOR_MANAGER_CLASS (meta_monitor_manager_xrandr_parent_class);
|
|
|
bfb30e |
+ MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
|
|
|
bfb30e |
Display *xdisplay = meta_monitor_manager_xrandr_get_xdisplay (manager_xrandr);
|
|
|
bfb30e |
BOOL dpms_capable, dpms_enabled;
|
|
|
bfb30e |
CARD16 dpms_state;
|
|
|
bfb30e |
@@ -167,6 +164,17 @@ meta_monitor_manager_xrandr_read_current_state (MetaMonitorManager *manager)
|
|
|
bfb30e |
power_save_mode = META_POWER_SAVE_UNSUPPORTED;
|
|
|
bfb30e |
|
|
|
bfb30e |
meta_monitor_manager_power_save_mode_changed (manager, power_save_mode);
|
|
|
bfb30e |
+}
|
|
|
bfb30e |
+
|
|
|
bfb30e |
+static void
|
|
|
bfb30e |
+meta_monitor_manager_xrandr_read_current_state (MetaMonitorManager *manager)
|
|
|
bfb30e |
+{
|
|
|
bfb30e |
+ MetaMonitorManagerXrandr *manager_xrandr =
|
|
|
bfb30e |
+ META_MONITOR_MANAGER_XRANDR (manager);
|
|
|
bfb30e |
+ MetaMonitorManagerClass *parent_class =
|
|
|
bfb30e |
+ META_MONITOR_MANAGER_CLASS (meta_monitor_manager_xrandr_parent_class);
|
|
|
bfb30e |
+
|
|
|
bfb30e |
+ meta_monitor_manager_xrandr_update_dpms_state (manager_xrandr);
|
|
|
bfb30e |
|
|
|
bfb30e |
parent_class->read_current_state (manager);
|
|
|
bfb30e |
}
|
|
|
bfb30e |
--
|
|
|
bfb30e |
2.23.0
|
|
|
bfb30e |
|