summaryrefslogtreecommitdiff
path: root/lib/libXrandr/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2013-09-28 17:47:03 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2013-09-28 17:47:03 +0000
commit054d3de508f881463cd0b3f05421f503a4ba4936 (patch)
treed5c2933fc82aed4f6baba0012717601b39854536 /lib/libXrandr/src
parent754d873953d17df2feaa2310d7b250b29c286108 (diff)
Update to libXrandr 1.4.2
Diffstat (limited to 'lib/libXrandr/src')
-rw-r--r--lib/libXrandr/src/Xrandr.c3
-rw-r--r--lib/libXrandr/src/XrrProvider.c11
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/libXrandr/src/Xrandr.c b/lib/libXrandr/src/Xrandr.c
index b1e97ec30..a9fba8772 100644
--- a/lib/libXrandr/src/Xrandr.c
+++ b/lib/libXrandr/src/Xrandr.c
@@ -483,6 +483,9 @@ int XRRUpdateConfiguration(XEvent *event)
scevent = (XRRScreenChangeNotifyEvent *) event;
snum = XRRRootToScreen(dpy,
((XRRScreenChangeNotifyEvent *) event)->root);
+ if (snum < 0)
+ return 0;
+
if (scevent->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
dpy->screens[snum].width = scevent->height;
dpy->screens[snum].height = scevent->width;
diff --git a/lib/libXrandr/src/XrrProvider.c b/lib/libXrandr/src/XrrProvider.c
index 309e32110..014ddd9da 100644
--- a/lib/libXrandr/src/XrrProvider.c
+++ b/lib/libXrandr/src/XrrProvider.c
@@ -156,7 +156,16 @@ XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provi
_XRead32(dpy, xpi->outputs, rep.nOutputs << 2);
_XRead32(dpy, xpi->associated_providers, rep.nAssociatedProviders << 2);
- _XRead32(dpy, xpi->associated_capability, rep.nAssociatedProviders << 2);
+
+ /*
+ * _XRead32 reads a series of 32-bit values from the protocol and writes
+ * them out as a series of "long int" values, but associated_capability
+ * is defined as unsigned int *, so that won't work for this array.
+ * Instead we assume for now that "unsigned int" is also 32-bits, so
+ * the values can be read without any conversion.
+ */
+ _XRead(dpy, (char *) xpi->associated_capability,
+ rep.nAssociatedProviders << 2);
_XReadPad(dpy, xpi->name, rep.nameLength);
xpi->name[rep.nameLength] = '\0';