From 86d5357334b6905759460aa87af3980a229ab497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Mon, 6 Jan 2025 17:38:12 -0500 Subject: [PATCH] As the final fallback for screen dimensions, use the root size. --- src/conio/x_events.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/conio/x_events.c b/src/conio/x_events.c index 75e11644ea..bf15902425 100644 --- a/src/conio/x_events.c +++ b/src/conio/x_events.c @@ -449,7 +449,7 @@ set_win_property(enum UsedAtom atom, Atom type, int format, int action, const vo static bool fullscreen_geometry(int *x_org, int *y_org, int *width, int *height) { - Window root; + Window newroot; uint64_t dummy; unsigned int rw, rh; int wx, wy; @@ -472,11 +472,11 @@ fullscreen_geometry(int *x_org, int *y_org, int *width, int *height) if (win == 0) return false; - if (x11.XGetGeometry(dpy, win, (void *)&root, &wx, &wy, &rw, &rh, (void *)&dummy, (void *)&dummy) == 0) +#if defined(WITH_XRANDR) || defined(WITH_XINERAMA) + if (x11.XGetGeometry(dpy, win, (void *)&newroot, &wx, &wy, &rw, &rh, (void *)&dummy, (void *)&dummy) == 0) return false; -#if defined(WITH_XRANDR) || defined(WITH_XINERAMA) - x11.XTranslateCoordinates(dpy, win, root, wx, wy, &cx, &cy, &cr); + x11.XTranslateCoordinates(dpy, win, newroot, wx, wy, &cx, &cy, &cr); cx += rw / 2; cy += rh / 2; #endif @@ -489,7 +489,7 @@ fullscreen_geometry(int *x_org, int *y_org, int *width, int *height) while (searched < 10 && found == false) { searched++; if (xrrsr == NULL) - xrrsr = x11.XRRGetScreenResources(dpy, root); + xrrsr = x11.XRRGetScreenResources(dpy, newroot); if (xrrsr == NULL) break; for (i = 0; i < xrrsr->ncrtc; i++) { @@ -555,6 +555,9 @@ fullscreen_geometry(int *x_org, int *y_org, int *width, int *height) } } #endif + if (x11.XGetGeometry(dpy, root, (void *)&newroot, &wx, &wy, &rw, &rh, (void *)&dummy, (void *)&dummy) == 0) + return false; + if (x_org) *x_org = 0; if (y_org) -- GitLab