|
|
e82d74 |
From bac090f571e6f413ba2a362ed2d70146b7701d16 Mon Sep 17 00:00:00 2001
|
|
|
e82d74 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
e82d74 |
Date: Mon, 24 Feb 2020 17:37:34 +0100
|
|
|
e82d74 |
Subject: [PATCH] crtc-xrandr: Respect configured RANDR panning
|
|
|
e82d74 |
|
|
|
e82d74 |
A user may have configured an output to be panning, e.g. using xrandr
|
|
|
e82d74 |
--output <output> --mode <mode> --panning <size>. Respect this by making
|
|
|
e82d74 |
the logical monitor use the panning size, instead of the mode. This
|
|
|
e82d74 |
makes e.g. makes the background cover the whole panning size, and panels
|
|
|
e82d74 |
etc will cover the whole top of the panned area, instead of just the top
|
|
|
e82d74 |
left part covering the monitor if having panned to (0, 0).
|
|
|
e82d74 |
|
|
|
e82d74 |
No support is added to configuring panning, i.e. a panned monitor
|
|
|
e82d74 |
configuration cannot be stored in monitors.xml.
|
|
|
e82d74 |
|
|
|
e82d74 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1085
|
|
|
e82d74 |
---
|
|
|
e82d74 |
src/backends/x11/meta-crtc-xrandr.c | 31 +++++++++++++++++++++++++----
|
|
|
e82d74 |
1 file changed, 27 insertions(+), 4 deletions(-)
|
|
|
e82d74 |
|
|
|
e82d74 |
diff --git a/src/backends/x11/meta-crtc-xrandr.c b/src/backends/x11/meta-crtc-xrandr.c
|
|
|
e82d74 |
index d201b8581..dc3f931e3 100644
|
|
|
e82d74 |
--- a/src/backends/x11/meta-crtc-xrandr.c
|
|
|
e82d74 |
+++ b/src/backends/x11/meta-crtc-xrandr.c
|
|
|
e82d74 |
@@ -177,7 +177,14 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|
|
e82d74 |
RRCrtc crtc_id,
|
|
|
e82d74 |
XRRScreenResources *resources)
|
|
|
e82d74 |
{
|
|
|
e82d74 |
+ MetaGpu *gpu = META_GPU (gpu_xrandr);
|
|
|
e82d74 |
+ MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
|
|
|
e82d74 |
+ MetaMonitorManagerXrandr *monitor_manager_xrandr =
|
|
|
e82d74 |
+ META_MONITOR_MANAGER_XRANDR (monitor_manager);
|
|
|
e82d74 |
+ Display *xdisplay =
|
|
|
e82d74 |
+ meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
|
|
|
e82d74 |
MetaCrtc *crtc;
|
|
|
e82d74 |
+ XRRPanning *panning;
|
|
|
e82d74 |
unsigned int i;
|
|
|
e82d74 |
GList *modes;
|
|
|
e82d74 |
|
|
|
e82d74 |
@@ -185,10 +192,26 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
|
|
e82d74 |
|
|
|
e82d74 |
crtc->gpu = META_GPU (gpu_xrandr);
|
|
|
e82d74 |
crtc->crtc_id = crtc_id;
|
|
|
e82d74 |
- crtc->rect.x = xrandr_crtc->x;
|
|
|
e82d74 |
- crtc->rect.y = xrandr_crtc->y;
|
|
|
e82d74 |
- crtc->rect.width = xrandr_crtc->width;
|
|
|
e82d74 |
- crtc->rect.height = xrandr_crtc->height;
|
|
|
e82d74 |
+
|
|
|
e82d74 |
+ panning = XRRGetPanning (xdisplay, resources, crtc_id);
|
|
|
e82d74 |
+ if (panning && panning->width > 0 && panning->height > 0)
|
|
|
e82d74 |
+ {
|
|
|
e82d74 |
+ crtc->rect = (MetaRectangle) {
|
|
|
e82d74 |
+ .x = panning->left,
|
|
|
e82d74 |
+ .y = panning->top,
|
|
|
e82d74 |
+ .width = panning->width,
|
|
|
e82d74 |
+ .height = panning->height,
|
|
|
e82d74 |
+ };
|
|
|
e82d74 |
+ }
|
|
|
e82d74 |
+ else
|
|
|
e82d74 |
+ {
|
|
|
e82d74 |
+ crtc->rect = (MetaRectangle) {
|
|
|
e82d74 |
+ .x = xrandr_crtc->x,
|
|
|
e82d74 |
+ .y = xrandr_crtc->y,
|
|
|
e82d74 |
+ .width = xrandr_crtc->width,
|
|
|
e82d74 |
+ .height = xrandr_crtc->height,
|
|
|
e82d74 |
+ };
|
|
|
e82d74 |
+ }
|
|
|
e82d74 |
crtc->is_dirty = FALSE;
|
|
|
e82d74 |
crtc->transform =
|
|
|
e82d74 |
meta_monitor_transform_from_xrandr (xrandr_crtc->rotation);
|
|
|
e82d74 |
--
|
|
|
e82d74 |
2.24.1
|
|
|
e82d74 |
|