[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libxrandr: Changes to 'upstream-unstable'



 configure.ac                    |   10 --
 include/X11/extensions/Xrandr.h |   30 ++++++
 src/Makefile.am                 |    3 
 src/Xrandr.c                    |   82 ++++++++--------
 src/Xrandrint.h                 |   14 --
 src/XrrCrtc.c                   |    4 
 src/XrrMonitor.c                |  200 ++++++++++++++++++++++++++++++++++++++++
 src/XrrOutput.c                 |    6 -
 src/XrrProperty.c               |    2 
 src/XrrProvider.c               |    8 -
 src/XrrProviderProperty.c       |    2 
 src/XrrScreen.c                 |    4 
 12 files changed, 288 insertions(+), 77 deletions(-)

New commits:
commit 4437436906cbba5121115e552d564262e8b4c784
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Dec 16 01:55:30 2014 -0800

    Add monitors, update to version 1.5 (v2)
    
    v2: [airlied]
    xrandr was giving the outputs from 0 for each monitor instead of
    incrementing the pointer.
    add get_active support.
    
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index 15b1e8c..d0baa08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ AC_PREREQ([2.60])
 # digit in the version number to track changes which don't affect the
 # protocol, so Xrandr version l.n.m corresponds to protocol version l.n
 #
-AC_INIT([libXrandr], [1.4.2],
+AC_INIT([libXrandr], [1.5.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXrandr])
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS([config.h])
diff --git a/include/X11/extensions/Xrandr.h b/include/X11/extensions/Xrandr.h
index f394864..65940bb 100644
--- a/include/X11/extensions/Xrandr.h
+++ b/include/X11/extensions/Xrandr.h
@@ -552,6 +552,36 @@ XRRGetProviderProperty (Display *dpy, RRProvider provider,
 			unsigned long *nitems, unsigned long *bytes_after,
 			unsigned char **prop);
 
+
+typedef struct _XRRMonitorInfo {
+    Atom name;
+    Bool primary;
+    Bool automatic;
+    int noutput;
+    int x;
+    int y;
+    int width;
+    int height;
+    int mwidth;
+    int mheight;
+    RROutput *outputs;
+} XRRMonitorInfo;
+
+XRRMonitorInfo *
+XRRAllocateMonitor(Display *dpy, int noutput);
+
+XRRMonitorInfo *
+XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);
+
+void
+XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor);
+
+void
+XRRDeleteMonitor(Display *dpy, Window window, Atom name);
+
+void
+XRRFreeMonitors(XRRMonitorInfo *monitors);
+
 _XFUNCPROTOEND
 
 #endif /* _XRANDR_H_ */
diff --git a/src/Makefile.am b/src/Makefile.am
index 2113846..673fe2c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,7 +10,8 @@ libXrandr_la_SOURCES = 	\
 	XrrProperty.c	\
 	XrrScreen.c     \
 	XrrProvider.c   \
-	XrrProviderProperty.c
+	XrrProviderProperty.c \
+	XrrMonitor.c
 
 libXrandr_la_LIBADD = @RANDR_LIBS@
 
