Blame SOURCES/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch

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