summaryrefslogtreecommitdiff
path: root/setxkbmap.c
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2022-04-25 15:41:26 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-04-25 16:13:00 +0000
commitdbde2b209b70d9cdc8a66e3cc73e2d28a8e13797 (patch)
tree0eb7d3136cc58f5eb809815bb0c0db10faff3ae8 /setxkbmap.c
parent818582b435bc1807b87e547e53c488986286ff1f (diff)
Be more careful about querying randr
Check for extension version and number of outputs: XRRGetScreenResourcesCurrent was added in v1.3. Also, there's no guarantee it returns any outputs, and we don't want to die with a BadRROutput error.
Diffstat (limited to 'setxkbmap.c')
-rw-r--r--setxkbmap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/setxkbmap.c b/setxkbmap.c
index 96761a0..6b6259c 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -1090,9 +1090,12 @@ is_xwayland(void)
/* e.g. Xnest, but definitely not Xwayland */
goto out;
}
+ if (major < 1 || (major == 1 && minor < 3)) {
+ goto out;
+ }
resources = XRRGetScreenResourcesCurrent(dpy, DefaultRootWindow(dpy));
- if (!resources) {
+ if (!resources || resources->noutput < 1) {
goto out;
}