--- /dev/null
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include $(PKGROOT)/Include
+
+PKG_NAME = libXrandr
+PKG_VER = 1.3.0
+PKG_REL = 0
+
+PKG_MAINTAINER = Stefan Schantl <stefan.schantl@ipfire.org>
+PKG_GROUP = X/Libraries
+PKG_URL = http://www.x.org/
+PKG_LICENSE = MIT
+PKG_SUMMARY = X11 libXrandr runtime library.
+
+PKG_BUILD_DEPS+= pkg-config xorg-x11-proto-devel
+PKG_DEPS += libX11 libXext libXrender
+
+define PKG_DESCRIPTION
+ X.Org X11 libXrandr runtime library.
+endef
+
+PKG_TARBALL = $(THISAPP).tar.bz2
+
+CONFIGURE_OPTIONS += \
+ --disable-static
--- /dev/null
+diff --git a/configure.ac b/configure.ac
+index a018667..09c5d8d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -32,7 +32,7 @@ dnl protocol, so Xrandr version l.n.m corresponds to protocol version l.n
+ dnl
+ AC_INIT(libXrandr, 1.3.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXrandr)
+ AC_CONFIG_AUX_DIR(.)
+-AM_INIT_AUTOMAKE([dist-bzip2])
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+ # Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+diff --git a/include/X11/extensions/Xrandr.h b/include/X11/extensions/Xrandr.h
+index a411321..6b756a7 100644
+--- a/include/X11/extensions/Xrandr.h
++++ b/include/X11/extensions/Xrandr.h
+@@ -197,6 +197,7 @@ Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);
+
+ /* Version 1.2 additions */
+
++/* despite returning a Status, this returns 1 for success */
+ Status
+ XRRGetScreenSizeRange (Display *dpy, Window window,
+ int *minWidth, int *minHeight,
+diff --git a/src/XrrConfig.c b/src/XrrConfig.c
+index db7a1ae..34ff3ef 100644
+--- a/src/XrrConfig.c
++++ b/src/XrrConfig.c
+@@ -409,6 +409,7 @@ Status XRRSetScreenConfigAndRate (Display *dpy,
+
+ (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
+
++ /* actually .errorCode in struct xError */
+ if (rep.status == RRSetConfigSuccess) {
+ /* if we succeed, set our view of reality to what we set it to */
+ config->config_timestamp = rep.newConfigTimestamp;
+diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c
+index db9d0b4..697987a 100644
+--- a/src/XrrCrtc.c
++++ b/src/XrrCrtc.c
+@@ -167,7 +167,7 @@ XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc)
+ req->crtc = crtc;
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+- rep.status = RRSetConfigFailed;
++ rep.size = 0;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return rep.size;
+@@ -179,7 +179,7 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
+ XExtDisplayInfo *info = XRRFindDisplay(dpy);
+ xRRGetCrtcGammaReply rep;
+ xRRGetCrtcGammaReq *req;
+- XRRCrtcGamma *crtc_gamma;
++ XRRCrtcGamma *crtc_gamma = NULL;
+ long nbytes;
+ long nbytesRead;
+
+@@ -192,7 +192,7 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
+ req->crtc = crtc;
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+- rep.status = RRSetConfigFailed;
++ goto out;
+
+ nbytes = (long) rep.length << 2;
+
+@@ -204,9 +204,7 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
+ if (!crtc_gamma)
+ {
+ _XEatData (dpy, (unsigned long) nbytes);
+- UnlockDisplay (dpy);
+- SyncHandle ();
+- return NULL;
++ goto out;
+ }
+ _XRead16 (dpy, crtc_gamma->red, rep.size * 2);
+ _XRead16 (dpy, crtc_gamma->green, rep.size * 2);
+@@ -214,7 +212,8 @@ XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
+
+ if (nbytes > nbytesRead)
+ _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+-
++
++out:
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return crtc_gamma;
+diff --git a/src/XrrProperty.c b/src/XrrProperty.c
+index 9554f9a..1a125b2 100644
+--- a/src/XrrProperty.c
++++ b/src/XrrProperty.c
+@@ -272,7 +272,7 @@ XRRGetOutputProperty (Display *dpy, RROutput output,
+ {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+- return 1;
++ return ((xError *)&rep)->errorCode;
+ }
+
+ *prop = (unsigned char *) NULL;