From 273d4205b5d4f6758798847bdfcd1388c65bc9c3 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 5 Jul 2021 20:59:58 +0200 Subject: [PATCH] Xrandr: support for multiple output monitors --- README.md | 2 +- src/modules/resolution.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 85eba8f54..a2bd9f482 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The following libraries are used if present: * [`libpci`](https://github.com/pciutils/pciutils): Needed for GPU output. _Should_ be available on every linux system. * [`libX11`](https://gitlab.freedesktop.org/xorg/lib/libx11): Needed for resolution output * [`libXrandr`](https://gitlab.freedesktop.org/xorg/lib/libxrandr): Needed for appending refresh rate to resolution output. -* [`libwayland-client`](https://wayland.freedesktop.org/): Better resolution performance + support for monitors with different refresh rates in wayland sessions. +* [`libwayland-client`](https://wayland.freedesktop.org/): Better resolution performance in wayland sessions. * [`libGIO`](https://developer.gnome.org/gio/unstable/): Needed for values that are only stored GSettings. * [`libDConf`](https://developer.gnome.org/dconf/unstable/): Needed for values that are only stored in DConf + Fallback for GSettings. * [`libXFConf`](https://gitlab.xfce.org/xfce/xfconf): Needed for XFWM theme and XFCE Terminal font. diff --git a/src/modules/resolution.c b/src/modules/resolution.c index ef4f71305..048ed3f06 100644 --- a/src/modules/resolution.c +++ b/src/modules/resolution.c @@ -258,7 +258,7 @@ static void xrandrHandleMonitorFallback(XrandrData* data, XRRMonitorInfo* monito static void xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo) { - bool res = false; + bool foundMode = false; for(int i = 0; i < monitorInfo->noutput; i++) { @@ -266,15 +266,13 @@ static void xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo) if(outputInfo == NULL) continue; - res = xrandrHandleOutputInfo(data, outputInfo); + if(xrandrHandleOutputInfo(data, outputInfo)) + foundMode = true; data->ffXRRFreeOutputInfo(outputInfo); - - if(res) - break; } - if(!res) + if(!foundMode) xrandrHandleMonitorFallback(data, monitorInfo); } @@ -523,7 +521,6 @@ static bool printResolutionWaylandBackend(FFinstance* instance) void ffPrintResolution(FFinstance* instance) { if( - ffPrintFromCache(instance, FF_RESOLUTION_MODULE_NAME, &instance->config.resolutionKey, &instance->config.resolutionFormat, FF_RESOLUTION_NUM_FORMAT_ARGS) || printResolutionWaylandBackend(instance) || printResolutionXrandrBackend(instance) || printResolutionX11Backend(instance)