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