diff --git a/src/XrrMonitor.c b/src/XrrMonitor.c
new file mode 100644
index 0000000..71d3943
--- /dev/null
+++ b/src/XrrMonitor.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+/* we need to be able to manipulate the Display structure on events */
+#include <X11/Xlibint.h>
+#include <X11/extensions/render.h>
+#include <X11/extensions/Xrender.h>
+#include "Xrandrint.h"
+
+XRRMonitorInfo *
+XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors)
+{
+    XExtDisplayInfo	    *info = XRRFindDisplay(dpy);
+    xRRGetMonitorsReply	    rep;
+    xRRGetMonitorsReq	    *req;
+    int			    nbytes, nbytesRead, rbytes;
+    int			    nmon, noutput;
+    int			    m, o;
+    char		    *buf, *buf_head;
+    xRRMonitorInfo	    *xmon;
+    CARD32		    *xoutput;
+    XRRMonitorInfo	    *mon = NULL;
+    RROutput		    *output;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    *nmonitors = -1;
+
+    LockDisplay (dpy);
+    GetReq (RRGetMonitors, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetMonitors;
+    req->window = window;
+    req->get_active = get_active;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+	UnlockDisplay (dpy);
+	SyncHandle ();
+	return NULL;
+    }
+
+    nbytes = (long) rep.length << 2;
+    nmon = rep.nmonitors;
+    noutput = rep.noutputs;
+    nbytesRead = nmon * SIZEOF(xRRMonitorInfo) + noutput * 4;
+
+    if (nmon > 0) {
+
+	/*
+	 * first we must compute how much space to allocate for
+	 * randr library's use; we'll allocate the structures in a single
+	 * allocation, on cleanlyness grounds.
+	 */
+
+	rbytes = nmon * sizeof (XRRMonitorInfo) + noutput * sizeof(RROutput);
+
+	buf = buf_head = Xmalloc (nbytesRead);
+	mon = Xmalloc (rbytes);
+
+	if (buf == NULL || mon == NULL) {
+	    if (buf != NULL) Xfree(buf);
+	    if (mon != NULL) Xfree(mon);
+	    _XEatDataWords (dpy, rep.length);
+	    UnlockDisplay (dpy);
+	    SyncHandle ();
+	    return NULL;
+	}
+
+	_XReadPad(dpy, buf, nbytesRead);
+
+	output = (RROutput *) (mon + nmon);
+
+	for (m = 0; m < nmon; m++) {
+	    xmon = (xRRMonitorInfo *) buf;
+	    mon[m].name = xmon->name;
+	    mon[m].primary = xmon->primary;
+	    mon[m].automatic = xmon->automatic;
+	    mon[m].noutput = xmon->noutput;
+	    mon[m].x = xmon->x;
+	    mon[m].y = xmon->y;
+	    mon[m].width = xmon->width;
+	    mon[m].height = xmon->height;
+	    mon[m].mwidth = xmon->widthInMillimeters;
+	    mon[m].mheight = xmon->heightInMillimeters;
+	    mon[m].outputs = output;
+	    buf += SIZEOF (xRRMonitorInfo);
+	    xoutput = (CARD32 *) buf;
+	    for (o = 0; o < xmon->noutput; o++)
+		output[o] = xoutput[o];
+	    output += xmon->noutput;
+	    buf += xmon->noutput * 4;
+	}
+	Xfree(buf_head);
+    }
+
+    /*
+     * Skip any extra data
+     */
+    if (nbytes > nbytesRead)
+	_XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    *nmonitors = nmon;
+    return mon;
+}
+
+void
+XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor)
+{
+    XExtDisplayInfo	    *info = XRRFindDisplay(dpy);
+    xRRSetMonitorReq	    *req;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRSetMonitor, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRSetMonitor;
+    req->length += monitor->noutput;
+    req->window = window;
+    req->monitor.name = monitor->name;
+    req->monitor.primary = monitor->primary;
+    req->monitor.automatic = False;
+    req->monitor.noutput = monitor->noutput;
+    req->monitor.x = monitor->x;
+    req->monitor.y = monitor->y;
+    req->monitor.width = monitor->width;
+    req->monitor.height = monitor->height;
+    req->monitor.widthInMillimeters = monitor->mwidth;
+    req->monitor.heightInMillimeters = monitor->mheight;
+    Data32 (dpy, monitor->outputs, monitor->noutput * 4);
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+void
+XRRDeleteMonitor(Display *dpy, Window window, Atom name)
+{
+    XExtDisplayInfo	    *info = XRRFindDisplay(dpy);
+    xRRDeleteMonitorReq	    *req;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRDeleteMonitor, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRDeleteMonitor;
+    req->window = window;
+    req->name = name;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+XRRMonitorInfo *
+XRRAllocateMonitor(Display *dpy, int noutput)
+{
+    XRRMonitorInfo *monitor = calloc(1, sizeof (XRRMonitorInfo) + noutput * sizeof (RROutput));
+    if (!monitor)
+	return NULL;
+    monitor->outputs = (RROutput *) (monitor + 1);
+    monitor->noutput = noutput;
+    return monitor;
+}
+
+void
+XRRFreeMonitors(XRRMonitorInfo *monitors)
+{
+    if (monitors)
+	Xfree(monitors);
+}
+

commit 7402eaa0185110a60cf4aae32d7b470c1372b45b
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Dec 16 17:05:18 2014 -0800

    libXrandr: Clean up compiler warnings
    
    This removes warnings about shadowing local variables with the same
    name, and type mismatches with _XRead32.
    
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/src/Xrandr.c b/src/Xrandr.c
index a9fba87..fd247e0 100644
--- a/src/Xrandr.c
+++ b/src/Xrandr.c
@@ -219,62 +219,62 @@ static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire)
 	awire->subCode = aevent->subtype;
 	switch (aevent->subtype) {
 	case RRNotify_OutputChange: {
-	    xRROutputChangeNotifyEvent *awire = (xRROutputChangeNotifyEvent *) wire;
-	    XRROutputChangeNotifyEvent *aevent = (XRROutputChangeNotifyEvent *) event;
-	    awire->window = aevent->window;
-	    awire->output = aevent->output;
-	    awire->crtc = aevent->crtc;
-	    awire->mode = aevent->mode;
-	    awire->rotation = aevent->rotation;
-	    awire->connection = aevent->connection;
-	    awire->subpixelOrder = aevent->subpixel_order;
+	    xRROutputChangeNotifyEvent *sawire = (xRROutputChangeNotifyEvent *) wire;
+	    XRROutputChangeNotifyEvent *saevent = (XRROutputChangeNotifyEvent *) event;
+	    sawire->window = saevent->window;
+	    sawire->output = saevent->output;
+	    sawire->crtc = saevent->crtc;
+	    sawire->mode = saevent->mode;
+	    sawire->rotation = saevent->rotation;
+	    sawire->connection = saevent->connection;
+	    sawire->subpixelOrder = saevent->subpixel_order;
 	    return True;
 	}
 	case RRNotify_CrtcChange: {
-	    xRRCrtcChangeNotifyEvent *awire = (xRRCrtcChangeNotifyEvent *) wire;
-	    XRRCrtcChangeNotifyEvent *aevent = (XRRCrtcChangeNotifyEvent *) event;
-	    awire->window = aevent->window;
-	    awire->crtc = aevent->crtc;
-	    awire->mode = aevent->mode;
-	    awire->rotation = aevent->rotation;
-	    awire->x = aevent->x;
-	    awire->y = aevent->y;
-	    awire->width = aevent->width;
-	    awire->height = aevent->height;
+	    xRRCrtcChangeNotifyEvent *sawire = (xRRCrtcChangeNotifyEvent *) wire;
+	    XRRCrtcChangeNotifyEvent *saevent = (XRRCrtcChangeNotifyEvent *) event;
+	    sawire->window = saevent->window;
+	    sawire->crtc = saevent->crtc;
+	    sawire->mode = saevent->mode;
+	    sawire->rotation = saevent->rotation;
+	    sawire->x = saevent->x;
+	    sawire->y = saevent->y;
+	    sawire->width = saevent->width;
+	    sawire->height = saevent->height;
 	    return True;
 	}
 	case RRNotify_OutputProperty: {
-	    xRROutputPropertyNotifyEvent *awire = (xRROutputPropertyNotifyEvent *) wire;
-	    XRROutputPropertyNotifyEvent *aevent = (XRROutputPropertyNotifyEvent *) event;
-	    awire->window = aevent->window;
-	    awire->output = aevent->output;
-	    awire->atom = aevent->property;
-	    awire->timestamp = aevent->timestamp;
-	    awire->state = aevent->state;
+	    xRROutputPropertyNotifyEvent *sawire = (xRROutputPropertyNotifyEvent *) wire;
+	    XRROutputPropertyNotifyEvent *saevent = (XRROutputPropertyNotifyEvent *) event;
+	    sawire->window = saevent->window;
+	    sawire->output = saevent->output;
+	    sawire->atom = saevent->property;
+	    sawire->timestamp = saevent->timestamp;
+	    sawire->state = saevent->state;
 	    return True;
 	}
 	case RRNotify_ProviderChange: {
-	    xRRProviderChangeNotifyEvent *awire = (xRRProviderChangeNotifyEvent *) wire;
-	    XRRProviderChangeNotifyEvent *aevent = (XRRProviderChangeNotifyEvent *) event;
-	    awire->window = aevent->window;
-	    awire->provider = aevent->provider;
+	    xRRProviderChangeNotifyEvent *sawire = (xRRProviderChangeNotifyEvent *) wire;
+	    XRRProviderChangeNotifyEvent *saevent = (XRRProviderChangeNotifyEvent *) event;
+	    sawire->window = saevent->window;
+	    sawire->provider = saevent->provider;
 	    return True;
 	}
 	case RRNotify_ProviderProperty: {
-	    xRRProviderPropertyNotifyEvent *awire = (xRRProviderPropertyNotifyEvent *) wire;
-	    XRRProviderPropertyNotifyEvent *aevent = (XRRProviderPropertyNotifyEvent *) event;
-	    awire->window = aevent->window;
-	    awire->provider = aevent->provider;
-	    awire->atom = aevent->property;
-	    awire->timestamp = aevent->timestamp;
-	    awire->state = aevent->state;
+	    xRRProviderPropertyNotifyEvent *sawire = (xRRProviderPropertyNotifyEvent *) wire;
+	    XRRProviderPropertyNotifyEvent *saevent = (XRRProviderPropertyNotifyEvent *) event;
+	    sawire->window = saevent->window;
+	    sawire->provider = saevent->provider;
+	    sawire->atom = saevent->property;
+	    sawire->timestamp = saevent->timestamp;
+	    sawire->state = saevent->state;
 	    return True;
 	}
 	case RRNotify_ResourceChange: {
-	    xRRResourceChangeNotifyEvent *awire = (xRRResourceChangeNotifyEvent *) wire;
-	    XRRResourceChangeNotifyEvent *aevent = (XRRResourceChangeNotifyEvent *) event;
-	    awire->window = aevent->window;
-	    awire->timestamp = aevent->timestamp;
+	    xRRResourceChangeNotifyEvent *sawire = (xRRResourceChangeNotifyEvent *) wire;
+	    XRRResourceChangeNotifyEvent *saevent = (XRRResourceChangeNotifyEvent *) event;
+	    sawire->window = saevent->window;
+	    sawire->timestamp = saevent->timestamp;
 	    return True;
 	}
 	}
diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c
index a704a52..5ae35c5 100644
--- a/src/XrrCrtc.c
+++ b/src/XrrCrtc.c
@@ -93,8 +93,8 @@ XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
     xci->npossible = rep.nPossibleOutput;
     xci->possible = (RROutput *) (xci->outputs + rep.nOutput);
 
-    _XRead32 (dpy, xci->outputs, rep.nOutput << 2);
-    _XRead32 (dpy, xci->possible, rep.nPossibleOutput << 2);
+    _XRead32 (dpy, (long *) xci->outputs, rep.nOutput << 2);
+    _XRead32 (dpy, (long *) xci->possible, rep.nPossibleOutput << 2);
 
     /*
      * Skip any extra data
diff --git a/src/XrrOutput.c b/src/XrrOutput.c
index 4df894e..85f0b6e 100644
--- a/src/XrrOutput.c
+++ b/src/XrrOutput.c
@@ -102,9 +102,9 @@ XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output)
     xoi->clones = (RROutput *) (xoi->modes + rep.nModes);
     xoi->name = (char *) (xoi->clones + rep.nClones);
 
-    _XRead32 (dpy, xoi->crtcs, rep.nCrtcs << 2);
-    _XRead32 (dpy, xoi->modes, rep.nModes << 2);
-    _XRead32 (dpy, xoi->clones, rep.nClones << 2);
+    _XRead32 (dpy, (long *) xoi->crtcs, rep.nCrtcs << 2);
+    _XRead32 (dpy, (long *) xoi->modes, rep.nModes << 2);
+    _XRead32 (dpy, (long *) xoi->clones, rep.nClones << 2);
 
     /*
      * Read name and '\0' terminate
diff --git a/src/XrrProperty.c b/src/XrrProperty.c
index 2096c56..502e834 100644
--- a/src/XrrProperty.c
+++ b/src/XrrProperty.c
@@ -70,7 +70,7 @@ XRRListOutputProperties (Display *dpy, RROutput output, int *nprop)
 	    return NULL;
 	}
 
-	_XRead32 (dpy, props, nbytes);
+	_XRead32 (dpy, (long *) props, nbytes);
     }
 
     *nprop = rep.nAtoms;
diff --git a/src/XrrProvider.c b/src/XrrProvider.c
index 014ddd9..9e620c7 100644
--- a/src/XrrProvider.c
+++ b/src/XrrProvider.c
@@ -77,7 +77,7 @@ XRRGetProviderResources(Display *dpy, Window window)
     xrpr->nproviders = rep.nProviders;
     xrpr->providers = (RRProvider *)(xrpr + 1);
 
-    _XRead32(dpy, xrpr->providers, rep.nProviders << 2);
+    _XRead32(dpy, (long *) xrpr->providers, rep.nProviders << 2);
 
     if (nbytes > nbytesRead)
       _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
@@ -152,10 +152,10 @@ XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provi
     xpi->associated_capability = (unsigned int *)(xpi->associated_providers + rep.nAssociatedProviders);
     xpi->name = (char *)(xpi->associated_capability + rep.nAssociatedProviders);
 
-    _XRead32(dpy, xpi->crtcs, rep.nCrtcs << 2);
-    _XRead32(dpy, xpi->outputs, rep.nOutputs << 2);
+    _XRead32(dpy, (long *) xpi->crtcs, rep.nCrtcs << 2);
+    _XRead32(dpy, (long *) xpi->outputs, rep.nOutputs << 2);
 
-    _XRead32(dpy, xpi->associated_providers, rep.nAssociatedProviders << 2);
+    _XRead32(dpy, (long *) xpi->associated_providers, rep.nAssociatedProviders << 2);
 
     /*
      * _XRead32 reads a series of 32-bit values from the protocol and writes
diff --git a/src/XrrProviderProperty.c b/src/XrrProviderProperty.c
index 34cc082..241e8ee 100644
--- a/src/XrrProviderProperty.c
+++ b/src/XrrProviderProperty.c
@@ -70,7 +70,7 @@ XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop)
 	    return NULL;
 	}
 
-	_XRead32 (dpy, props, nbytes);
+	_XRead32 (dpy, (long *) props, nbytes);
     }
 
     *nprop = rep.nAtoms;
diff --git a/src/XrrScreen.c b/src/XrrScreen.c
index 08710b6..f29071c 100644
--- a/src/XrrScreen.c
+++ b/src/XrrScreen.c
@@ -145,8 +145,8 @@ doGetScreenResources (Display *dpy, Window window, int poll)
     xrsr->modes = (XRRModeInfo *) (xrsr->outputs + rep.nOutputs);
     names = (char *) (xrsr->modes + rep.nModes);
 
-    _XRead32 (dpy, xrsr->crtcs, rep.nCrtcs << 2);
-    _XRead32 (dpy, xrsr->outputs, rep.nOutputs << 2);
+    _XRead32 (dpy, (long *) xrsr->crtcs, rep.nCrtcs << 2);
+    _XRead32 (dpy, (long *) xrsr->outputs, rep.nOutputs << 2);
 
     for (i = 0; i < rep.nModes; i++)  {
 	xRRModeInfo modeInfo;

commit bc00b4fb0b52ed2f6f8544fa3b5da9693ee7ed90
Author: Michael Joost <mehl@michael-joost.de>
Date:   Mon Nov 18 16:11:26 2013 +0100

    Remove fallback for _XEatDataWords, require libX11 1.6 for it
    
    _XEatDataWords was orignally introduced with the May 2013 security
    patches, and in order to ease the process of delivering those,
    fallback versions of _XEatDataWords were included in the X extension
    library patches so they could be applied to older versions that didn't
    have libX11 1.6 yet.   Now that we're past that hurdle, we can drop
    the fallbacks and just require libX11 1.6 for building new versions
    of the extension libraries.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>

diff --git a/configure.ac b/configure.ac
index a4cfbcd..15b1e8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,13 +53,7 @@ RANDR_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
 AC_SUBST(RANDR_VERSION)
 
 # Obtain compiler/linker options for depedencies
-PKG_CHECK_MODULES(RANDR, x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto)
-
-# Check for _XEatDataWords function that may be patched into older Xlib release
-SAVE_LIBS="$LIBS"
-LIBS="$RANDR_LIBS"
-AC_CHECK_FUNCS([_XEatDataWords])
-LIBS="$SAVE_LIBS"
+PKG_CHECK_MODULES(RANDR, [x11 >= 1.6] randrproto >= $RANDR_VERSION xext xextproto xrender renderproto)
 
 AC_CONFIG_FILES([Makefile
 		src/Makefile
diff --git a/src/Xrandrint.h b/src/Xrandrint.h
index 1687c29..75facac 100644
--- a/src/Xrandrint.h
+++ b/src/Xrandrint.h
@@ -42,20 +42,6 @@ extern char XRRExtensionName[];
 
 XExtDisplayInfo *XRRFindDisplay (Display *dpy);
 
-#ifndef HAVE__XEATDATAWORDS
-#include <X11/Xmd.h>  /* for LONG64 on 64-bit platforms */
-#include <limits.h>
-
-static inline void _XEatDataWords(Display *dpy, unsigned long n)
-{
-# ifndef LONG64
-    if (n >= (ULONG_MAX >> 2))
-        _XIOError(dpy);
-# endif
-    _XEatData (dpy, n << 2);
-}
-#endif
-
 /* deliberately opaque internal data structure; can be extended,
    but not reordered */
 struct _XRRScreenConfiguration {


Reply to: