[gnome-flashback] crtc-xrandr: respect configured RANDR panning
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] crtc-xrandr: respect configured RANDR panning
- Date: Tue, 16 Mar 2021 15:38:07 +0000 (UTC)
commit 4b54b3677779ac86d900e7d5b917a5beb8155d22
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Mar 16 16:47:50 2021 +0200
crtc-xrandr: respect configured RANDR panning
Based on mutter commits:
https://gitlab.gnome.org/GNOME/mutter/-/commit/0462208d4e27a763f1ce
https://gitlab.gnome.org/GNOME/mutter/-/commit/e77e454d3424091cbd0c
backends/gf-crtc-xrandr.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/backends/gf-crtc-xrandr.c b/backends/gf-crtc-xrandr.c
index d57d4d4..c01f2c9 100644
--- a/backends/gf-crtc-xrandr.c
+++ b/backends/gf-crtc-xrandr.c
@@ -135,13 +135,23 @@ gf_crtc_xrandr_new (GfGpuXrandr *gpu_xrandr,
{
GfGpu *gpu;
+ GfBackend *backend;
+ GfMonitorManager *monitor_manager;
+ GfMonitorManagerXrandr *monitor_manager_xrandr;
+ Display *xdisplay;
GfMonitorTransform all_transforms;
GfCrtcXrandr *crtc_xrandr;
+ XRRPanning *panning;
unsigned int i;
GList *modes;
gpu = GF_GPU (gpu_xrandr);
+ backend = gf_gpu_get_backend (gpu);
+ monitor_manager = gf_backend_get_monitor_manager (backend);
+ monitor_manager_xrandr = GF_MONITOR_MANAGER_XRANDR (monitor_manager);
+ xdisplay = gf_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
+
all_transforms = gf_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
crtc_xrandr = g_object_new (GF_TYPE_CRTC_XRANDR,
@@ -150,14 +160,29 @@ gf_crtc_xrandr_new (GfGpuXrandr *gpu_xrandr,
"all-transforms", all_transforms,
NULL);
- crtc_xrandr->rect = (GfRectangle) {
- .x = xrandr_crtc->x,
- .y = xrandr_crtc->y,
- .width = xrandr_crtc->width,
- .height = xrandr_crtc->height,
- };
crtc_xrandr->transform = gf_monitor_transform_from_xrandr (xrandr_crtc->rotation);
+ panning = XRRGetPanning (xdisplay, resources, crtc_id);
+ if (panning && panning->width > 0 && panning->height > 0)
+ {
+ crtc_xrandr->rect = (GfRectangle) {
+ .x = panning->left,
+ .y = panning->top,
+ .width = panning->width,
+ .height = panning->height
+ };
+ }
+ else
+ {
+ crtc_xrandr->rect = (GfRectangle) {
+ .x = xrandr_crtc->x,
+ .y = xrandr_crtc->y,
+ .width = xrandr_crtc->width,
+ .height = xrandr_crtc->height
+ };
+ }
+ XRRFreePanning (panning);
+
modes = gf_gpu_get_modes (gpu);
for (i = 0; i < (guint) resources->nmode; i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]