Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:34 +0000 (00:49 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:34 +0000 (00:49 +0900)
49 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0755]
ChangeLog [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0644]
configure.ac [new file with mode: 0755]
debian/README.source [new file with mode: 0644]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0644]
debian/libxrandr-dev.install [new file with mode: 0755]
debian/libxrandr2.install [new file with mode: 0644]
debian/libxrandr2.symbols [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/watch [new file with mode: 0644]
debian/xsfbs/repack.sh [new file with mode: 0644]
debian/xsfbs/xsfbs.mk [new file with mode: 0644]
debian/xsfbs/xsfbs.sh [new file with mode: 0644]
include/X11/extensions/Xrandr.h [new file with mode: 0755]
man/Makefile.am [new file with mode: 0755]
man/XRRConfigCurrentConfiguration.man [new file with mode: 0755]
man/XRRConfigCurrentRate.man [new file with mode: 0755]
man/XRRConfigRates.man [new file with mode: 0755]
man/XRRConfigRotations.man [new file with mode: 0755]
man/XRRConfigSizes.man [new file with mode: 0755]
man/XRRConfigTimes.man [new file with mode: 0755]
man/XRRFreeScreenConfigInfo.man [new file with mode: 0755]
man/XRRGetScreenInfo.man [new file with mode: 0755]
man/XRRQueryExtension.man [new file with mode: 0755]
man/XRRQueryVersion.man [new file with mode: 0755]
man/XRRRootToScreen.man [new file with mode: 0755]
man/XRRSelectInput.man [new file with mode: 0755]
man/XRRSetScreenConfig.man [new file with mode: 0755]
man/XRRSetScreenConfigAndRate.man [new file with mode: 0755]
man/Xrandr.man [new file with mode: 0755]
packaging/libXrandr.spec [new file with mode: 0644]
src/Makefile.am [new file with mode: 0755]
src/Xrandr.c [new file with mode: 0644]
src/Xrandrint.h [new file with mode: 0755]
src/XrrConfig.c [new file with mode: 0755]
src/XrrCrtc.c [new file with mode: 0755]
src/XrrMode.c [new file with mode: 0644]
src/XrrOutput.c [new file with mode: 0644]
src/XrrProperty.c [new file with mode: 0755]
src/XrrScreen.c [new file with mode: 0644]
xrandr.pc.in [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..3fbe686
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Jim Gettys, Compaq and Hewlett-Packard, and Keith Packard, 
+       SuSE and Hewlett-Packard
diff --git a/COPYING b/COPYING
new file mode 100755 (executable)
index 0000000..1552c1f
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,64 @@
+Copyright © 2000, Compaq Computer Corporation, 
+Copyright © 2002, Hewlett Packard, Inc.
+
+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 Compaq or HP not be used in advertising
+or publicity pertaining to distribution of the software without specific,
+written prior permission.  HP makes no representations about the
+suitability of this software for any purpose.  It is provided "as is"
+without express or implied warranty.
+
+HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
+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.
+
+Copyright © 2000 Compaq Computer Corporation, Inc.
+Copyright © 2002 Hewlett-Packard Company, Inc.
+Copyright © 2006 Intel Corporation
+Copyright © 2008 Red Hat, Inc.
+
+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.
+
+Copyright © 2000 Compaq Computer Corporation, Inc.
+Copyright © 2002 Hewlett Packard Company, Inc.
+Copyright © 2006 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.
diff --git a/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..5545274
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,1004 @@
+commit b7e31c69d345d3cba359d7648c304cff43ff7437
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Oct 28 12:34:26 2010 -0700
+
+    libXrandr 1.3.1
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit f490ed44a1c85c75183d87d034b94f9973b88abd
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Oct 28 12:30:27 2010 -0700
+
+    Fix configure.ac comment for RandR instead of Render
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 95cf69bd452db86b6aefe3837e1f7010ebf21e80
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Oct 28 12:27:30 2010 -0700
+
+    Sun's copyrights now belong to Oracle
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 12f22e0ae0cbd748b416c7e2486f289f89c5c77c
+Author: Jesse Adkins <jesserayadkins@gmail.com>
+Date:   Tue Sep 28 13:30:03 2010 -0700
+
+    Purge cvs tags.
+    
+    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 247ad2a3865ba503e6c77444f855c71e7a210f13
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Aug 17 07:57:08 2010 -0400
+
+    man: store shadow man pages in git rather than generating them
+    
+    Simplify the build process and the makefile.
+    
+    Local fix in CVS for bug 5628 is not required
+    as the problem has been fixed in
+    util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 8f23ad4703c7fcfdd7d53d52ddebb7590c3cb265
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Jul 8 14:40:39 2010 -0700
+
+    Use make rules instead of shell for loops to generate shadow man pages
+    
+    Allows parallel make and simpler build logs/error reporting
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 82bc24d6137cc4f03944af88e69c4d67b26d3cc9
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Jul 8 14:34:18 2010 -0700
+
+    config: upgrade to util-macros 1.8 for additional man page support
+    
+    Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
+    The value of MAN_SUBST is the same for all X.Org packages.
+    
+    Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS
+    The existing statement can now be removed from the configuration file.
+    
+    Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED)
+    Enables silent rule and use platform appropriate version of sed.
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 2e5c60f477fc68634f1fa31a2fc4a166642ab318
+Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
+Date:   Thu Jul 1 07:01:47 2010 -0300
+
+    Purge macros NEED_EVENTS and NEED_REPLIES
+    
+    Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+    Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 18517a55d08cdcf9e29bed6761cf4311e1d4109f
+Author: Leif Middelschulte <leif.middelschulte@gmail.com>
+Date:   Tue May 25 14:52:50 2010 -0300
+
+    Add parameter safety check
+    
+    As mentioned in bugzilla ticket 28150.
+    Calling '_XRRValidateCache' with 'improper' arguments results in a SEGV.
+    This patch adds a parameter validation to the mentioned function.
+    
+    Signed-off-by: Leif Middelschulte <leif.middelschulte@gmail.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7a7bac907ac15033c0ddb979202c7f3ddc368726
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 16:50:34 2010 -0400
+
+    config: update AC_PREREQ statement to 2.60
+    
+    Unrelated to the previous patches, the new value simply reflects
+    the reality that the minimum level for autoconf to configure
+    all x.org modules is 2.60 dated June 2006.
+    
+    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 883acff30b23c2bdf446988ff7b780cd61e49a5e
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:49 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 74bb9072015b8a785f6b6458ba0605287a1ffcaf
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Feb 16 10:37:21 2010 -0500
+
+    config: move CWARNFLAGS from configure.ac to Makefile.am
+    
+    Compiler warning flags should be explicitly set in the makefile
+    rather than being merged with other packages compiler flags.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 449d22180549d990ad3164c98b22968359b55df2
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Jan 14 09:41:26 2010 -0500
+
+    COPYING: add missing copyright notices
+    
+    Refer to: Xrandr.h XrrConfig.c
+    Copyright © 2006 Intel Corporation
+    Copyright © 2008 Red Hat, Inc.
+    Copyright © 2006 Keith Packard
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 51887f07a7722576933ddcc00c5380266d6fa37c
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 14 21:02:20 2010 -0800
+
+    Update Sun license notices to current X.Org standard form
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit cd6fcaeaf0da7ca66ec0ab63ce282def37c21c3b
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Nov 27 20:56:04 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit 61c4a57286b601ff266a15565740aea31e68d1bb
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Oct 28 14:09:10 2009 -0400
+
+    INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+    
+    Add missing INSTALL file. Use standard GNU file on building tarball
+    README may have been updated
+    Remove AUTHORS file as it is empty and no content available yet.
+    Remove NEWS file as it is empty and no content available yet.
+
+commit 170a3efb274d473165a8d6085c185792b1c43005
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:25 2009 -0400
+
+    Deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 8567a45cb36857a8b5e2699a3d3ed7850b053281
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Oct 26 22:08:43 2009 -0400
+
+    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+    
+    ChangeLog filename is known to Automake and requires no further
+    coding in the makefile.
+
+commit 015687dbec93d954fb18981bc6e15937a206a4b7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Oct 22 12:34:19 2009 -0400
+
+    .gitignore: use common defaults with custom section # 24239
+    
+    Using common defaults will reduce errors and maintenance.
+    Only the very small or inexistent custom section need periodic maintenance
+    when the structure of the component changes. Do not edit defaults.
+
+commit 2e07e9d4f300e8153e4e93cd78bc51e0d91dba6f
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Nov 9 17:51:03 2009 -0500
+
+    GetCrtcGamma: Fix error handling.
+    
+    We didn't treat _XReply failure as fatal.  Parsing an xError as a gamma
+    ramp reply doesn't work that often.
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+    Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit 7b41b589213293793182b61f20006229a89d5ba7
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Nov 9 17:50:42 2009 -0500
+
+    GetCrtcGammaSize: Return 0, not garbage, on failure
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+    Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit 5e94f071f45ca504ccafe083e2e289351ba6eab4
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Nov 9 17:49:40 2009 -0500
+
+    GetScreenSizeRange: Document funky return code in the header
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+    Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit f98cbea8b33356a0de1f777c3a862ecbf163cfd3
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Nov 9 17:49:10 2009 -0500
+
+    SetScreenConfigAndRate: Document error handling better
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+    Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit a8af918c0db758a667345b7c3055075124197f6c
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Nov 9 17:48:22 2009 -0500
+
+    GetOutputProperty: Return the error code, not BadRequest
+    
+    Signed-off-by: Adam Jackson <ajax@redhat.com>
+    Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit 7f463b2a2221065c03b6122c0cffd2fa5cb13427
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Wed Oct 21 12:47:26 2009 -0700
+
+    This is not a GNU project, so declare it foreign.
+    
+    On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+    > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+    > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+    > > was quite annoying to work around since 'autoreconf -fvi' replaces
+    > > it and git wants to commit it.  Should these files even be in git?
+    > > Can I nuke them for the betterment of humanity and since they get
+    > > created by autoreconf anyways?
+    >
+    > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+    
+    As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+    AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+    of the INSTALL file. It is also part of the 24206 solution.
+    
+    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit e3036766916d55d0c8ae72d5752fd1699ae7390d
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Fri Mar 6 15:13:56 2009 +0100
+
+    Bump to 1.3.0
+
+commit 6bf8648e7e408be7a869fd4c4527a4fd73fc687d
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:36 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 70d641c6d170cda44856579dfdcb42d3bb1f8221
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Jan 30 20:12:43 2009 -0800
+
+    Send X_RRGetOutputPrimary when making an X_RRGetOutputPrimary request
+    
+    Using X_RRGetOutputProperty does not yield success here.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit bf284b043d4c5688da2207647126b095f8c2b0cd
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Fri Jan 30 16:38:03 2009 -0200
+
+    Janitor: make distcheck, compiler warnings, .gitignore
+    
+      Warning corrections are either unused symbols or using an
+    integer as a pointer (generated by sparse).
+
+commit a0c45b798d2fa810167d64a92093840178f993b1
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Sun Dec 21 16:32:17 2008 +0100
+
+    Fix thinkos
+    
+    * XRRExtensionInfo can be static
+    * XRRExtensionName is not called XrandrExtensionName
+
+commit 8574ffb20fa10b6f2e9a5f115f23506b93c64b12
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Dec 17 11:33:37 2008 -0500
+
+    libXrandr 1.2.99.4
+
+commit e2f075ea3927f83fb7ee8b359ef951222e8f894b
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Dec 17 11:29:05 2008 -0500
+
+    Define _XRRHasRates internally.
+
+commit 53bd07438d3671dca86df2bf3052f89ee8ce0891
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Dec 17 11:27:19 2008 -0500
+
+    Be sure to return NULL when returning no properties.
+
+commit 7c1ccb19bd2545ccdf7099489e946e772a25649f
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Dec 17 11:25:20 2008 -0500
+
+    Use RRCheckExtension in function returning a value.
+
+commit 2db939e82c29fa3ab868bac9d2b54de18419004b
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Dec 17 11:24:33 2008 -0500
+
+    Fix type of GetReq() argument.
+
+commit c79e2aecab080d8f47b258ae3c4dd9394280ae2a
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Dec 17 11:23:51 2008 -0500
+
+    Use RRSimpleCheckExtension in functions returning void
+
+commit dda80ea67e33d18f7cc869c6f828c444c8966704
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Fri Dec 12 13:04:57 2008 +0100
+
+    Bump to 1.2.99.3
+
+commit 59c8812099f33d56b43044f999ffe5df16adf5ff
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Dec 8 15:37:53 2008 -0500
+
+    Add [GS]etOutputPrimary
+
+commit 0f11922bdc0d4e3929df4dc967379ea0b48338b8
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Thu Dec 4 18:24:42 2008 +0100
+
+    Bump to 1.2.99.2.
+    
+    Note the .99
+
+commit e788c1ed41e029e54470a2c79f1478c1be7bba92
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Thu Dec 4 15:51:07 2008 +0100
+
+    Nuke config-timestamp for panning.
+
+commit 1de7212d9a945403f13f4dc15a66ec115c3be44c
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Fri Nov 28 17:26:43 2008 +0100
+
+    Panning support
+
+commit 0dd24bd6ad3c437f320c5d8e922c479fb61b115f
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Mon Dec 1 21:19:35 2008 +0100
+
+    Bump to 1.2.91
+
+commit 0fa7452220701ee44d8bafc57001e362afcedb0c
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Mon Dec 1 21:09:44 2008 +0100
+
+    RRNotify subevents have 'window' at different offsets, the sequel
+    
+    f176b2bda103f6f38aabab8207f47a02cc797659 fixed XRRWireToEvent, but
+    XRREventToWire had the same bug.
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+
+commit 83e567f427f68dc4ae2de796a1184748bbe0238e
+Merge: 908de8f 00f2e30
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Mon Dec 1 20:59:39 2008 +0100
+
+    Merge branch 'transform-proposal' of git.freedesktop.org:/git/xorg/lib/libXrandr
+    
+    Conflicts:
+    
+       src/Xrandr.c
+
+commit 00f2e30d0b8296668776d62a4c47f96bf95faa08
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Fri Nov 28 16:16:22 2008 +0100
+
+    Set attr->pendingNparams in XRRGetCrtcTransform()
+
+commit 908de8fc7228ecc7b02825ebede5fb937f3abf1b
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Mon Nov 24 16:11:46 2008 -0500
+
+    Add GetScreenResourcesCurrent
+
+commit 377126fdaf1094354d54b1743f9d2bf1f2de1e0c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Sep 12 20:18:21 2008 -0700
+
+    Set NparamsFilter in XRRGetCrtcTransform return value.
+    
+    Leaving this uninitialized isn't very helpful, and can cause segfaults.
+
+commit f176b2bda103f6f38aabab8207f47a02cc797659
+Author: Tomas Carnecky <tom@dbservice.com>
+Date:   Wed Aug 13 10:24:11 2008 -0400
+
+    RRNotify subevents have 'window' at different offsets.
+
+commit d631e453d62104b4a4afdcf0b34e6f3aefd62644
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Aug 13 10:21:51 2008 -0400
+
+    Remove RCS tags.
+
+commit bf476779616b24c6456339bc77896460f1a2545a
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Wed Jul 2 15:28:08 2008 -0400
+
+    libXrandr 1.2.3
+
+commit 203fc002b6948c3942f0461a0346dd07b633222d
+Author: thb <thb@openoffice.org>
+Date:   Mon Jun 23 13:25:12 2008 -0400
+
+    Bug #16430: Ignore ConfigureNotify on non-root windows in UpdateConfiguration
+
+commit 332eee90c4d00be3b11049e0261323abe89a96dc
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon May 19 17:34:36 2008 +0930
+
+    Rename parameters to clarify QueryVersion/QueryExtension.
+    
+    These parameters are not treated as input. Rename them to make the inner
+    workings slightly more obvious.
+    
+    X.Org Bug 14511 <http://bugs.freedesktop.org/show_bug.cgi?id=14511>
+
+commit 824f3d4a3a4669526a5c391c6668df0384b49cdb
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Feb 5 15:37:32 2008 +0100
+
+    Bug #14388: Remove XRRScreenConfig() and XRRConfig() from Xrandr.h.
+    
+    It seems that they were never actually implemented.
+    Also remove the corresponding manpage symlinks.
+
+commit 7a21e7bc994c5fa7d3ab15ba7201667e134f1512
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Mar 18 16:02:36 2008 -0700
+
+    Eliminate inverse matrix from randr transform protocol
+    
+    It is easier, and potentially more precise, to compute the inverse in the
+    server where everything can eventually be kept in floating point form.
+
+commit a6e5fa4ceb72795380496fcfe62c083866791dc1
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Mar 15 00:33:30 2008 -0700
+
+    Support CRTC Transform filters
+    
+    XRRGetCrtcTransform now returns a giant struct containing all of the
+    transform and filter data.
+    
+    XRRSetCrtcTransform now accepts filter parameters.
+
+commit 2a5fb0e58ed6ee1ff1f0ff00b5bf5b2623991132
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Mar 4 08:17:48 2008 -0800
+
+    Add support for new Transform requests.
+
+commit dc0ce2e363dbdac560fc2a8c1296c5468d75f644
+Author: Matthieu Herrb <matthieu.herrb@laas.fr>
+Date:   Sun Mar 9 08:37:17 2008 +0100
+
+    nuke RCS Ids
+
+commit 23a47035818390ca197179a9a69a54badb370990
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Feb 5 15:35:30 2008 +0100
+
+    Hide some private symbols.
+    
+    XExtensionInfo, XRRExtensionName, XRRFindDisplay, _XRRHasRates and
+    _XRRVersionHandler are internal to libXrandr.  Don't export them.
+
+commit 732ae92882383b33384791c2e9136a54e0fd06f3
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Thu Dec 6 16:38:42 2007 -0500
+
+    Replace static ChangeLog with dist-hook to generate from git log
+
+commit e56fa06624dc240dbe8d3e127cc3b65da580fe6e
+Merge: 27b91d1 0294912
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Sun Nov 11 10:27:35 2007 -0500
+
+    Merge branch 'master' of git://git.freedesktop.org/git/xorg/lib/libXrandr
+
+commit 029491243b43c2e03a62c143ac21941449f335aa
+Author: Eric Anholt <eric@anholt.net>
+Date:   Wed Sep 5 10:01:06 2007 -0700
+
+    Bump version to 1.2.2.
+
+commit 27b91d1d62acb70da7d131ee4b6da265d64cb835
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Mon Sep 3 05:53:48 2007 -0400
+
+    Add *~ to .gitignore to skip patch/emacs droppings
+
+commit 126143add5349fc34488b23d54d1bdcc7e8847b9
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Tue Jul 3 09:58:09 2007 -0700
+
+    CrtcChange event format conversion was using 'height' for 'width'.
+    
+    CrtcChange events were getting the source 'height' value stored in the
+    'width' target in both conversion directions.
+
+commit 3e753542bcf0fd49fe977e56b7ab7e540bbd4282
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Sun Mar 4 20:03:59 2007 -0800
+
+    Set version to 1.2.1 for release.
+
+commit c279b64ccca18b14974e413b0b1d55ac81abceda
+Author: Fredrik Höglund <fredrik@kde.org>
+Date:   Tue Feb 20 22:30:00 2007 +0100
+
+    Fix the use of a C++ keyword as a parameter name in Xrandr.h
+
+commit 75d9944484651d4180e3079a739be4edb36545fe
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Sun Feb 18 20:57:31 2007 -0800
+
+    Reset version from 1.2.0.0 to 1.2.0
+
+commit ac82ee50f3938b7b4d6dbcec850d38500258bfe0
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Thu Feb 15 16:56:11 2007 -0800
+
+    Must pass size information in SetCrtcGamma request.
+
+commit 9c4fea702a0382689898fc14cbdab456fb18c403
+Merge: c85237a 382b7a3
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Wed Jan 31 14:24:57 2007 -0800
+
+    Merge 64-bit fixes in
+
+commit c85237a1651ae8e1abe9ae442ffa04dcb20c1d3e
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Wed Jan 31 14:20:33 2007 -0800
+
+    Fix read sizes for 64-bit machines.
+    
+    Be consistent in variable usage:
+       nbytes = network byte length.
+       rbytes = memory byte length.
+       nbytesRead = actual network bytes read.
+    Malloc rbytes data to pass to _XRead*, but use nbytes as the
+    amount of data to read (yes, this is insane, welcome to Xlib).
+    Some of this patch is semi-gratuitous, but the goal is to be consistent
+    everywhere.
+
+commit 382b7a3cfabdd37a6231e18a2ac92bc8a3722b79
+Author: Eric Anholt <eric@anholt.net>
+Date:   Tue Jan 16 13:10:49 2007 -0800
+
+    Return a valid property info even if we lack valid value sets.
+    
+    Previously, XRRQueryOutputProperty90 would return an uninitialized pointer if
+    num_values was 0.
+
+commit 36a4a633a93a89bd854f49e670777925c9751de3
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Sat Jan 6 12:42:47 2007 -0800
+
+    Avoid nested LockDisplay calls.
+    
+    XRRFindDisplay must make extension requests that use LockDisplay, so don't
+    call it with the display locked, instead pass the info around to the
+    internal functions that were calling it themselves, having acquired the info
+    before the outer LockDisplay is called.
+
+commit d70a3e7f111cb65c37edfa78ca66449338d3bb8f
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Sat Dec 30 13:11:10 2006 -0800
+
+    Failed to copy rotations from reply to XRRCrtcInfo.
+    
+    XRRGetCrtcInfo was not moving the rotations value from the wire reply
+    structure to the XRRCrtcInfo being returned, leaving the value uninitialized.
+
+commit bc75a92cac23dad4a661a13e6af121f6072cecc8
+Merge: 7fcdcbb 370fa28
+Author: Dave Airlie <airlied@linux.ie>
+Date:   Sat Dec 2 11:27:36 2006 +1100
+
+    Merge branch 'randr-1.2'
+
+commit 370fa28a6afd70ec91411edf1413c0e448ae45b6
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Thu Nov 30 21:56:59 2006 -0800
+
+    Add initial implementation of crtc gamma and mode adding requests.
+    
+    They build. More testing seems indicated.
+
+commit 7fcdcbb0f9c4736bd678be7f9bf76d472293233f
+Merge: 875867f 0dba1be
+Author: Eric Anholt <eric@anholt.net>
+Date:   Mon Nov 27 15:41:03 2006 -0800
+
+    Merge branch 'randr-1.2'
+    
+    Conflicts:
+    
+       configure.ac
+
+commit 0dba1be7969aa56f934d93889cbd589b3dafd3d4
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Mon Nov 20 20:59:18 2006 -0800
+
+    Change properties to have a pending value and report valid values.
+    
+    Pending values are transferred to current values at mode set, allowing a
+    queue of values to accrue in preparation for the modeset operation while
+    still reporting valid 'current' values for applications.
+    
+    The set of valid values is also available so applications can present
+    a reasonable list to the user during configuration.
+
+commit 8edabfeba65562f026111b35ec14a9801b4b6a5c
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Thu Nov 16 13:35:46 2006 -0800
+
+    Remove RandR output options.
+    
+    Options are to be implemented as properties instead.
+
+commit 7ac8dba76fe33b13620e023699bf971fe8c99fb2
+Author: Eric Anholt <eric@anholt.net>
+Date:   Thu Nov 9 20:26:33 2006 -0800
+
+    Return the right actual property type for XRRGetOutputProperty.
+
+commit b49342b58d17267fae81205f1a89263ec4d3d114
+Author: Eric Anholt <eric@anholt.net>
+Date:   Thu Nov 9 17:07:55 2006 -0800
+
+    Add support for various output property requests.
+    
+    These should be reviewed by someone with proto clue, which I'm generally
+    lacking.
+
+commit 6676505b6012c97d2f711a84237fa14a62d1d33d
+Author: Keith Packard <keithp@mandolin.keithp.com>
+Date:   Wed Nov 1 00:25:45 2006 -0800
+
+    Moving physical size from mode to output.
+    
+    Follows protocol change which places physical size
+    information in the output rather than (inappropriately)
+    in each mode line.
+
+commit 875867f275803682e58f0649f054a83293c6e02c
+Author: Adam Jackson <ajax@benzedrine.nwnk.net>
+Date:   Fri Oct 13 17:09:57 2006 -0400
+
+    Bump to 1.1.2
+
+commit 6eacf491a094add48363d530357dce0d25b8f244
+Author: Adam Jackson <ajax@benzedrine.nwnk.net>
+Date:   Fri Oct 13 16:25:00 2006 -0400
+
+    Bump to 1.1.1
+
+commit d914d05d34991b4cfa3af411fd2a3e281ea0e73b
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Thu Oct 12 17:42:48 2006 -0700
+
+    Do not call UnlockDisplay without calling LockDisplay.
+    
+    Thanks to Magnus Kessler <Magnus.Kessler@gmx.net> for reporting this
+    bug and a correct fix.
+
+commit ab4207db14d70384f017cc2a22379d7c358b60e0
+Author: Keith Packard <keithp@neko.keithp.com>
+Date:   Wed Oct 4 20:04:09 2006 -0700
+
+    Remove mode origins. Add preferred mode count.
+
+commit dd0fb435a0168d4041ecd81024d6493295651c61
+Author: Keith Packard <keithp@guitar.keithp.com>
+Date:   Tue Oct 3 21:03:10 2006 -0700
+
+    Add mode origins and output options.
+
+commit cb1dbb7c2446ddf514ee709fba940cc4e75438a0
+Author: Keith Packard <keithp@guitar.keithp.com>
+Date:   Wed Sep 20 20:00:57 2006 -0700
+
+    XRRGetScreenSizeRange returns Status. Lots more requests added.
+    
+    XRRGetCrtcInfo
+    XRRSetCrtcConfig
+    XRRGetScreenSizeRange
+    XRRSetScreenSize
+    
+    properties still to do.
+
+commit c712df73eeb0cb84aad6a0bec2be0f480418c217
+Author: Keith Packard <keithp@guitar.keithp.com>
+Date:   Tue Sep 19 00:42:49 2006 -0700
+
+    Start update to 1.2, splitting code across multiple files.
+
+commit a8abbe92f0486f174fb89ca2c81eabede646bf32
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:59:05 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit 88f4e37d937f171352dc0089a0903c0a3d9487d8
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun Feb 12 18:19:22 2006 +0000
+
+    Bug #5628 <https://bugs.freedesktop.org/show_bug.cgi?id=5628> Shadow pages
+        not created correctly when MANDIR & MANSUFFIX don't match.
+
+commit c6541af3ef1cfaba57a73369090b6ac1a38b9b1e
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:33 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit be2b102d0ce89f4ac2eb2c2aad5b2e3af947abba
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Dec 6 22:48:44 2005 +0000
+
+    Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
+
+commit 8f9937022d259917ea7f1a3fefab58607300756a
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:45 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit 127ec4993118efe56caef761febef86eae2b7300
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 04:41:50 2005 +0000
+
+    Add check and cflags for malloc(0) returning NULL.
+
+commit 89f4aca8d76806edf51d4999223011cbff1c3f55
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Nov 28 22:03:06 2005 +0000
+
+    Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4
+        update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir)
+
+commit bf2fcad15b7bf2c505f5478648bf6ecbc0be701a
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:43 2005 +0000
+
+    Update pkgconfig files to separate library build-time dependencies from
+        application build-time dependencies, and update package deps to work
+        with separate build roots.
+
+commit a27c3d61d107fe4af33181a63f8ea951367ff418
+Author: Kevin E Martin <kem@kem.org>
+Date:   Mon Nov 14 22:02:13 2005 +0000
+
+    Fix pkgconfig deps for separate build roots.
+
+commit 1d690983d20e3d874b7f0e7f430e3d0cf2710c53
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Nov 9 21:19:13 2005 +0000
+
+    Update package version number for X11R7 RC2 release.
+
+commit 090314b101b9d3626dc0dc970be68aec7e382d0f
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Nov 1 15:11:51 2005 +0000
+
+    Update pkgcheck dependencies to work with separate build roots.
+
+commit 2deac5f213ee0a1cedccc721cd015691661b8002
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:11 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit 33d17445401ec09bb0c2305d477b00c3abc2182a
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Oct 18 00:00:09 2005 +0000
+
+    Use @LIB_MAN_SUFFIX@ instead of $(LIB_MAN_SUFFIX) in macro substitutions to
+        work better with BSD make
+
+commit a42c72fe8924e98f0794e37dec8e5ef49fd7423c
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Oct 17 21:13:22 2005 +0000
+
+    Rename .shadows.DONE to shadows.DONE to avoid some make's thinking it's a
+        suffix rule (reported by Matthieu Herrb)
+
+commit 13ec5d5d689bb03e01d8f269d2c7a72e4cf0b5f1
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Thu Oct 13 05:06:10 2005 +0000
+
+    [lib/Xrandr]
+    Use sed to fill in variables in man page Add shadow man pages for man pages
+        that document multiple functions.
+
+commit 544ec9ae021fecc6001df97a6000095f294b7422
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Thu Oct 13 02:56:42 2005 +0000
+
+    Fix troff macros from last commit to not generate cpp warnings
+
+commit f678f6cc9b73960c3ad61cc93fc61acefbe40ef5
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Wed Oct 12 23:45:05 2005 +0000
+
+    Use troff macros to prevent cpp eating C comments & #defines that are
+        supposed to appear in man page output.
+
+commit a42516d3a5aa532ed7c19fa128afd63d159676f8
+Author: Aaron Plattner <aplattner@nvidia.com>
+Date:   Fri Sep 30 04:25:14 2005 +0000
+
+    Bug #2965 <https://bugs.freedesktop.org/show_bug.cgi?id=2965> Patch #2994
+        <https://bugs.freedesktop.org/attachment.cgi?id=2994> Swap the screen
+        dimensions when handling XRRScreenChangeNotify events for 90- and
+        270-degree rotations. This fixes KDE's panel placement for rotated
+        screens.
+
+commit f9c9043f2a6787cdb6ab130f66fd39b29e7f2506
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:52 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit 6fd64a5c552ce5f0559838b2b4ae5a27b40e52f1
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Jul 23 05:27:00 2005 +0000
+
+    Fix distchecks
+
+commit bceba127b9b671e378030b348f36602eb44278af
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Jul 16 07:34:59 2005 +0000
+
+    Set soversion to 2.0.0 with -version-number.
+
+commit 63538e6c68e1697e027e55a5015791de3af7bc8c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 06:48:05 2005 +0000
+
+    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
+
+commit 3f5e389cb5bd5305cc45aca522086d3b92506265
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Jul 2 06:35:03 2005 +0000
+
+    Add appropriate lib*_CFLAGS to Makefile.am's -- fixes build problems
+
+commit 48a3a08206e827a5af88d6a2d8ac62aa3bbbe122
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Fri Jun 10 14:10:29 2005 +0000
+
+    Bug #1976: Fix deadlock when attempting to initialise with threads.
+
+commit 1279a7f95e654bb33c9057e25a291e2a093f2dee
+Author: Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>
+Date:   Thu Jun 9 12:52:44 2005 +0000
+
+    Require renderproto instead of render for pkgconfig
+
+commit 9c36643810a7e837f325970ddd5964bbff4971b6
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed Jun 8 20:22:47 2005 +0000
+
+    - Don't search for non-autoconf'ed X libs in Xrandr
+    - Rename man page Xrandr.3
+
+commit 73b3dff9d12d417716c19a33a95eac5f73e5da13
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed Jun 8 19:19:31 2005 +0000
+
+    Add Xcursor
+    conditionally include config.h
+
+commit 32107cdd57b4796c3f41ac56c9ba683be3d894af
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed Jun 8 17:48:03 2005 +0000
+
+    Check in build system for Xrandr
+
+commit 84264cf7a9ce88850f3bc18428e2c046ff0251ed
+Author: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
+Date:   Sat Dec 4 00:42:48 2004 +0000
+
+    Encoding of numerous files changed to UTF-8
+
+commit a9b18ca5a13816d4ffbbd00d3fc80a048e84e94f
+Author: Egbert Eich <eich@suse.de>
+Date:   Mon May 24 19:06:58 2004 +0000
+
+    Fix build glitches when building modules independently using Imake.
+
+commit 76f134caf8da6a08f0fb3587868efaec401c7e74
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:47 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit 634976e69c2d0cd014ac537acb1e52884c1d89b2
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:25 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit f07005c663731709ec6c5d7f36492ff3ac253845
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:30 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit e61377128a66342b8e39a4c5b7e2acd34f38799f
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:33 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit 696a58bfcb75b56cad6e5994f8c974ac4bb884da
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:44 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 731775dea70f37fd41e4a384d484236e9d0ce4ef
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Thu Dec 4 22:02:57 2003 +0000
+
+    XFree86 4.3.99.901 (RC 1)
+
+commit 35eca17cac066690575683bc1367b1fdaba1f4cc
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:15 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 8a8b419755dd3c815cc70265ed0d44e5f31028cc
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit 52d0891b9e3c51d43fd13d0b2680b7e24b2f2e2d
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    Initial revision
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..860193e
--- /dev/null
@@ -0,0 +1,37 @@
+# 
+#  Copyright © 2003 Keith Packard, Noah Levitt
+# 
+#  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 Keith Packard not be used in
+#  advertising or publicity pertaining to distribution of the software without
+#  specific, written prior permission.  Keith Packard makes no
+#  representations about the suitability of this software for any purpose.  It
+#  is provided "as is" without express or implied warranty.
+# 
+#  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+#  EVENT SHALL KEITH PACKARD 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.
+
+SUBDIRS = src man 
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xrandr.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..b035b8b
--- /dev/null
+++ b/README
@@ -0,0 +1,25 @@
+libXrandr - X Resize, Rotate and Reflection extension library
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/lib/libXrandr
+
+        http://cgit.freedesktop.org/xorg/lib/libXrandr
+
+For patch submission instructions, see:
+
+       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100644 (file)
index 0000000..904cd67
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100755 (executable)
index 0000000..773f4b1
--- /dev/null
@@ -0,0 +1,62 @@
+dnl 
+dnl  Copyright © 2003 Keith Packard, Noah Levitt
+dnl 
+dnl  Permission to use, copy, modify, distribute, and sell this software and its
+dnl  documentation for any purpose is hereby granted without fee, provided that
+dnl  the above copyright notice appear in all copies and that both that
+dnl  copyright notice and this permission notice appear in supporting
+dnl  documentation, and that the name of Keith Packard not be used in
+dnl  advertising or publicity pertaining to distribution of the software without
+dnl  specific, written prior permission.  Keith Packard makes no
+dnl  representations about the suitability of this software for any purpose.  It
+dnl  is provided "as is" without express or implied warranty.
+dnl 
+dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+dnl  PERFORMANCE OF THIS SOFTWARE.
+dnl
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ([2.60])
+
+dnl
+dnl Version should match the current Randr version. XRRQueryVersion
+dnl returns the version from randr.h, NOT the version we set here. But we
+dnl try to keep these the same.  Note that the library has an extra
+dnl digit in the version number to track changes which don't affect the
+dnl protocol, so Xrandr version l.n.m corresponds to protocol version l.n
+dnl
+AC_INIT([libXrandr], [1.3.1],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXrandr])
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.8)
+XORG_DEFAULT_OPTIONS
+AM_CONFIG_HEADER(config.h)
+
+# Check for progs
+AC_PROG_CC
+AC_PROG_LIBTOOL
+                 
+# Check randr configuration, strip extra digits from package version to
+# find the required protocol version
+
+RANDR_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
+AC_SUBST(RANDR_VERSION)
+PKG_CHECK_MODULES(RANDR, x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto)
+
+XORG_CHECK_MALLOC_ZERO
+
+AC_OUTPUT([Makefile
+          src/Makefile
+          man/Makefile
+           xrandr.pc])
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..34ab4bf
--- /dev/null
@@ -0,0 +1,73 @@
+------------------------------------------------------
+Quick Guide To Patching This Package For The Impatient
+------------------------------------------------------
+
+1. Make sure you have quilt installed
+2. Unpack the package as usual with "dpkg-source -x"
+3. Run the "patch" target in debian/rules
+4. Create a new patch with "quilt new" (see quilt(1))
+5. Edit all the files you want to include in the patch with "quilt edit" 
+   (see quilt(1)).
+6. Write the patch with "quilt refresh" (see quilt(1))
+7. Run the "clean" target in debian/rules
+
+Alternatively, instead of using quilt directly, you can drop the patch in to 
+debian/patches and add the name of the patch to debian/patches/series.
+
+------------------------------------
+Guide To The X Strike Force Packages
+------------------------------------
+
+The X Strike Force team maintains X packages in git repositories on
+git.debian.org in the pkg-xorg subdirectory. Most upstream packages
+are actually maintained in git repositories as well, so they often
+just need to be pulled into git.debian.org in a "upstream-*" branch.
+Otherwise, the upstream sources are manually installed in the Debian
+git repository.
+
+The .orig.tar.gz upstream source file could be generated this
+"upstream-*" branch in the Debian git repository but it is actually
+copied from upstream tarballs directly.
+
+Due to X.org being highly modular, packaging all X.org applications
+as their own independent packages would have created too many Debian
+packages. For this reason, some X.org applications have been grouped
+into larger packages: xutils, xutils-dev, x11-apps, x11-session-utils,
+x11-utils, x11-xfs-utils, x11-xkb-utils, x11-xserver-utils.
+Most packages, including the X.org server itself and all libraries
+and drivers are, however maintained independently.
+
+The Debian packaging is added by creating the "debian-*" git branch
+which contains the aforementioned "upstream-*" branch plus the debian/
+repository files.
+When a patch has to be applied to the Debian package, two solutions
+are involved:
+* If the patch is available in one of the upstream branches, it
+  may be git'cherry-picked into the Debian repository. In this
+  case, it appears directly in the .diff.gz.
+* Otherwise, the patch is added to debian/patches/ which is managed
+  with quilt as documented in /usr/share/doc/quilt/README.source.
+
+quilt is actually invoked by the Debian X packaging through a larger
+set of scripts called XSFBS. XSFBS brings some other X specific
+features such as managing dependencies and conflicts due to the video
+and input driver ABIs.
+XSFBS itself is maintained in a separate repository at
+  git://git.debian.org/pkg-xorg/xsfbs.git
+and it is pulled inside the other Debian X repositories when needed.
+
+The XSFBS patching system requires a build dependency on quilt. Also
+a dependency on $(STAMP_DIR)/patch has to be added to debian/rules
+so that the XSFBS patching occurs before the actual build. So the
+very first target of the build (likely the one running autoreconf)
+should depend on $(STAMP_DIR)/patch. It should also not depend on
+anything so that parallel builds are correctly supported (nothing
+should probably run while patching is being done). And finally, the
+clean target should depend on the xsfclean target so that patches
+are unapplied on clean.
+
+When the upstream sources contain some DFSG-nonfree files, they are
+listed in text files in debian/prune/ in the "debian-*" branch of
+the Debian repository. XSFBS' scripts then take care of removing
+these listed files during the build so as to generate a modified
+DFSG-free .orig.tar.gz tarball.
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..21cfb44
--- /dev/null
@@ -0,0 +1,250 @@
+libxrandr (2:1.3.1-1slp2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package 
+  * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxrandr
+  * Tag: libxrandr_1.3.1-1slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Thu, 06 Jan 2011 11:56:53 +0900
+
+libxrandr (2:1.3.0-7slp2) unstable; urgency=low
+
+  * Add --as-needed
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxrandr
+  * Tag: libxrandr_1.3.0-7slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Sat, 20 Nov 2010 15:51:15 +0900
+
+libxrandr (2:1.3.0-6slp2) unstable; urgency=low
+
+  * Update maintainer
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/X11
+  * Tag: libxrandr_1.3.0-6slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 21 Apr 2010 14:00:49 +0900
+
+libxrandr (2:1.3.0-5slp2) unstable; urgency=low
+
+  * modify the package name
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Thu, 25 Mar 2010 17:57:37 +0900
+
+libxrandr (2:1.3.0-4) unstable; urgency=low
+
+  * Install .la files
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Mon, 07 Dec 2009 10:29:07 +0900
+
+libxrandr (2:1.3.0-3) unstable; urgency=low
+
+  * Import Debian Package
+  * Update version not to make version problems in armel and i386
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 02 Dec 2009 19:38:57 +0900
+
+libxrandr (2:1.3.0-3) unstable; urgency=low
+
+  [ Timo Aaltonen ]
+  * Drop pre-dependency on x11-common from libxrandr-dev. This was needed
+    for upgrades from sarge.
+  * Move -dbg package to section debug.
+  * Bump Standards-Version to 3.8.3.
+
+  [ Julien Cristau ]
+  * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
+    good reason.  Thanks, Colin Watson!
+  * Remove myself from Uploaders
+
+  [ Brice Goglin ]
+  * Remove Jamey Sharp and Josh Triplett from Uploaders, closes: #568282.
+
+ -- Brice Goglin <bgoglin@debian.org>  Sun, 07 Feb 2010 11:54:09 +0100
+
+libxrandr (2:1.3.0-2) unstable; urgency=low
+
+  * libxrandr-dev depends on randrproto 1.3 (closes: #519981).  Thanks, Adrian
+    Bunk!
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 16 Mar 2009 20:23:40 +0100
+
+libxrandr (2:1.3.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Bump randrproto build-dep to 1.3.
+  * Bump shlibs.
+  * Update debian/copyright.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 12 Mar 2009 17:12:56 +0100
+
+libxrandr (2:1.2.99.4-2) experimental; urgency=low
+
+  * Cherry-pick patch from upstream git to fix XRRGetOutputPrimary.
+
+ -- Julien Cristau <jcristau@debian.org>  Sun, 01 Feb 2009 14:47:29 +0100
+
+libxrandr (2:1.2.99.4-1) experimental; urgency=low
+
+  [ Timo Aaltonen ]
+  * New upstream prerelease.
+  * debian/control:
+    - Build-depend on automake, libtool, xutils-dev.
+    - Split the build-depends to span multiple lines.
+    - Bump the build-dep on x11proto-randr-dev to (>= 1.2.99.2).
+  * debian/rules:
+    - Run autoreconf -vfi on configure.
+  * debian/libxrandr2.symbols: Add the new symbols.
+
+  [ Julien Cristau ]
+  * Update from 1.2.99.2 to 1.2.99.4
+  * Bump x11proto-randr-dev build and runtime dependencies to >= 1.2.99.3.
+  * debian/libxrandr2.symbols: add new symbols.
+
+ -- Julien Cristau <jcristau@debian.org>  Sun, 04 Jan 2009 20:50:22 +0100
+
+libxrandr (2:1.2.3-1) unstable; urgency=low
+
+  [ Brice Goglin ]
+  * Add a link to www.X.org in the long description.
+  * Add upstream URL to debian/copyright.
+
+  [ Julien Cristau ]
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 08 Jul 2008 23:26:14 +0200
+
+libxrandr (2:1.2.2-2) unstable; urgency=low
+
+  * Add debian/libxrandr2.symbols.
+    Symbols added in the first version (RandR protocol 1.0) carry no version,
+    symbols added for RandR 1.1 need >= 4.3, and RandR 1.2 symbols need
+    libxrandr2 >= 2:1.2.0.
+  * Drop -1 debian revisions from build-deps.
+  * Bump Standards-Version to 3.7.3.
+  * Drop the XS- prefix from Vcs-* control fields.
+  * libxrandr2{,-dbg} don't need to depend on x11-common.
+  * Merge changes from the 7.1 branch (libxrandr 1.1.1) which had never been
+    merged to the trunk (yes, that was two years ago).
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 19 May 2008 00:32:55 +0200
+
+libxrandr (2:1.1.1-1) experimental; urgency=low
+
+  * New upstream release.
+  * Drop patches/01_manpage_location.diff; merged upstream.
+  * Autoreconf w/ an updated xutils-dev so that manpages have the 'x'
+    extension dropped.
+  * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build;
+    idempotency fix.
+  * Run dh_install w/ --list-missing.
+  * Drop duplicate x11-common dep in -dev package.
+  * Bump standards version to 3.7.2.0.
+  * Version x11-common pre-dep in -dev package to 1:7.0.0 to match
+    the rest of Debian.
+  * Bump debhelper compat to 5.
+  * Fix dh_strip call to skip the -dbg package.
+  * Include manpages in -dev package.
+
+ -- Andres Salomon <dilinger@debian.org>  Sat, 29 Jul 2006 16:56:00 -0400
+
+libxrandr (2:1.2.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * Add myself to Uploaders, and remove Branden and Fabio with their
+    permission.
+  * Use ${binary:Version} instead of ${Source-Version}.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 06 Sep 2007 16:34:32 +0200
+
+libxrandr (2:1.2.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Upload to unstable.
+  * Add XS-Vcs-Browser.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 20 Apr 2007 08:15:14 +0200
+
+libxrandr (2:1.2.0-4) experimental; urgency=low
+
+  * New patch from upstream git to fix use of a C++ keyword as a parameter
+    name in Xrandr.h.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 23 Feb 2007 02:17:40 +0100
+
+libxrandr (2:1.2.0-3) experimental; urgency=low
+
+  * Add debian/libxrandr2.shlibs, thanks to Michel Dänzer for noticing my
+    mistake.
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 20 Feb 2007 10:39:03 +0100
+
+libxrandr (2:1.2.0-2) experimental; urgency=low
+
+  * Oops, libxrandr-dev needs to depend on x11proto-randr-dev >= 1.2.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 19 Feb 2007 10:27:32 +0100
+
+libxrandr (2:1.2.0-1) experimental; urgency=low
+
+  * Adjust Section and Priority values to what the override says.
+  * Update location of upstream repository from CVS to git in the long
+    descriptions.
+  * Install Xrandr(3) in libxrandr-dev, and use dh_installman.
+  * Run dh_install with --list-missing.
+  * New upstream release.
+  * Install the upstream ChangeLog.
+  * Add XS-Vcs-Git header.
+  * Update Standards-Version to 3.7.2.
+  * Bump Pre-Depends on x11-common to >= 1:7.0.0 and remove the regular
+    dependency on x11-common in libxrandr-dev to shut lintian up.
+  * Bump build-dependency on x11proto-randr-dev to >= 1.2.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 19 Feb 2007 09:07:09 +0100
+
+libxrandr (2:1.1.0.2-5) unstable; urgency=low
+
+  [ Thierry Reding ]
+  * Add libxrender-dev dependency to libxrandr-dev.
+
+  [ Jamey Sharp ]
+  * libXrandr: Calls UnlockDisplay without calling LockDisplay. (Closes:
+    #400441)
+  * Add Josh and myself to Uploaders.
+
+ -- Jamey Sharp <sharpone@debian.org>  Mon, 27 Nov 2006 14:31:54 -0800
+
+libxrandr (2:1.1.0.2-4) unstable; urgency=low
+
+  * Reorder makeshlib command in rules file so that ldconfig is run
+    properly. Thanks Drew Parsons and Steve Langasek.
+  * Add quilt to build-depends
+
+ -- David Nusinow <dnusinow@debian.org>  Wed, 19 Apr 2006 01:19:50 -0400
+
+libxrandr (2:1.1.0.2-3) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 23 Mar 2006 22:45:15 -0500
+
+libxrandr (2:1.1.0.2-2) experimental; urgency=low
+
+  * Backport manpage location fix
+
+ -- David Nusinow <dnusinow@debian.org>  Thu,  9 Mar 2006 23:25:40 -0500
+
+libxrandr (2:1.1.0.2-1) UNRLEASED; urgency=low
+
+  * First modular upload to Debian
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 29 Dec 2005 20:54:23 -0500
+
+libxrandr (1:1.0.2-2) breezy; urgency=low
+
+  * Update Build-Depends on libx11-dev and libxext-dev to avoid _XOPEN_SOURCE.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Sat, 23 Jul 2005 00:00:57 +1000
+
+libxrandr (1:1.0.2-1) breezy; urgency=low
+
+  * First libxrandr release.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Mon, 16 May 2005 22:10:17 +1000
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..907f6e2
--- /dev/null
@@ -0,0 +1,73 @@
+Source: libxrandr
+Section: x11
+Priority: optional
+Maintainer: Sung-Jin Park <sj76.park@samsung.com>, Sangjin Lee <lsj119@samsung.com>, Debian X Strike Force <debian-x@lists.debian.org>
+Uploaders: SooChan Lim <sc1.lim@samsung.com>, Sung-Jin Park <sj76.park@samsung.com>, David Nusinow <dnusinow@debian.org>
+Build-Depends: debhelper (>= 5.0.0), libx11-dev (>= 1:0.99.2), libxext-dev (>= 1:0.99.1), x11proto-randr-dev (>= 1.3), x11proto-render-dev, libxrender-dev (>= 1:0.9.0-2), pkg-config, quilt, automake, libtool, xutils-dev
+Standards-Version: 3.8.3
+Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxrandr
+Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxrandr.git
+
+Package: libxrandr2
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: X11 RandR extension library
+ libXrandr provides an X Window System client interface to the RandR
+ extension to the X protocol.
+ .
+ The RandR extension allows for run-time configuration of display attributes
+ such as resolution, rotation, and reflection.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXrandr
+
+Package: libxrandr2-dbg
+Section: debug
+Priority: extra
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxrandr2 (= ${binary:Version})
+Description: X11 RandR extension library (debug package)
+ libXrandr provides an X Window System client interface to the RandR
+ extension to the X protocol.
+ .
+ The RandR extension allows for run-time configuration of display attributes
+ such as resolution, rotation, and reflection.
+ .
+ This package contains the debug versions of the library found in libxrandr2.
+ Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXrandr
+
+Package: libxrandr-dev
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxrandr2 (= ${binary:Version}), libx11-dev, libxext-dev, x11proto-randr-dev (>= 1.3), libxrender-dev
+Description: X11 RandR extension library (development headers)
+ libXrandr provides an X Window System client interface to the RandR
+ extension to the X protocol.
+ .
+ The RandR extension allows for run-time configuration of display attributes
+ such as resolution, rotation, and reflection.
+ .
+ This package contains the development headers for the library found in
+ libxrandr2.  Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXrandr
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..cfe695f
--- /dev/null
@@ -0,0 +1,47 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/lib/
+
+Authors: Jim Gettys, HP Labs, HP.
+         Keith Packard, Intel Corporation.
+
+Copyright © 2000, Compaq Computer Corporation, 
+Copyright © 2002, Hewlett Packard, Inc.
+
+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 Compaq or HP not be used in advertising
+or publicity pertaining to distribution of the software without specific,
+written prior permission.  HP makes no representations about the
+suitability of this software for any purpose.  It is provided "as is"
+without express or implied warranty.
+
+HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
+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.
+
+Copyright © 2006 Keith Packard
+Copyright © 2008 Red Hat, Inc.
+
+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.
+
diff --git a/debian/libxrandr-dev.install b/debian/libxrandr-dev.install
new file mode 100755 (executable)
index 0000000..4284693
--- /dev/null
@@ -0,0 +1,6 @@
+usr/include/X11/*
+usr/lib/libXrandr.a
+usr/lib/libXrandr.so
+usr/lib/libXrandr.la
+usr/lib/pkgconfig/xrandr.pc
+usr/share/man/man3/*
diff --git a/debian/libxrandr2.install b/debian/libxrandr2.install
new file mode 100644 (file)
index 0000000..2a1b2a9
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXrandr.so.2*
diff --git a/debian/libxrandr2.symbols b/debian/libxrandr2.symbols
new file mode 100644 (file)
index 0000000..91aab71
--- /dev/null
@@ -0,0 +1,54 @@
+libXrandr.so.2 libxrandr2 #MINVER#
+ XRRAddOutputMode@Base 2:1.2.0
+ XRRAllocGamma@Base 2:1.2.0
+ XRRAllocModeInfo@Base 2:1.2.0
+ XRRChangeOutputProperty@Base 2:1.2.0
+ XRRConfigCurrentConfiguration@Base 0
+ XRRConfigCurrentRate@Base 4.3
+ XRRConfigRates@Base 4.3
+ XRRConfigRotations@Base 0
+ XRRConfigSizes@Base 0
+ XRRConfigTimes@Base 0
+ XRRConfigureOutputProperty@Base 2:1.2.0
+ XRRCreateMode@Base 2:1.2.0
+ XRRDeleteOutputMode@Base 2:1.2.0
+ XRRDeleteOutputProperty@Base 2:1.2.0
+ XRRDestroyMode@Base 2:1.2.0
+ XRRFreeCrtcInfo@Base 2:1.2.0
+ XRRFreeGamma@Base 2:1.2.0
+ XRRFreeModeInfo@Base 2:1.2.0
+ XRRFreeOutputInfo@Base 2:1.2.0
+ XRRFreePanning@Base 2:1.2.99.2
+ XRRFreeScreenConfigInfo@Base 0
+ XRRFreeScreenResources@Base 2:1.2.0
+ XRRGetCrtcGamma@Base 2:1.2.0
+ XRRGetCrtcGammaSize@Base 2:1.2.0
+ XRRGetCrtcInfo@Base 2:1.2.0
+ XRRGetCrtcTransform@Base 2:1.2.99.2
+ XRRGetOutputInfo@Base 2:1.2.0
+ XRRGetOutputPrimary@Base 2:1.2.99.3
+ XRRGetOutputProperty@Base 2:1.2.0
+ XRRGetPanning@Base 2:1.2.99.2
+ XRRGetScreenInfo@Base 0
+ XRRGetScreenResources@Base 2:1.2.0
+ XRRGetScreenResourcesCurrent@Base 2:1.2.99.2
+ XRRGetScreenSizeRange@Base 2:1.2.0
+ XRRListOutputProperties@Base 2:1.2.0
+ XRRQueryExtension@Base 0
+ XRRQueryOutputProperty@Base 2:1.2.0
+ XRRQueryVersion@Base 0
+ XRRRates@Base 4.3
+ XRRRootToScreen@Base 0
+ XRRRotations@Base 0
+ XRRSelectInput@Base 0
+ XRRSetCrtcConfig@Base 2:1.2.0
+ XRRSetCrtcGamma@Base 2:1.2.0
+ XRRSetCrtcTransform@Base 2:1.2.99.2
+ XRRSetOutputPrimary@Base 2:1.2.99.3
+ XRRSetPanning@Base 2:1.2.99.2
+ XRRSetScreenConfig@Base 0
+ XRRSetScreenConfigAndRate@Base 4.3
+ XRRSetScreenSize@Base 2:1.2.0
+ XRRSizes@Base 0
+ XRRTimes@Base 0
+ XRRUpdateConfiguration@Base 0
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..be7f891
--- /dev/null
@@ -0,0 +1,105 @@
+#!/usr/bin/make -f
+# debian/rules for the Debian libxrandr package.
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>
+# Copyright © 2005 Daniel Stone <daniel@fooishbar.org>
+# Copyright © 2005 David Nusinow <dnusinow@debian.org>
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# set this to the name of the main shlib's binary package
+PACKAGE = libxrandr2
+
+include debian/xsfbs/xsfbs.mk
+
+CFLAGS = -Wall -g
+LDFLAGS +=  -Wl,--hash-style=both -Wl,--as-needed
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+       INSTALL_PROGRAM += -s
+endif
+
+DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+       confflags += --build=$(DEB_HOST_GNU_TYPE)
+else
+       confflags += --build=$(DEB_HOST_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+#      confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+configure: $(STAMP_DIR)/patch
+       dh_testdir
+       autoreconf -vfi
+
+obj-$(DEB_BUILD_GNU_TYPE)/config.status: configure
+       dh_testdir
+       test -d obj-$(DEB_BUILD_GNU_TYPE) || mkdir obj-$(DEB_BUILD_GNU_TYPE)
+       cd obj-$(DEB_BUILD_GNU_TYPE) && \
+       ../configure --prefix=/usr --mandir=\$${prefix}/share/man \
+                    --infodir=\$${prefix}/share/info $(confflags) \
+                    CFLAGS="$(CFLAGS)" \
+                    LDFLAGS="$(LDFLAGS)"
+
+
+build: build-stamp
+build-stamp: obj-$(DEB_BUILD_GNU_TYPE)/config.status
+       dh_testdir
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
+       >$@
+
+clean: xsfclean
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+
+       rm -f config.cache config.log config.status
+       rm -f */config.cache */config.log */config.status
+       rm -f conftest* */conftest*
+       rm -rf autom4te.cache */autom4te.cache
+       rm -rf obj-*        
+       rm -f $$(find -name Makefile.in)
+       rm -f compile config.guess config.sub configure depcomp install-sh
+       rm -f ltmain.sh missing INSTALL aclocal.m4 config.h.in mkinstalldirs
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+
+       dh_installdocs
+       dh_install --sourcedir=debian/tmp --list-missing
+       dh_installchangelogs ChangeLog
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=$(PACKAGE)-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs -V'libxrandr2 (>= 2:1.3)'
+       dh_shlibdeps
+       dh_installdeb
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+# Build architecture-independent files here.
+binary-indep: build install
+# Nothing to do
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..e083c01
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/lib/ libXrandr-(.*)\.tar\.gz
diff --git a/debian/xsfbs/repack.sh b/debian/xsfbs/repack.sh
new file mode 100644 (file)
index 0000000..5935cc9
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+if ! [ -d debian/prune ]; then
+       exit 0
+fi
+
+if [ "x$1" != x--upstream-version ]; then
+       exit 1
+fi
+
+version="$2"
+filename="$3"
+
+if [ -z "$version" ] || ! [ -f "$filename" ]; then
+       exit 1
+fi
+
+dir="$(pwd)"
+tempdir="$(mktemp -d)"
+
+cd "$tempdir"
+tar xf "$dir/$filename"
+cat "$dir"/debian/prune/* | while read file; do rm -f */$file; done
+
+tar czf "$dir/$filename" *
+cd "$dir"
+rm -rf "$tempdir"
+echo "Done pruning upstream tarball"
+
+exit 0
diff --git a/debian/xsfbs/xsfbs.mk b/debian/xsfbs/xsfbs.mk
new file mode 100644 (file)
index 0000000..5e16b10
--- /dev/null
@@ -0,0 +1,276 @@
+#!/usr/bin/make -f
+
+# Debian X Strike Force Build System (XSFBS): Make portion
+
+# Copyright 1996 Stephen Early
+# Copyright 1997 Mark Eichin
+# Copyright 1998-2005, 2007 Branden Robinson
+# Copyright 2005 David Nusinow
+#
+# Licensed under the GNU General Public License, version 2.  See the file
+# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# Originally by Stephen Early <sde1000@debian.org>
+# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
+# Modified by Adam Heath <doogie@debian.org>
+# Modified by Branden Robinson <branden@debian.org>
+# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
+# Modified by David Nusinow <dnusinow@debian.org>
+# Acknowledgements to Manoj Srivastava.
+
+# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
+export DH_OPTIONS
+
+# force quilt to not use ~/.quiltrc and to use debian/patches
+QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null
+
+# Set up parameters for the upstream build environment.
+
+# Determine (source) package name from Debian changelog.
+SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Source:' | awk '{print $$2}')
+
+# Determine package version from Debian changelog.
+SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Version:' | awk '{print $$2}')
+
+# Determine upstream version number.
+UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//')
+
+# Determine the source version without the epoch for make-orig-tar-gz
+NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://')
+
+# Figure out who's building this package.
+BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
+
+# Find out if this is an official build; an official build has nothing but
+# digits, dots, and/or the codename of a release in the Debian part of the
+# version number.  Anything else indicates an unofficial build.
+OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi)
+
+# Set up parameters for the Debian build environment.
+
+# Determine our architecture.
+BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# Work around some old-time dpkg braindamage.
+BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH))
+# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
+ifdef DEB_HOST_ARCH
+ ARCH:=$(DEB_HOST_ARCH)
+else
+ # dpkg-cross sets the ARCH environment variable; if set, use it.
+ ifdef ARCH
+  ARCH:=$(ARCH)
+ else
+  ARCH:=$(BUILD_ARCH)
+ endif
+endif
+
+# $(STAMP_DIR) houses stamp files for complex targets.
+STAMP_DIR:=stampdir
+
+# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
+# their files.
+DEBTREEDIR:=$(CURDIR)/debian/tmp
+
+# All "important" targets have four lines:
+#   1) A target name that is invoked by a package-building tool or the user.
+#      This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart.
+#   2) A line delcaring 1) as a phony target (".PHONY:").
+#   3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may
+#   depend on other targets.
+#   4) A line declaring 3) as a member of the $(stampdir_targets) variable; the
+#   "$(STAMP_DIR)/" prefix is omitted.
+#
+# This indirection is needed so that the "stamp" files that signify when a rule
+# is done can be located in a separate "stampdir".  Recall that make has no way
+# to know when a goal has been met for a phony target (like "build" or
+# "install").
+#
+# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@"
+# so that the target will not be run again.  Removing the file will make Make
+# run the target over.
+
+# All phony targets should be declared as dependencies of .PHONY, even if they
+# do not have "($STAMP_DIR)/"-prefixed counterparts.
+
+# Define a harmless default rule to keep things from going nuts by accident.
+.PHONY: default
+default:
+
+# Set up the $(STAMP_DIR) directory.
+.PHONY: stampdir
+stampdir_targets+=stampdir
+stampdir: $(STAMP_DIR)/stampdir
+$(STAMP_DIR)/stampdir:
+       mkdir $(STAMP_DIR)
+       >$@
+
+# Set up the package build directory as quilt expects to find it.
+.PHONY: prepare
+stampdir_targets+=prepare
+prepare: $(STAMP_DIR)/prepare
+$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts
+       >$@
+
+.PHONY: log
+stampdir_targets+=log
+log: $(STAMP_DIR)/log
+$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir
+       mkdir -p $(STAMP_DIR)/log
+
+# Apply all patches to the upstream source.
+.PHONY: patch
+stampdir_targets+=patch
+patch: $(STAMP_DIR)/patch
+$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
+       if ! [ `which quilt` ]; then \
+               echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
+               exit 1; \
+       fi; \
+       if $(QUILT) next >/dev/null 2>&1; then \
+         echo -n "Applying patches..."; \
+         if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "No patches to apply"; \
+       fi; \
+       >$@
+
+# Revert all patches to the upstream source.
+.PHONY: unpatch
+unpatch: $(STAMP_DIR)/log
+       rm -f $(STAMP_DIR)/patch
+       @echo -n "Unapplying patches..."; \
+       if $(QUILT) applied >/dev/null 2>/dev/null; then \
+         if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "nothing to do."; \
+       fi
+
+# Clean the generated maintainer scripts.
+.PHONY: cleanscripts
+cleanscripts:
+       rm -f $(STAMP_DIR)/genscripts
+       rm -f debian/*.config \
+             debian/*.postinst \
+             debian/*.postrm \
+             debian/*.preinst \
+             debian/*.prerm
+
+# Clean the package build tree.
+.PHONY: xsfclean
+xsfclean: cleanscripts unpatch
+       dh_testdir
+       rm -rf .pc
+       rm -rf $(STAMP_DIR)
+       dh_clean
+
+# Remove files from the upstream source tree that we don't need, or which have
+# licensing problems.  It must be run before creating the .orig.tar.gz.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: prune-upstream-tree
+prune-upstream-tree:
+       # Ensure we're in the correct directory.
+       dh_testdir
+       grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
+
+# Verify that there are no offsets or fuzz in the patches we apply.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: patch-audit
+patch-audit: prepare unpatch
+       @echo -n "Auditing patches..."; \
+       >$(STAMP_DIR)/log/patch; \
+       FUZZY=; \
+       while [ -n "$$($(QUILT) next)" ]; do \
+         RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
+         case "$$RESULT" in \
+           succeeded) \
+             echo "fuzzy patch: $$($(QUILT) top)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \
+             FUZZY=yes; \
+             ;; \
+           FAILED) \
+             echo "broken patch: $$($(QUILT) next)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \
+             exit 1; \
+             ;; \
+         esac; \
+       done; \
+       if [ -n "$$FUZZY" ]; then \
+         echo "there were fuzzy patches; please fix."; \
+         exit 1; \
+       else \
+         echo "done."; \
+       fi
+
+# Generate the maintainer scripts.
+.PHONY: genscripts
+stampdir_targets+=genscripts
+genscripts: $(STAMP_DIR)/genscripts
+$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir
+       for FILE in debian/*.config.in \
+                   debian/*.postinst.in \
+                   debian/*.postrm.in \
+                   debian/*.preinst.in \
+                   debian/*.prerm.in; do \
+         if [ -e "$$FILE" ]; then \
+           MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \
+           sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \
+           cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \
+           sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
+           sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
+               -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
+             <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
+           rm $$MAINTSCRIPT.tmp; \
+         fi; \
+       done
+       # Validate syntax of generated shell scripts.
+       #sh debian/scripts/validate-posix-sh debian/*.config \
+       #                                    debian/*.postinst \
+       #                                    debian/*.postrm \
+       #                                    debian/*.preinst \
+       #                                    debian/*.prerm
+       >$@
+
+SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null)
+VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null)
+INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null)
+SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS))
+VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI)
+INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI)
+ifeq ($(PACKAGE),)
+PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control)
+endif
+
+.PHONY: serverabi
+serverabi: install
+ifeq ($(SERVERMINVERS),)
+       @echo error: xserver-xorg-dev needs to be installed
+       @exit 1
+else
+       echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars
+       echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+       echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+endif
+
+# vim:set noet ai sts=8 sw=8 tw=0:
diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh
new file mode 100644 (file)
index 0000000..813fd8d
--- /dev/null
@@ -0,0 +1,622 @@
+# This is the X Strike Force shell library for X Window System package
+# maintainer scripts.  It serves to define shell functions commonly used by
+# such packages, and performs some error checking necessary for proper operation
+# of those functions.  By itself, it does not "do" much; the maintainer scripts
+# invoke the functions defined here to accomplish package installation and
+# removal tasks.
+
+# If you are reading this within a Debian package maintainer script (e.g.,
+# /var/lib/dpkg/info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can
+# skip past this library by scanning forward in this file to the string
+# "GOBSTOPPER".
+
+SOURCE_VERSION=@SOURCE_VERSION@
+OFFICIAL_BUILD=@OFFICIAL_BUILD@
+
+# Use special abnormal exit codes so that problems with this library are more
+# easily tracked down.
+SHELL_LIB_INTERNAL_ERROR=86
+SHELL_LIB_THROWN_ERROR=74
+SHELL_LIB_USAGE_ERROR=99
+
+# old -> new variable names
+if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then
+  DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE"
+fi
+if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then
+  DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF"
+fi
+
+# initial sanity checks
+if [ -z "$THIS_PACKAGE" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_PACKAGE shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of this package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ -z "$THIS_SCRIPT" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_SCRIPT shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of the
+"$THIS_PACKAGE" package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
+  RECONFIGURE="true"
+else
+  RECONFIGURE=
+fi
+
+if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then
+  FIRSTINST="yes"
+fi
+
+if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then
+  UPGRADE="yes"
+fi
+
+trap "message;\
+      message \"Received signal.  Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\
+      message;\
+      exit 1" HUP INT QUIT TERM
+
+reject_nondigits () {
+  # syntax: reject_nondigits [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters other than decimal digits and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain anything but digits?
+    if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+      # can't use die(), because it wraps message() which wraps this function
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \
+           "possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+reject_unlikely_path_chars () {
+  # syntax: reject_unlikely_path_chars [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters unlikely to be seen in a path and which the shell might
+  # interpret and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain any funny characters?
+    if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then
+      # can't use die(), because I want to avoid forward references
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \
+           "encountered possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user.  This is used only as a fallback in the
+# event the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while
+# the script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+  DEFCOLUMNS=80
+fi
+
+message () {
+  # pretty-print messages of arbitrary length
+  reject_nondigits "$COLUMNS"
+  echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2
+}
+
+observe () {
+  # syntax: observe message ...
+  #
+  # issue observational message suitable for logging someday when support for
+  # it exists in dpkg
+  if [ -n "$DEBUG_XORG_PACKAGE" ]; then
+    message "$THIS_PACKAGE $THIS_SCRIPT note: $*"
+  fi
+}
+
+warn () {
+  # syntax: warn message ...
+  #
+  # issue warning message suitable for logging someday when support for
+  # it exists in dpkg; also send to standard error
+  message "$THIS_PACKAGE $THIS_SCRIPT warning: $*"
+}
+
+die () {
+  # syntax: die message ...
+  #
+  # exit script with error message
+  message "$THIS_PACKAGE $THIS_SCRIPT error: $*"
+  exit $SHELL_LIB_THROWN_ERROR
+}
+
+internal_error () {
+  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
+  message "internal error: $*"
+  if [ -n "$OFFICIAL_BUILD" ]; then
+    message "Please report a bug in the $THIS_SCRIPT script of the" \
+            "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+            "Tracking System.  Include all messages above that mention the" \
+            "$THIS_PACKAGE package.  Visit " \
+            "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+            "instructions, read the file" \
+            "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+            "package, or install the reportbug package and use the command of" \
+            "the same name to file a report."
+  fi
+  exit $SHELL_LIB_INTERNAL_ERROR
+}
+
+usage_error () {
+  message "usage error: $*"
+  message "Please report a bug in the $THIS_SCRIPT script of the" \
+          "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+          "Tracking System.  Include all messages above that mention the" \
+          "$THIS_PACKAGE package.  Visit " \
+          "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+          "instructions, read the file" \
+          "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+          "package, or install the reportbug package and use the command of" \
+          "the same name to file a report."
+  exit $SHELL_LIB_USAGE_ERROR
+}
+
+font_update () {
+  # run $UPDATECMDS in $FONTDIRS
+
+  local dir cmd shortcmd x_font_dir_prefix
+
+  x_font_dir_prefix="/usr/share/fonts/X11"
+
+  if [ -z "$UPDATECMDS" ]; then
+    usage_error "font_update() called but \$UPDATECMDS not set"
+  fi
+  if [ -z "$FONTDIRS" ]; then
+    usage_error "font_update() called but \$FONTDIRS not set"
+  fi
+
+  reject_unlikely_path_chars "$UPDATECMDS"
+  reject_unlikely_path_chars "$FONTDIRS"
+
+  for dir in $FONTDIRS; do
+    if [ -d "$x_font_dir_prefix/$dir" ]; then
+      for cmd in $UPDATECMDS; do
+        if which "$cmd" > /dev/null 2>&1; then
+          shortcmd=${cmd##*/}
+          observe "running $shortcmd in $dir font directory"
+         cmd_opts=
+          if [ "$shortcmd" = "update-fonts-alias" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-dir" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-scale" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          $cmd $cmd_opts $dir || warn "$cmd $cmd_opts $dir" \
+                              "failed; font directory data may not" \
+                              "be up to date"
+        else
+          warn "$cmd not found; not updating corresponding $dir font" \
+               "directory data"
+        fi
+      done
+    else
+      warn "$dir is not a directory; not updating font directory data"
+    fi
+  done
+}
+
+remove_conffile_prepare () {
+  # syntax: remove_conffile_prepare filename official_md5sum ...
+  #
+  # Check a conffile "filename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 2 ]; then
+    usage_error "remove_conffile_prepare() called with wrong number of" \
+                "arguments; expected at least 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+  shift
+
+  # does the conffile even exist?
+  if [ -e "$conffile" ]; then
+    # calculate its checksum
+    current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//')
+    # compare it to each supplied checksum
+    while [ -n "$1" ]; do
+      if [ "$current_checksum" = "$1" ]; then
+        # we found a match; move the confffile and stop looking
+        observe "preparing obsolete conffile $conffile for removal"
+        mv "$conffile" "$conffile.$THIS_PACKAGE-tmp"
+        break
+      fi
+      shift
+    done
+  fi
+}
+
+remove_conffile_lookup () {
+  # syntax: remove_conffile_lookup package filename
+  #
+  # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal
+  # if it matches the actual file's md5sum.
+  #
+  # Call this function when you would call remove_conffile_prepare but only
+  # want to check against dpkg's status database instead of known checksums.
+
+  local package conffile old_md5sum
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "remove_conffile_lookup() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  package="$1"
+  conffile="$2"
+
+  if ! [ -e "$conffile" ]; then
+    return
+  fi
+  old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \
+    awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')"
+  if [ -n "$old_md5sum" ]; then
+    remove_conffile_prepare "$conffile" "$old_md5sum"
+  fi
+}
+
+remove_conffile_commit () {
+  # syntax: remove_conffile_commit filename
+  #
+  # Complete the removal of a conffile "filename" that has become obsolete.
+  #
+  # Call this function from a postinst script after having used
+  # remove_conffile_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_commit() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, remove it
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "committing removal of obsolete conffile $conffile"
+    rm "$conffile.$THIS_PACKAGE-tmp"
+  fi
+}
+
+remove_conffile_rollback () {
+  # syntax: remove_conffile_rollback filename
+  #
+  # Roll back the removal of a conffile "filename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" is  after having used remove_conffile_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_rollback() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, move it
+  # back
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "rolling back removal of obsolete conffile $conffile"
+    mv "$conffile.$THIS_PACKAGE-tmp" "$conffile"
+  fi
+}
+
+replace_conffile_with_symlink_prepare () {
+  # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \
+  # official_md5sum ...
+  #
+  # Check a conffile "oldfilename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails. Otherwise copy it
+  # to newfilename and let dpkg handle it through conffiles mechanism.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 3 ]; then
+    usage_error "replace_conffile_with_symlink_prepare() called with wrong" \
+                " number of arguments; expected at least 3, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  shift
+  newconffile="$1"
+  shift
+
+  remove_conffile_prepare "$_oldconffile" "$@"
+  # If $oldconffile still exists, then md5sums didn't match.
+  # Copy it to new one.
+  if [ -f "$oldconffile" ]; then
+    cp "$oldconffile" "$newconffile"
+  fi
+
+}
+
+replace_conffile_with_symlink_commit () {
+  # syntax: replace_conffile_with_symlink_commit oldfilename
+  #
+  # Complete the removal of a conffile "oldfilename" that has been
+  # replaced by a symlink.
+  #
+  # Call this function from a postinst script after having used
+  # replace_conffile_with_symlink_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "replace_conffile_with_symlink_commit() called with wrong" \
+                "number of arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  remove_conffile_commit "$conffile"
+}
+
+replace_conffile_with_symlink_rollback () {
+  # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename
+  #
+  # Roll back the replacing of a conffile "oldfilename" with symlink to
+  # "newfilename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" and verify $2 to ensure the package failed to upgrade
+  # from a version (or install over a version removed-but-not-purged) prior
+  # to the one in which the conffile was obsoleted.
+  # You should have  used replace_conffile_with_symlink_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "replace_conffile_with_symlink_rollback() called with wrong" \
+                "number of arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  newconffile="$2"
+
+  remove_conffile_rollback "$_oldconffile"
+  if [ -f "$newconffile" ]; then
+    rm "$newconffile"
+  fi
+}
+
+run () {
+  # syntax: run command [ argument ... ]
+  #
+  # Run specified command with optional arguments and report its exit status.
+  # Useful for commands whose exit status may be nonzero, but still acceptable,
+  # or commands whose failure is not fatal to us.
+  #
+  # NOTE: Do *not* use this function with db_get or db_metaget commands; in
+  # those cases the return value of the debconf command *must* be checked
+  # before the string returned by debconf is used for anything.
+
+  local retval
+
+  # validate arguments
+  if [ $# -lt 1 ]; then
+    usage_error "run() called with wrong number of arguments; expected at" \
+                "least 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  "$@" || retval=$?
+
+  if [ ${retval:-0} -ne 0 ]; then
+    observe "command \"$*\" exited with status $retval"
+  fi
+}
+
+make_symlink_sane () {
+  # syntax: make_symlink_sane symlink target
+  #
+  # Ensure that the symbolic link symlink exists, and points to target.
+  #
+  # If symlink does not exist, create it and point it at target.
+  #
+  # If symlink exists but is not a symbolic link, back it up.
+  #
+  # If symlink exists, is a symbolic link, but points to the wrong location, fix
+  # it.
+  #
+  # If symlink exists, is a symbolic link, and already points to target, do
+  # nothing.
+  #
+  # This function wouldn't be needed if ln had an -I, --idempotent option.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "make_symlink_sane() called with wrong number of arguments;" \
+      "expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local symlink target
+
+  symlink="$1"
+  target="$2"
+
+  if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then
+      observe "link from $symlink to $target already exists"
+  else
+    observe "creating symbolic link from $symlink to $target"
+    mkdir -p "${target%/*}" "${symlink%/*}"
+    ln -s -b -S ".dpkg-old" "$target" "$symlink"
+  fi
+}
+
+migrate_dir_to_symlink () {
+  # syntax: migrate_dir_to_symlink old_location new_location
+  #
+  # Per Debian Policy section 6.5.4, "A directory will never be replaced by a
+  # symbolic link to a directory or vice versa; instead, the existing state
+  # (symlink or not) will be left alone and dpkg will follow the symlink if
+  # there is one."
+  #
+  # We have to do it ourselves.
+  #
+  # This function moves the contents of old_location, a directory, into
+  # new_location, a directory, then makes old_location a symbolic link to
+  # new_location.
+  #
+  # old_location need not exist, but if it does, it must be a directory (or a
+  # symlink to a directory).  If it is not, it is backed up.  If new_location
+  # exists already and is not a directory, it is backed up.
+  #
+  # This function should be called from a package's preinst so that other
+  # packages unpacked after this one --- but before this package's postinst runs
+  # --- are unpacked into new_location even if their payloads contain
+  # old_location filespecs.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "migrate_dir_to_symlink() called with wrong number of"
+                "arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local new old
+
+  old="$1"
+  new="$2"
+
+  # Is old location a symlink?
+  if [ -L "$old" ]; then
+    # Does it already point to new location?
+    if [ "$(readlink "$old")" = "$new" ]; then
+      # Nothing to do; migration has already been done.
+      observe "migration of $old to $new already done"
+      return 0
+    else
+      # Back it up.
+      warn "backing up symbolic link $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+    fi
+  fi
+
+  # Does old location exist, but is not a directory?
+  if [ -e "$old" ] && ! [ -d "$old" ]; then
+      # Back it up.
+      warn "backing up non-directory $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+  fi
+
+  observe "migrating $old to $new"
+
+  # Is new location a symlink?
+  if [ -L "$new" ]; then
+    # Does it point the wrong way, i.e., back to where we're migrating from?
+    if [ "$(readlink "$new")" = "$old" ]; then
+      # Get rid of it.
+      observe "removing symbolic link $new which points to $old"
+      rm "$new"
+    else
+      # Back it up.
+      warn "backing up symbolic link $new as $new.dpkg-old"
+      mv -b "$new" "$new.dpkg-old"
+    fi
+  fi
+
+  # Does new location exist, but is not a directory?
+  if [ -e "$new" ] && ! [ -d "$new" ]; then
+    warn "backing up non-directory $new as $new.dpkg-old"
+    mv -b "$new" "$new.dpkg-old"
+  fi
+
+  # Create new directory if it does not yet exist.
+  if ! [ -e "$new" ]; then
+    observe "creating $new"
+    mkdir -p "$new"
+  fi
+
+  # Copy files in old location to new location.  Back up any filenames that
+  # already exist in the new location with the extension ".dpkg-old".
+  observe "copying files from $old to $new"
+  if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then
+    die "error(s) encountered while copying files from $old to $new"
+  fi
+
+  # Remove files at old location.
+  observe "removing $old"
+  rm -r "$old"
+
+  # Create symlink from old location to new location.
+  make_symlink_sane "$old" "$new"
+}
+
+# vim:set ai et sw=2 ts=2 tw=80:
+
+# GOBSTOPPER: The X Strike Force shell library ends here.
diff --git a/include/X11/extensions/Xrandr.h b/include/X11/extensions/Xrandr.h
new file mode 100755 (executable)
index 0000000..6b756a7
--- /dev/null
@@ -0,0 +1,456 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett-Packard Company, Inc.
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * 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.
+ *
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ *         Keith Packard, Intel Corporation
+ */
+
+#ifndef _XRANDR_H_
+#define _XRANDR_H_
+
+#include <X11/extensions/randr.h>
+#include <X11/extensions/Xrender.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+typedef XID RROutput;
+typedef XID RRCrtc;
+typedef XID RRMode;
+
+typedef struct {
+    int        width, height;
+    int        mwidth, mheight;
+} XRRScreenSize;
+
+/*
+ *  Events.
+ */
+
+typedef struct {
+    int type;                  /* event base */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    Window window;             /* window which selected for this event */
+    Window root;               /* Root window for changed screen */
+    Time timestamp;            /* when the screen change occurred */
+    Time config_timestamp;     /* when the last configuration change */
+    SizeID size_index;
+    SubpixelOrder subpixel_order;
+    Rotation rotation;
+    int width;
+    int height;
+    int mwidth;
+    int mheight;
+} XRRScreenChangeNotifyEvent;
+
+typedef struct {
+    int type;                  /* event base */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    Window window;             /* window which selected for this event */
+    int subtype;               /* RRNotify_ subtype */
+} XRRNotifyEvent;
+
+typedef struct {
+    int type;                  /* event base */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    Window window;             /* window which selected for this event */
+    int subtype;               /* RRNotify_OutputChange */
+    RROutput output;           /* affected output */
+    RRCrtc crtc;               /* current crtc (or None) */
+    RRMode mode;               /* current mode (or None) */
+    Rotation rotation;         /* current rotation of associated crtc */
+    Connection connection;     /* current connection status */
+    SubpixelOrder subpixel_order;
+} XRROutputChangeNotifyEvent;
+
+typedef struct {
+    int type;                  /* event base */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    Window window;             /* window which selected for this event */
+    int subtype;               /* RRNotify_CrtcChange */
+    RRCrtc crtc;               /* current crtc (or None) */
+    RRMode mode;               /* current mode (or None) */
+    Rotation rotation;         /* current rotation of associated crtc */
+    int x, y;                  /* position */
+    unsigned int width, height;        /* size */
+} XRRCrtcChangeNotifyEvent;
+
+typedef struct {
+    int type;                  /* event base */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    Window window;             /* window which selected for this event */
+    int subtype;               /* RRNotify_OutputProperty */
+    RROutput output;           /* related output */
+    Atom property;             /* changed property */
+    Time timestamp;            /* time of change */
+    int state;                 /* NewValue, Deleted */
+} XRROutputPropertyNotifyEvent;
+
+/* internal representation is private to the library */
+typedef struct _XRRScreenConfiguration XRRScreenConfiguration; 
+
+Bool XRRQueryExtension (Display *dpy,
+                       int *event_base_return,
+                       int *error_base_return);
+Status XRRQueryVersion (Display *dpy,
+                           int     *major_version_return,
+                           int     *minor_version_return);
+
+XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
+                                         Window window);
+    
+void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);
+
+/* 
+ * Note that screen configuration changes are only permitted if the client can
+ * prove it has up to date configuration information.  We are trying to
+ * insist that it become possible for screens to change dynamically, so
+ * we want to ensure the client knows what it is talking about when requesting
+ * changes.
+ */
+Status XRRSetScreenConfig (Display *dpy, 
+                          XRRScreenConfiguration *config,
+                          Drawable draw,
+                          int size_index,
+                          Rotation rotation,
+                          Time timestamp);
+
+/* added in v1.1, sorry for the lame name */
+Status XRRSetScreenConfigAndRate (Display *dpy, 
+                                 XRRScreenConfiguration *config,
+                                 Drawable draw,
+                                 int size_index,
+                                 Rotation rotation,
+                                 short rate,
+                                 Time timestamp);
+
+
+Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
+
+Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);
+
+XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);
+
+short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates);
+
+SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config, 
+                             Rotation *rotation);
+    
+short XRRConfigCurrentRate (XRRScreenConfiguration *config);
+
+int XRRRootToScreen(Display *dpy, Window root);
+
+/* 
+ * returns the screen configuration for the specified screen; does a lazy
+ * evalution to delay getting the information, and caches the result.
+ * These routines should be used in preference to XRRGetScreenInfo
+ * to avoid unneeded round trips to the X server.  These are new
+ * in protocol version 0.1.
+ */
+
+
+void XRRSelectInput(Display *dpy, Window window, int mask);
+
+/* 
+ * the following are always safe to call, even if RandR is not implemented 
+ * on a screen 
+ */
+
+
+Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);
+XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);
+short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates);
+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,
+                      int *maxWidth, int *maxHeight);
+
+void
+XRRSetScreenSize (Display *dpy, Window window,
+                 int width, int height,
+                 int mmWidth, int mmHeight);
+
+typedef unsigned long XRRModeFlags;
+
+typedef struct _XRRModeInfo {
+    RRMode             id;
+    unsigned int       width;
+    unsigned int       height;
+    unsigned long      dotClock;
+    unsigned int       hSyncStart;
+    unsigned int       hSyncEnd;
+    unsigned int       hTotal;
+    unsigned int       hSkew;
+    unsigned int       vSyncStart;
+    unsigned int       vSyncEnd;
+    unsigned int       vTotal;
+    char               *name;
+    unsigned int       nameLength;
+    XRRModeFlags       modeFlags;
+} XRRModeInfo;
+
+typedef struct _XRRScreenResources {
+    Time       timestamp;
+    Time       configTimestamp;
+    int                ncrtc;
+    RRCrtc     *crtcs;
+    int                noutput;
+    RROutput   *outputs;
+    int                nmode;
+    XRRModeInfo        *modes;
+} XRRScreenResources;
+    
+XRRScreenResources *
+XRRGetScreenResources (Display *dpy, Window window);
+
+void
+XRRFreeScreenResources (XRRScreenResources *resources);
+
+typedef struct _XRROutputInfo {
+    Time           timestamp;
+    RRCrtc         crtc;
+    char           *name;
+    int                    nameLen;
+    unsigned long   mm_width;
+    unsigned long   mm_height;
+    Connection     connection;
+    SubpixelOrder   subpixel_order;
+    int                    ncrtc;
+    RRCrtc         *crtcs;
+    int                    nclone;
+    RROutput       *clones;
+    int                    nmode;
+    int                    npreferred;
+    RRMode         *modes;
+} XRROutputInfo;
+
+XRROutputInfo *
+XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output);
+
+void
+XRRFreeOutputInfo (XRROutputInfo *outputInfo);
+
+Atom *
+XRRListOutputProperties (Display *dpy, RROutput output, int *nprop);
+
+typedef struct {
+    Bool    pending;
+    Bool    range;
+    Bool    immutable;
+    int            num_values;
+    long    *values;
+} XRRPropertyInfo;
+
+XRRPropertyInfo *
+XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property);
+
+void
+XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,
+                           Bool pending, Bool range, int num_values,
+                           long *values);
+                       
+void
+XRRChangeOutputProperty (Display *dpy, RROutput output,
+                        Atom property, Atom type,
+                        int format, int mode,
+                        _Xconst unsigned char *data, int nelements);
+
+void
+XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property);
+
+int
+XRRGetOutputProperty (Display *dpy, RROutput output,
+                     Atom property, long offset, long length,
+                     Bool _delete, Bool pending, Atom req_type,
+                     Atom *actual_type, int *actual_format,
+                     unsigned long *nitems, unsigned long *bytes_after,
+                     unsigned char **prop);
+
+XRRModeInfo *
+XRRAllocModeInfo (char *name, int nameLength);
+
+RRMode
+XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);
+
+void
+XRRDestroyMode (Display *dpy, RRMode mode);
+
+void
+XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode);
+
+void
+XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode);
+
+void
+XRRFreeModeInfo (XRRModeInfo *modeInfo);
+                     
+typedef struct _XRRCrtcInfo {
+    Time           timestamp;
+    int                    x, y;
+    unsigned int    width, height;
+    RRMode         mode;
+    Rotation       rotation;
+    int                    noutput;
+    RROutput       *outputs;
+    Rotation       rotations;
+    int                    npossible;
+    RROutput       *possible;
+} XRRCrtcInfo;
+
+XRRCrtcInfo *
+XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);
+
+Status
+XRRSetCrtcConfig (Display *dpy,
+                 XRRScreenResources *resources,
+                 RRCrtc crtc,
+                 Time timestamp,
+                 int x, int y,
+                 RRMode mode,
+                 Rotation rotation,
+                 RROutput *outputs,
+                 int noutputs);
+
+int
+XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc);
+
+typedef struct _XRRCrtcGamma {
+    int                    size;
+    unsigned short  *red;
+    unsigned short  *green;
+    unsigned short  *blue;
+} XRRCrtcGamma;
+
+XRRCrtcGamma *
+XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);
+
+XRRCrtcGamma *
+XRRAllocGamma (int size);
+
+void
+XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *gamma);
+
+void
+XRRFreeGamma (XRRCrtcGamma *gamma);
+
+/* Version 1.3 additions */
+
+XRRScreenResources *
+XRRGetScreenResourcesCurrent (Display *dpy, Window window);
+
+void
+XRRSetCrtcTransform (Display   *dpy,
+                    RRCrtc     crtc, 
+                    XTransform *transform,
+                    char       *filter,
+                    XFixed     *params,
+                    int        nparams);
+
+typedef struct _XRRCrtcTransformAttributes {
+    XTransform pendingTransform;
+    char       *pendingFilter;
+    int                pendingNparams;
+    XFixed     *pendingParams;
+    XTransform currentTransform;
+    char       *currentFilter;
+    int                currentNparams;
+    XFixed     *currentParams;
+} XRRCrtcTransformAttributes;
+
+/*
+ * Get current crtc transforms and filters.
+ * Pass *attributes to XFree to free
+ */
+Status
+XRRGetCrtcTransform (Display   *dpy,
+                    RRCrtc     crtc,
+                    XRRCrtcTransformAttributes **attributes);
+
+/*
+ * intended to take RRScreenChangeNotify,  or 
+ * ConfigureNotify (on the root window)
+ * returns 1 if it is an event type it understands, 0 if not
+ */
+int XRRUpdateConfiguration(XEvent *event);
+
+typedef struct _XRRPanning {
+    Time            timestamp;
+    unsigned int left;
+    unsigned int top;
+    unsigned int width;
+    unsigned int height;
+    unsigned int track_left;
+    unsigned int track_top;
+    unsigned int track_width;
+    unsigned int track_height;
+    int          border_left;
+    int          border_top;
+    int          border_right;
+    int          border_bottom;
+} XRRPanning;
+
+XRRPanning *
+XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreePanning (XRRPanning *panning);
+
+Status
+XRRSetPanning (Display *dpy,
+              XRRScreenResources *resources,
+              RRCrtc crtc,
+              XRRPanning *panning);
+
+void
+XRRSetOutputPrimary(Display *dpy,
+                   Window window,
+                   RROutput output);
+
+RROutput
+XRRGetOutputPrimary(Display *dpy,
+                   Window window);
+
+_XFUNCPROTOEND
+
+#endif /* _XRANDR_H_ */
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100755 (executable)
index 0000000..f3bc1b8
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+libmandir = $(LIB_MAN_DIR)
+
+libman_PRE =                           \
+       Xrandr.man                      \
+       $(Xrandr_shadows:=.man)
+
+Xrandr_shadows =                       \
+       XRRQueryExtension               \
+       XRRQueryVersion                 \
+       XRRGetScreenInfo                \
+       XRRFreeScreenConfigInfo         \
+       XRRSetScreenConfig              \
+       XRRSetScreenConfigAndRate       \
+       XRRConfigRotations              \
+       XRRConfigTimes                  \
+       XRRConfigSizes                  \
+       XRRConfigRates                  \
+       XRRConfigCurrentConfiguration   \
+       XRRConfigCurrentRate            \
+       XRRRootToScreen                 \
+       XRRSelectInput
+
+libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@)
+
+EXTRA_DIST = $(libman_PRE)
+CLEANFILES = $(libman_DATA)
+
+SUFFIXES = .$(LIB_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+.man.$(LIB_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/man/XRRConfigCurrentConfiguration.man b/man/XRRConfigCurrentConfiguration.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRConfigCurrentRate.man b/man/XRRConfigCurrentRate.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRConfigRates.man b/man/XRRConfigRates.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRConfigRotations.man b/man/XRRConfigRotations.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRConfigSizes.man b/man/XRRConfigSizes.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRConfigTimes.man b/man/XRRConfigTimes.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRFreeScreenConfigInfo.man b/man/XRRFreeScreenConfigInfo.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRGetScreenInfo.man b/man/XRRGetScreenInfo.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRQueryExtension.man b/man/XRRQueryExtension.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRQueryVersion.man b/man/XRRQueryVersion.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRRootToScreen.man b/man/XRRRootToScreen.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRSelectInput.man b/man/XRRSelectInput.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRSetScreenConfig.man b/man/XRRSetScreenConfig.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/XRRSetScreenConfigAndRate.man b/man/XRRSetScreenConfigAndRate.man
new file mode 100755 (executable)
index 0000000..e02ca38
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xrandr.__libmansuffix__
diff --git a/man/Xrandr.man b/man/Xrandr.man
new file mode 100755 (executable)
index 0000000..23a3970
--- /dev/null
@@ -0,0 +1,343 @@
+.\"
+.\" Copyright 2002 Hewlett-Packard Company.\"
+.\" 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 Hewlett-Packard Company not be used in
+.\" advertising or publicity pertaining to distribution of the software without
+.\" specific, written prior permission.  Hewlett Packard Company makes no
+.\" representations about the suitability of this software for any purpose.  It
+.\" is provided "as is" without express or implied warranty.
+.\"
+.\" Hewlett-Packard DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+.\" EVENT SHALL KEITH PACKARD 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.
+.\"
+.de TQ
+.br
+.ns
+.TP \\$1
+..
+.TH XRANDR __libmansuffix__ __vendorversion__
+
+.SH NAME
+ Xrandr \- X Resize, Rotate and Reflection extension.
+.SH SYNTAX
+\&#include <X11/extensions/Xrandr.h>
+.nf    
+.sp
+Bool XRRQueryExtension \^(\^Display *\fIdpy\fP, 
+       int *\fIevent_base_return\fP, int *\fIerror_base_return\fP\^);
+.sp
+Status XRRQueryVersion \^(\^Display *\fIdpy\fP,
+       int *\fImajor_version_return\fP,
+       int *\fIminor_version_return\fP\^);
+.sp
+XRRScreenConfiguration *XRRGetScreenInfo \^(\^Display *dpy,
+       Drawable \fIdraw\fP\^);
+.sp
+void XRRFreeScreenConfigInfo \^(\^
+       \fIXRRScreenConfiguration *config\fP\^);
+.sp
+Status XRRSetScreenConfig \^(\^Display *\fIdpy\fP, 
+       XRRScreenConfiguration *\fIconfig\fP,
+       Drawable \fIdraw\fP,
+       int \fIsize_index\fP,
+       Rotation \fIrotation\fP,
+       Time \fItimestamp\fP\^);
+.sp
+Status XRRSetScreenConfigAndRate \^(\^Display *\fIdpy\fP, 
+                                 XRRScreenConfiguration *\fIconfig\fP,
+                                 Drawable \fIdraw\fP,
+                                 int \fIsize_index\fP,
+                                 Rotation \fIrotation\fP,
+                                 short \fIrate\fP,
+                                 Time \fItimestamp\fP\^);
+.sp
+Rotation XRRConfigRotations\^(\^
+       XRRScreenConfiguration *\fIconfig\fP, 
+       Rotation *\fIcurrent_rotation\fP\^);
+.sp
+Time XRRConfigTimes \^(\^
+       XRRScreenConfiguration *\fIconfig\fP, 
+       Time *\fIconfig_timestamp\fP\^);
+.sp
+XRRScreenSize *XRRConfigSizes\^(\^
+       XRRScreenConfiguration *\fIconfig\fP, 
+       int *\fInsizes\fP\^);
+.sp
+short *XRRConfigRates \^(\^
+       XRRScreenConfiguration *\fIconfig\fP, 
+       int \fIsize_index\fP, 
+       int *\fInrates\fP\^);
+.sp
+SizeID XRRConfigCurrentConfiguration \^(\^
+       XRRScreenConfiguration *\fIconfig\fP, 
+       Rotation *\fIrotation\fP\^);
+.sp
+short XRRConfigCurrentRate \^(\^
+       XRRScreenConfiguration *\fIconfig\fP\^);    
+.sp
+int XRRRootToScreen\^(\^
+       Display *\fIdpy\fP, 
+       Window \fIroot\fP\^);
+.sp
+void XRRSelectInput\^(\^Display *\fIdpy\fP, Window \fIwindow\fP, int \fImask\fP\^);
+.sp
+/\(** 
+ * intended to take RRScreenChangeNotify,  or 
+ * ConfigureNotify \^(\^\fIon the root window\fP\^)
+ * returns 1 if it is an event type it understands, 0 if not
+ */
+int XRRUpdateConfiguration\^(\^XEvent *\fIevent\fP^);
+.sp
+/\(** 
+ * the following are always safe to call, even if RandR is 
+ * not implemented on a screen 
+ */
+.br
+Rotation XRRRotations\^(\^
+       Display *\fIdpy\fP, int \fIscreen\fP, 
+       Rotation *\fIcurrent_rotation\fP\^);
+.sp
+XRRScreenSize *XRRSizes\^(\^Display *\fIdpy\fP, 
+       int \fIscreen\fP, int *\fInsizes\fP\^);
+.sp
+short *XRRRates \^(\^Display *\fIdpy\fP, int \fIscreen\fP, 
+       int \fIsize_index\fP, int *\fInrates\fP\^);
+.sp
+Time XRRTimes \^(\^Display *\fIdpy\fP, int \fIscreen\fP, Time *\fIconfig_timestamp\fP\^);
+.fi
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server.
+.IP \fIscreen\fP 1i
+Specifies which screen.
+.IP \fIdraw\fP 1i
+Specifies the screen.
+.IP \fIrotation\fP 1i
+Specifies the rotations or reflections possible of the screen.
+.IP \fIcurrent_rotation\fP 1i
+Specifies the current rotations and reflection of the screen.
+.IP \fItimestamp\fP 1i
+Specifies the server timestamp.
+.IP \fIconfig_timestamp\fP 1i
+Specifies the timestamp when the screen was last (re)configured.
+.IP \fIconfig\fP 1i
+Specifies the screen configuration being used.
+.IP \fIsizes\fP 1i
+Specifies the array of sizes supported.
+.IP \fIrate\fP 1i
+Specifies the refresh rate in Hz.
+
+.SH DATATYPES
+
+.PP
+.B Rotations/Reflections
+.PP
+Can be any of:
+.nf
+\&#define RR_Rotate_0             1
+\&#define RR_Rotate_90            2
+\&#define RR_Rotate_180           4
+\&#define RR_Rotate_270           8
+
+/\(** new in 1.0 protocol, to allow reflection of screen */
+/\(** reflection is applied after rotation */
+
+\&#define RR_Reflect_X            16
+\&#define RR_Reflect_Y            32
+
+
+typedef struct {
+    int        width, height;
+    int        mwidth, mheight;
+} XRRScreenSize;
+
+typedef struct {
+    int type;                          /\(** event base */
+    unsigned long serial;      /\(** # of last request processed by server */
+    Bool send_event;           /\(** true if this came from a SendEvent request */
+    Display *display;          /\(** Display the event was read from */
+    Window window;                     /\(** window which selected for this event */
+    Window root;                       /\(** Root window for changed screen */
+    Time timestamp;                    /\(** when the screen change occurred */
+    Time config_timestamp;     /\(** when the last configuration change */
+    SizeID size_index;
+    SubpixelOrder subpixel_order;
+    Rotation rotation;
+    int width;
+    int height;
+    int mwidth;
+    int mheight;
+} XRRScreenChangeNotifyEvent;
+.sp
+.fi
+.B XRRScreenSize
+structure contains a possible root size in pixels and in millimeters.
+.B XRRScreenChangeNotifyEvent
+Is sent to a client that has requested notification whenever the screen
+configuration is changed.
+
+.B XRRScreenConfiguration
+This is an opaque data type containing the configuration information
+for a screen.
+
+.B Timestamps
+.PP
+Time stamps are included and must be used to ensure the client is playing
+with a full deck: the screen may change properties
+on the fly and this ensures its knowledge of the configuration is up to date.
+This is to help issues when screens may become hot-pluggable in the future.
+
+.SH DESCRIPTION
+.B Xrandr
+is a simple library designed to interface the X Resize and Rotate
+Extension.  This allows clients to change the size and rotation of the
+root window of a screen, along with the ability to reflect the screen
+about either axis (if supported by the implementation).  Rotation and
+reflection may be implemented by software and may result in slower
+performance if rotation and reflection are implemented in this fashion 
+(as are all implementations as of October 2002).
+.PP
+The Xrandr library does some minimal caching to avoid roundtrips to
+provide clients frequently used information.  See "The X Resize and
+Rotate Extension" for a detailed description; also note that depth
+switching, as described in the document is not implemented, and may
+(or may not) ever be implemented, as display memory is growing rapidly,
+and toolkits are already beginning to support migration, mitigating the
+need for depth switching.  If it is implemented in the future, we
+expect to do so via an upward compatible extension to the
+current library/protocol; functionality described here should continue
+to work.
+.PP
+Rotation and reflection and how they interact can be confusing.  In
+Randr, the coordinate system is rotated in a counter-clockwise
+direction relative to the normal orientation.  Reflection is along the
+window system coordinate system, not the physical screen X and Y axis,
+so that rotation and reflection do not interact.  The other way to
+consider reflection is to is specified in the "normal" orientation,
+before rotation, if you find the other way confusing.
+.PP
+The 
+.B XRRScreenChangeNotify 
+event is sent to clients that ask to be informed whenever the root window
+configuration changes.  Configuration changes may include resolution,
+physical size, subpixel order (see XRender(3)), and rotation.  Note
+that changes to any or all of these could occur due to external events
+(user control in the X server, a different monitor/flat panel display
+being hot-plugged) and is not only the result of a protocol/library
+request to the X server.
+.PP
+Additionally, to eliminate a potential race condition, 
+this event may be generated
+immediately upon selecting for notification if the screen has changed
+since the client of Xrandr connected to the X server, to enable
+reliable screen resolution changing when a user may log in and
+change the configuration while one or many clients are starting up.
+.PP
+.B Xlib notification
+.PP
+Clients must call back into Xlib using
+.B XRRUpdateConfiguration
+when screen configuration change notify events are generated
+(or root window configuration changes occur, to update Xlib's
+view of the resolution, size, rotation, reflection or subpixel order.
+Generally, toolkits will perform this operation on behalf of applications;
+we did not want to change display structure data behind the back of toolkits,
+as in multithreaded clients, various race conditions might occur.
+Toolkits should provide clients some mechanism for notification of
+screen change, of course.
+
+.SH FUNCTIONS
+There are two classes of interfaces: those which can be safely called
+even if RandR is not implemented on a screen (to make common idioms not
+dependent on the server having support), and those which will return
+errors if the extension is not present.
+.PP
+.B XRRRotations
+returns both the possible set of rotations/reflections supported
+(as a bitmask) as the value of the function, along with the current
+rotation/reflection of the screen.
+.PP
+.B XRRSizes
+returns the size and a pointer to the current sizes supported by
+the specified screen.  The first size specified is the default size
+of the server. If RandR is not supported, it returns 0 for
+the number of sizes.
+.PP
+.B XRRRates
+returns a pointer to a the rates supported by the specified size.
+If RandR is not supported, it returns 0 for the number of rates.
+.PP
+.B XRRTimes
+returns the time last reported by the server along with the
+timestamp the last configuration changed.
+If the configuration has changed since the client last updated
+its view of the server time, requests to change the configuration
+will fail until the client has an up to date timestamp.
+.PP
+.B XRRRootToScreen
+returns the screen number given a root window (for example, from
+an \fBXRRScreenChangeNotifyEvent\fI.
+.PP
+The rest of the functions will fail if applied to screens not
+implementing the RandR extension.
+.B XRRSetScreenConfig
+sets the screen size and rotation and reflection to the desired
+values on the screen specified by \fIdraw\fP, or returns a
+.B BadValue
+error.
+\fIsize_index\fP specifies which size configuration is to be used,
+\fIrotation\fP specifies which rotation or reflection is to
+be used (or a 
+.B BadValue
+error is returned).
+The \fItimestamp\fP is used by the server to make sure the client
+has up to date configuration information. Status is returned
+to indicate success or failure; a client must refresh its configuration
+information if it fails and try the call again (by calling 
+\fBXRRGetScreenInfo\fP).
+.PP
+.B XRRSetScreenConfigAndRate
+like
+.B XRRSetScreenConfig
+but also set the refresh rate. If specified rate is not supported a
+.B BadValue
+error is returned.
+.PP
+.B XRRConfigRotations,
+.B XRRConfigSizes,
+.B XRRConfigCurrentConfiguration,
+.B XRRConfigTimes,
+.B XRRConfigRates,
+and
+.B XRRConfigCurrentRate
+are used to get specific configuration information out of a screen
+configuration.
+.PP
+.B XRRGetScreenInfo
+Returns a screen configuration for later use; the information is
+private to the library.
+Call
+.B XRRFreeScreenConfigInfo
+to free this information when you are finished with it.
+It forces a round trip to the server.
+
+Other functions include:
+.B XRRQueryExtension
+which returns the event and error base codes,
+.B XRRQueryVersion
+, which returns the current version of the extension (this information
+is cached by the library).
+.SH RESTRICTIONS
+.B Xrandr
+will remain upward compatible after the current 1.0 release.
+.SH AUTHOR
+Jim Gettys, and Keith Packard, HP.
+
diff --git a/packaging/libXrandr.spec b/packaging/libXrandr.spec
new file mode 100644 (file)
index 0000000..5f7fcce
--- /dev/null
@@ -0,0 +1,76 @@
+
+Name:       libXrandr
+Summary:    X.Org X11 libXrandr runtime library
+Version:    1.3.1
+Release:    1
+Group:      System/Libraries
+License:    MIT
+URL:        http://www.x.org/
+Source0:    http://xorg.freedesktop.org/releases/individual/lib/%{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires:  pkgconfig(randrproto) >= 1.3
+BuildRequires:  pkgconfig(xproto)
+BuildRequires:  pkgconfig(xextproto)
+BuildRequires:  pkgconfig(randrproto)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(xrender)
+BuildRequires:  pkgconfig(xorg-macros)
+
+
+%description
+Xorg libXrandr runtime library
+
+
+%package devel
+Summary:    Development components for the libXrandr library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+Requires:   libXrender-devel
+
+%description devel
+Xorg libXrandr development package
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+
+%build
+
+%reconfigure --disable-static
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+
+
+
+%files
+%defattr(-,root,root,-)
+%doc COPYING
+%{_libdir}/libXrandr.so.2
+%{_libdir}/libXrandr.so.2.2.0
+
+
+%files devel
+%defattr(-,root,root,-)
+%doc AUTHORS ChangeLog
+%dir %{_includedir}/X11
+%dir %{_includedir}/X11/extensions
+%{_includedir}/X11/extensions/Xrandr.h
+%{_libdir}/libXrandr.so
+%{_libdir}/pkgconfig/xrandr.pc
+%doc %{_mandir}/man3/*.3*
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100755 (executable)
index 0000000..85b05da
--- /dev/null
@@ -0,0 +1,25 @@
+lib_LTLIBRARIES = libXrandr.la
+
+libXrandr_la_SOURCES =         \
+       Xrandr.c        \
+       Xrandrint.h     \
+       XrrConfig.c     \
+       XrrCrtc.c       \
+       XrrMode.c       \
+       XrrOutput.c     \
+       XrrProperty.c   \
+       XrrScreen.c
+
+libXrandr_la_LIBADD = @RANDR_LIBS@
+
+AM_CFLAGS = \
+       $(RANDR_CFLAGS) \
+       $(MALLOC_ZERO_CFLAGS) \
+       $(CWARNFLAGS)
+
+INCLUDES = -I$(top_srcdir)/include/X11/extensions
+
+libXrandr_la_LDFLAGS = -version-number 2:2:0 -no-undefined
+
+libXrandrincludedir = $(includedir)/X11/extensions
+libXrandrinclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xrandr.h 
diff --git a/src/Xrandr.c b/src/Xrandr.c
new file mode 100644 (file)
index 0000000..8ab1eae
--- /dev/null
@@ -0,0 +1,450 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett Packard Company, Inc.
+ *
+ * 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 Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.  HP makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
+ * 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.
+ *
+ * Author:  Jim Gettys, HP Labs, HP.
+ */
+
+#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"
+
+static XExtensionInfo XRRExtensionInfo;
+_X_HIDDEN char XRRExtensionName[] = RANDR_NAME;
+
+static Bool     XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire);
+static Status   XRREventToWire(Display *dpy, XEvent *event, xEvent *wire);
+
+static int
+XRRCloseDisplay (Display *dpy, XExtCodes *codes);
+
+static /* const */ XExtensionHooks rr_extension_hooks = {
+    NULL,                              /* create_gc */
+    NULL,                              /* copy_gc */
+    NULL,                              /* flush_gc */
+    NULL,                              /* free_gc */
+    NULL,                              /* create_font */
+    NULL,                              /* free_font */
+    XRRCloseDisplay,                   /* close_display */
+    XRRWireToEvent,                    /* wire_to_event */
+    XRREventToWire,                    /* event_to_wire */
+    NULL,                              /* error */
+    NULL,                              /* error_string */
+};
+
+static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
+{
+    XExtDisplayInfo *info = XRRFindDisplay(dpy);
+
+    RRCheckExtension(dpy, info, False);
+
+    switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
+    {
+      case RRScreenChangeNotify: {
+       XRRScreenChangeNotifyEvent *aevent= (XRRScreenChangeNotifyEvent *) event;
+       xRRScreenChangeNotifyEvent *awire = (xRRScreenChangeNotifyEvent *) wire;
+       aevent->type = awire->type & 0x7F;
+       aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+       aevent->send_event = (awire->type & 0x80) != 0;
+       aevent->display = dpy;
+       aevent->window = awire->window;
+       aevent->root = awire->root;
+       aevent->timestamp = awire->timestamp;
+       aevent->config_timestamp = awire->configTimestamp;
+       aevent->size_index = awire->sizeID;
+       aevent->subpixel_order = awire->subpixelOrder;
+       aevent->rotation = awire->rotation;
+       aevent->width = awire->widthInPixels;
+       aevent->height = awire->heightInPixels;
+       aevent->mwidth = awire->widthInMillimeters;
+       aevent->mheight = awire->heightInMillimeters;
+       return True;
+      }
+      case RRNotify: {
+       switch (wire->u.u.detail) {
+       case RRNotify_OutputChange: {
+           XRROutputChangeNotifyEvent *aevent = (XRROutputChangeNotifyEvent *) event;
+           xRROutputChangeNotifyEvent *awire = (xRROutputChangeNotifyEvent *) wire;
+           aevent->type = awire->type & 0x7F;
+           aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+           aevent->send_event = (awire->type & 0x80) != 0;
+           aevent->display = dpy;
+           aevent->window = awire->window;
+           aevent->subtype = awire->subCode;
+           aevent->output = awire->output;
+           aevent->crtc = awire->crtc;
+           aevent->mode = awire->mode;
+           aevent->rotation = awire->rotation;
+           aevent->connection = awire->connection;
+           aevent->subpixel_order = awire->subpixelOrder;
+           return True;
+       }
+       case RRNotify_CrtcChange: {
+           XRRCrtcChangeNotifyEvent *aevent = (XRRCrtcChangeNotifyEvent *) event;
+           xRRCrtcChangeNotifyEvent *awire = (xRRCrtcChangeNotifyEvent *) wire;
+           aevent->type = awire->type & 0x7F;
+           aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+           aevent->send_event = (awire->type & 0x80) != 0;
+           aevent->display = dpy;
+           aevent->window = awire->window;
+           aevent->subtype = awire->subCode;
+           aevent->crtc = awire->crtc;
+           aevent->mode = awire->mode;
+           aevent->rotation = awire->rotation;
+           aevent->x = awire->x;
+           aevent->y = awire->y;
+           aevent->width = awire->width;
+           aevent->height = awire->height;
+           return True;
+       }
+       case RRNotify_OutputProperty: {
+           XRROutputPropertyNotifyEvent *aevent = (XRROutputPropertyNotifyEvent *) event;
+           xRROutputPropertyNotifyEvent *awire = (xRROutputPropertyNotifyEvent *) wire;
+           aevent->type = awire->type & 0x7F;
+           aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+           aevent->send_event = (awire->type & 0x80) != 0;
+           aevent->display = dpy;
+           aevent->window = awire->window;
+           aevent->subtype = awire->subCode;
+           aevent->output = awire->output;
+           aevent->property = awire->atom;
+           aevent->timestamp = awire->timestamp;
+           aevent->state = awire->state;
+           return True;
+       }
+
+           break;
+       }
+      }
+    }
+
+    return False;
+}
+
+static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire)
+{
+    XExtDisplayInfo *info = XRRFindDisplay(dpy);
+
+    RRCheckExtension(dpy, info, False);
+
+    switch ((event->type & 0x7F) - info->codes->first_event)
+    {
+      case RRScreenChangeNotify: {
+       xRRScreenChangeNotifyEvent *awire = (xRRScreenChangeNotifyEvent *) wire;
+       XRRScreenChangeNotifyEvent *aevent = (XRRScreenChangeNotifyEvent *) event;
+       awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
+       awire->rotation = (CARD8) aevent->rotation;
+       awire->sequenceNumber = aevent->serial & 0xFFFF;
+       awire->timestamp = aevent->timestamp;
+       awire->configTimestamp = aevent->config_timestamp;
+       awire->root = aevent->root;
+       awire->window = aevent->window;
+       awire->sizeID = aevent->size_index;
+       awire->subpixelOrder = aevent->subpixel_order;
+       awire->widthInPixels = aevent->width;
+       awire->heightInPixels = aevent->height;
+       awire->widthInMillimeters = aevent->mwidth;
+       awire->heightInMillimeters = aevent->mheight;
+       return True;
+      }
+      case RRNotify: {
+       xRRCrtcChangeNotifyEvent *awire = (xRRCrtcChangeNotifyEvent *) wire;
+       XRRNotifyEvent *aevent = (XRRNotifyEvent *) event;
+       awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
+       awire->sequenceNumber = aevent->serial & 0xFFFF;
+       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;
+           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;
+           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;
+           return True;
+       }
+       }
+      }
+    }
+    return False;
+}
+
+_X_HIDDEN XExtDisplayInfo *
+XRRFindDisplay (Display *dpy)
+{
+    XExtDisplayInfo *dpyinfo;
+    XRandRInfo *xrri;
+    int i, numscreens;
+
+    dpyinfo = XextFindDisplay (&XRRExtensionInfo, dpy);
+    if (!dpyinfo) {
+       dpyinfo = XextAddDisplay (&XRRExtensionInfo, dpy, 
+                                 XRRExtensionName,
+                                 &rr_extension_hooks,
+                                 RRNumberEvents, NULL);
+       numscreens = ScreenCount(dpy);
+       xrri = Xmalloc (sizeof(XRandRInfo) + 
+                                sizeof(char *) * numscreens);
+       xrri->config = (XRRScreenConfiguration **)(xrri + 1);
+       for(i = 0; i < numscreens; i++) 
+         xrri->config[i] = NULL;
+       xrri->major_version = -1;
+       dpyinfo->data = (char *) xrri;
+    }
+    return dpyinfo;
+}
+
+static int
+XRRCloseDisplay (Display *dpy, XExtCodes *codes)
+{
+    int i;
+    XRRScreenConfiguration **configs;
+    XExtDisplayInfo *info = XRRFindDisplay (dpy);
+    XRandRInfo *xrri;
+
+    LockDisplay(dpy);
+    /*
+     * free cached data
+     */
+    if (XextHasExtension(info)) {
+       xrri = (XRandRInfo *) info->data;
+       if (xrri) {
+           configs = xrri->config;
+
+           for (i = 0; i < ScreenCount(dpy); i++) {
+               if (configs[i] != NULL) XFree (configs[i]);
+           }
+           XFree (xrri);
+       }
+    }
+    UnlockDisplay(dpy);
+    return XextRemoveDisplay (&XRRExtensionInfo, dpy);
+}
+
+int XRRRootToScreen(Display *dpy, Window root)
+{
+  int snum;
+  for (snum = 0; snum < ScreenCount(dpy); snum++) {
+    if (RootWindow(dpy, snum) == root) return snum;
+  }
+  return -1;
+}
+
+
+Bool XRRQueryExtension (Display *dpy,
+                       int *event_base_return,
+                       int *error_base_return)
+{
+  XExtDisplayInfo *info = XRRFindDisplay (dpy);
+
+    if (XextHasExtension(info)) {
+       *event_base_return = info->codes->first_event;
+       *error_base_return = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+_X_HIDDEN Bool
+_XRRHasRates (int major, int minor)
+{
+    return major > 1 || (major == 1 && minor >= 1);
+}
+
+Status XRRQueryVersion (Display *dpy,
+                           int     *major_versionp,
+                           int     *minor_versionp)
+{
+    XExtDisplayInfo *info = XRRFindDisplay (dpy);
+    xRRQueryVersionReply rep;
+    xRRQueryVersionReq  *req;
+    XRandRInfo *xrri;
+
+    RRCheckExtension (dpy, info, 0);
+
+    xrri = (XRandRInfo *) info->data;
+
+    /* 
+     * only get the version information from the server if we don't have it already
+     */
+    if (xrri->major_version == -1) {
+      LockDisplay (dpy);
+      GetReq (RRQueryVersion, req);
+      req->reqType = info->codes->major_opcode;
+      req->randrReqType = X_RRQueryVersion;
+      req->majorVersion = RANDR_MAJOR;
+      req->minorVersion = RANDR_MINOR;
+      if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+      }
+      xrri->major_version = rep.majorVersion;
+      xrri->minor_version = rep.minorVersion;
+      xrri->has_rates = _XRRHasRates (xrri->major_version, xrri->minor_version);
+      UnlockDisplay (dpy);
+      SyncHandle ();
+    }
+    *major_versionp = xrri->major_version;
+    *minor_versionp = xrri->minor_version;
+    return 1;
+}
+
+_X_HIDDEN Bool
+_XRRVersionHandler (Display        *dpy,
+                       xReply      *rep,
+                       char        *buf,
+                       int         len,
+                       XPointer    data)
+{
+    xRRQueryVersionReply       replbuf;
+    xRRQueryVersionReply       *repl;
+    _XRRVersionState   *state = (_XRRVersionState *) data;
+
+    if (dpy->last_request_read != state->version_seq)
+       return False;
+    if (rep->generic.type == X_Error)
+    {
+       state->error = True;
+       return False;
+    }
+    repl = (xRRQueryVersionReply *)
+       _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len,
+                    (SIZEOF(xRRQueryVersionReply) - SIZEOF(xReply)) >> 2,
+                       True);
+    state->major_version = repl->majorVersion;
+    state->minor_version = repl->minorVersion;
+    return True;
+}
+
+/* 
+ * in protocol version 0.1, routine added to allow selecting for new events.
+ */
+
+void XRRSelectInput (Display *dpy, Window window, int mask)
+{
+    XExtDisplayInfo *info = XRRFindDisplay (dpy);
+    xRRSelectInputReq  *req;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    GetReq (RRSelectInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRSelectInput;
+    req->window = window;
+    req->enable = 0;
+    if (mask) req->enable = mask;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return;
+}
+
+int XRRUpdateConfiguration(XEvent *event)
+{
+    XRRScreenChangeNotifyEvent *scevent;
+    XConfigureEvent *rcevent;
+    Display *dpy = event->xany.display;
+    XExtDisplayInfo *info;
+    XRandRInfo *xrri;
+    int snum;
+
+    /* first, see if it is a vanilla configure notify event */
+    if (event->type == ConfigureNotify) {
+       rcevent = (XConfigureEvent *) event;
+       snum = XRRRootToScreen(dpy, rcevent->window);
+       if (snum != -1) {
+           dpy->screens[snum].width   = rcevent->width;
+           dpy->screens[snum].height  = rcevent->height;
+           return 1;
+       }
+    }
+
+    info = XRRFindDisplay(dpy);
+    RRCheckExtension (dpy, info, 0);
+
+    switch (event->type - info->codes->first_event) {
+    case RRScreenChangeNotify:
+       scevent = (XRRScreenChangeNotifyEvent *) event;
+       snum = XRRRootToScreen(dpy, 
+                              ((XRRScreenChangeNotifyEvent *) event)->root);
+       if (scevent->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+               dpy->screens[snum].width   = scevent->height;
+               dpy->screens[snum].height  = scevent->width;
+               dpy->screens[snum].mwidth  = scevent->mheight;
+               dpy->screens[snum].mheight = scevent->mwidth;
+       } else {
+               dpy->screens[snum].width   = scevent->width;
+               dpy->screens[snum].height  = scevent->height;
+               dpy->screens[snum].mwidth  = scevent->mwidth;
+               dpy->screens[snum].mheight = scevent->mheight;
+       }
+       XRenderSetSubpixelOrder (dpy, snum, scevent->subpixel_order);
+       break;
+    default:
+       return 0;
+    }
+    xrri = (XRandRInfo *) info->data;
+    /* 
+     * so the next time someone wants some data, it will be fetched; 
+     * it might be better to force the round trip immediately, but 
+     * I dislike pounding the server simultaneously when not necessary
+     */
+    if (xrri->config[snum] != NULL) {
+       XFree (xrri->config[snum]);
+       xrri->config[snum] = NULL;
+    }
+    return 1;
+}
diff --git a/src/Xrandrint.h b/src/Xrandrint.h
new file mode 100755 (executable)
index 0000000..7fb5831
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2000, Compaq Computer Corporation, 
+ * Copyright © 2002, Hewlett Packard, Inc.
+ *
+ * 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 Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.  HP makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
+ * 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.
+ *
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ */
+
+#ifndef _XRANDRINT_H_
+#define _XRANDRINT_H_
+
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include "Xrandr.h"
+#include <X11/extensions/randr.h>
+#include <X11/extensions/randrproto.h>
+
+extern char XRRExtensionName[];
+
+#define RRCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, XRRExtensionName, val)
+#define RRSimpleCheckExtension(dpy,i) \
+  XextSimpleCheckExtension (dpy, i, XRRExtensionName)
+
+XExtDisplayInfo *XRRFindDisplay (Display *dpy);
+
+
+/* deliberately opaque internal data structure; can be extended, 
+   but not reordered */
+struct _XRRScreenConfiguration {
+  Screen *screen;      /* the root window in GetScreenInfo */
+  XRRScreenSize *sizes;
+  Rotation rotations;
+  Rotation current_rotation;
+  int nsizes;
+  int current_size;
+  short current_rate;
+  Time timestamp;
+  Time config_timestamp;
+  int subpixel_order;  /* introduced in randr v0.1 */
+  short *rates;                /* introduced in randr v1.1 */
+  int nrates;
+};
+
+/*
+ * if a configure notify on the root is recieved, or
+ * an XRRScreenChangeNotify is recieved,
+ * XRRUpdateConfiguration should be called to update the X library's
+ * view of the screen configuration; it will also invalidate the cache
+ * provided by XRRScreenConfig and XRRConfig, and force a round trip
+ * when next used.  Returns invalid status if not an event type
+ * the library routine understand.
+ */
+/* we cache one screen configuration/screen */
+
+typedef struct _XRandRInfo {
+  XRRScreenConfiguration **config;
+  int major_version, minor_version;    /* major_version = -1 means we don't know */
+  Bool has_rates;                      /* Server supports refresh rates */
+} XRandRInfo;
+
+typedef struct _randrVersionState {
+    unsigned long   version_seq;
+    Bool           error;
+    int                    major_version;
+    int                    minor_version;
+} _XRRVersionState;
+
+Bool
+_XRRVersionHandler (Display    *dpy,
+                   xReply      *rep,
+                   char        *buf,
+                   int         len,
+                   XPointer    data);
+
+_X_HIDDEN Bool
+_XRRHasRates (int major, int minor);
+
+#endif /* _XRANDRINT_H_ */
diff --git a/src/XrrConfig.c b/src/XrrConfig.c
new file mode 100755 (executable)
index 0000000..793d8b6
--- /dev/null
@@ -0,0 +1,434 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett Packard Company, Inc.
+ * Copyright © 2006 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.
+ *
+ * Author:  Jim Gettys, HP Labs, HP.
+ * Author:  Keith Packard, Intel Corporation
+ */
+
+#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"
+
+static XRRScreenConfiguration *_XRRGetScreenInfo (Display *dpy,
+                                                 XExtDisplayInfo *info,
+                                                 Window window);
+
+Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation)
+{
+  *current_rotation = config->current_rotation;
+  return config->rotations;
+}
+
+XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes)
+{
+   *nsizes = config->nsizes;
+  return config->sizes;
+}
+
+short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates)
+{
+    short   *r = config->rates;
+    int            nents = config->nrates;
+
+    /* Skip over the intervening rate lists */
+    while (sizeID > 0 && nents > 0)
+    {
+       int i = (*r + 1);
+       r += i;
+       nents -= i;
+       sizeID--;
+    }
+    if (!nents)
+    {
+       *nrates = 0;
+       return NULL;
+    }
+    *nrates = (int) *r;
+    return r + 1;
+}
+
+Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp)
+{
+    *config_timestamp = config->config_timestamp;
+    return config->timestamp;
+}
+
+
+SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config, 
+                             Rotation *rotation)
+{
+    *rotation = (Rotation) config->current_rotation;
+    return (SizeID) config->current_size;
+}
+
+short XRRConfigCurrentRate (XRRScreenConfiguration *config)
+{
+    return config->current_rate;
+}
+
+/* 
+ * Go get the screen configuration data and salt it away for future use; 
+ * returns NULL if extension not supported
+ */
+static XRRScreenConfiguration *_XRRValidateCache (Display *dpy, 
+                                                 XExtDisplayInfo *info,
+                                                 int screen)
+{
+    XRRScreenConfiguration **configs;
+    XRandRInfo *xrri;
+
+    if ((screen >= 0) && (screen < ScreenCount(dpy)) && XextHasExtension(info)) {
+       xrri = (XRandRInfo *) info->data;
+       configs = xrri->config;
+
+       if (configs[screen] == NULL)
+           configs[screen] = _XRRGetScreenInfo (dpy, info, RootWindow(dpy, screen));
+       return configs[screen];
+    } else {
+       return NULL;
+    }
+}
+
+/* given a screen, return the information from the (possibly) cached data */
+Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation)
+{
+  XRRScreenConfiguration *config;
+  XExtDisplayInfo *info = XRRFindDisplay(dpy);
+  Rotation cr;
+  LockDisplay(dpy);
+  if ((config = _XRRValidateCache(dpy, info, screen))) {
+    *current_rotation = config->current_rotation;
+    cr = config->rotations;
+    UnlockDisplay(dpy);
+    return cr;
+  }
+  else {
+    UnlockDisplay(dpy);
+    *current_rotation = RR_Rotate_0;
+    return 0;  /* no rotations supported */
+  }
+}
+
+/* given a screen, return the information from the (possibly) cached data */
+XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes)
+{
+  XRRScreenConfiguration *config; 
+  XExtDisplayInfo *info = XRRFindDisplay(dpy);
+  XRRScreenSize *sizes;
+
+  LockDisplay(dpy);
+  if ((config = _XRRValidateCache(dpy, info, screen))) {
+    *nsizes = config->nsizes;
+    sizes = config->sizes;
+    UnlockDisplay(dpy);
+    return sizes;
+    }
+  else {
+    UnlockDisplay(dpy);
+    *nsizes = 0;
+    return NULL;
+  }  
+}
+
+short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates)
+{
+  XRRScreenConfiguration *config; 
+  XExtDisplayInfo *info = XRRFindDisplay(dpy);
+  short *rates;
+
+  LockDisplay(dpy);
+  if ((config = _XRRValidateCache(dpy, info, screen))) {
+    rates = XRRConfigRates (config, sizeID, nrates);
+    UnlockDisplay(dpy);
+    return rates;
+    }
+  else {
+    UnlockDisplay(dpy);
+    *nrates = 0;
+    return NULL;
+  }  
+}
+
+/* given a screen, return the information from the (possibly) cached data */
+Time XRRTimes (Display *dpy, int screen, Time *config_timestamp)
+{
+  XRRScreenConfiguration *config; 
+  XExtDisplayInfo *info = XRRFindDisplay(dpy);
+  Time ts;
+
+  LockDisplay(dpy);
+  if ((config = _XRRValidateCache(dpy, info, screen))) {
+      *config_timestamp = config->config_timestamp;
+      ts = config->timestamp;
+      UnlockDisplay(dpy);
+      return ts;
+    } else {
+      UnlockDisplay(dpy);
+       return CurrentTime;
+    }
+}
+
+/* need a version that does not hold the display lock */
+static XRRScreenConfiguration *_XRRGetScreenInfo (Display *dpy,
+                                                 XExtDisplayInfo *info,
+                                                 Window window)
+{
+    xRRGetScreenInfoReply   rep;
+    xRRGetScreenInfoReq            *req;
+    _XAsyncHandler         async;
+    _XRRVersionState       async_state;
+    int                            nbytes, nbytesRead, rbytes;
+    int                            i;
+    xScreenSizes           size;
+    struct _XRRScreenConfiguration  *scp;
+    XRRScreenSize          *ssp;
+    short                  *rates;
+    xRRQueryVersionReq      *vreq;
+    XRandRInfo             *xrri;
+    Bool                   getting_version = False;
+
+    xrri = (XRandRInfo *) info->data;
+    if (!xrri)
+       return NULL;
+
+    if (xrri->major_version == -1)
+    {
+       /* hide a version query in the request */
+       GetReq (RRQueryVersion, vreq);
+       vreq->reqType = info->codes->major_opcode;
+       vreq->randrReqType = X_RRQueryVersion;
+       vreq->majorVersion = RANDR_MAJOR;
+       vreq->minorVersion = RANDR_MINOR;
+    
+       async_state.version_seq = dpy->request;
+       async_state.error = False;
+       async.next = dpy->async_handlers;
+       async.handler = _XRRVersionHandler;
+       async.data = (XPointer) &async_state;
+       dpy->async_handlers = &async;
+
+       getting_version = True;
+    }
+
+    GetReq (RRGetScreenInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetScreenInfo;
+    req->window = window;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       if (getting_version)
+           DeqAsyncHandler (dpy, &async);
+       SyncHandle ();
+       return NULL;
+    }
+    if (getting_version)
+    {
+       DeqAsyncHandler (dpy, &async);
+       if (async_state.error)
+       {
+           UnlockDisplay (dpy);
+           SyncHandle();
+           LockDisplay (dpy);
+       }
+       xrri->major_version = async_state.major_version;
+       xrri->minor_version = async_state.minor_version;
+       xrri->has_rates = _XRRHasRates (xrri->minor_version, xrri->major_version);
+    }
+
+    /*
+     * Make the reply compatible with v1.1
+     */
+    if (!xrri->has_rates)
+    {
+       rep.rate = 0;
+       rep.nrateEnts = 0;
+    }
+    
+    nbytes = (long) rep.length << 2;
+
+    nbytesRead = (long) (rep.nSizes * SIZEOF (xScreenSizes) +
+                        ((rep.nrateEnts + 1)& ~1) * 2 /* SIZEOF (CARD16) */);
+    
+    /* 
+     * 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 = sizeof (XRRScreenConfiguration) +
+      (rep.nSizes * sizeof (XRRScreenSize) +
+       rep.nrateEnts * sizeof (int));
+
+    scp = (struct _XRRScreenConfiguration *) Xmalloc(rbytes);
+    if (scp == NULL) {
+       _XEatData (dpy, (unsigned long) nbytes);
+       return NULL;
+    }
+
+
+    ssp = (XRRScreenSize *)(scp + 1);
+    rates = (short *) (ssp + rep.nSizes);
+
+    /* set up the screen configuration structure */
+    scp->screen = 
+      ScreenOfDisplay (dpy, XRRRootToScreen(dpy, rep.root));
+
+    scp->sizes = ssp;
+    scp->rates = rates;
+    scp->rotations = rep.setOfRotations;
+    scp->current_size = rep.sizeID;
+    scp->current_rate = rep.rate;
+    scp->current_rotation = rep.rotation;
+    scp->timestamp = rep.timestamp;
+    scp->config_timestamp = rep.configTimestamp;
+    scp->nsizes = rep.nSizes;
+    scp->nrates = rep.nrateEnts;
+
+    /*
+     * Time to unpack the data from the server.
+     */
+
+    /*
+     * First the size information
+     */
+    for (i = 0; i < rep.nSizes; i++)  {
+       _XReadPad (dpy, (char *) &size, SIZEOF (xScreenSizes));
+       
+        ssp[i].width = size.widthInPixels;
+       ssp[i].height = size.heightInPixels;
+       ssp[i].mwidth = size.widthInMillimeters;
+       ssp[i].mheight = size.heightInMillimeters;
+    }
+    /*
+     * And the rates
+     */
+    _XRead16Pad (dpy, rates, 2 /* SIZEOF (CARD16) */ * rep.nrateEnts);
+    
+    /*
+     * Skip any extra data
+     */
+    if (nbytes > nbytesRead)
+       _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+    
+    return (XRRScreenConfiguration *)(scp);
+}
+
+XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
+{
+    XRRScreenConfiguration *config;
+    XExtDisplayInfo *info = XRRFindDisplay(dpy);
+    XRRFindDisplay(dpy);
+    LockDisplay (dpy);
+    config = _XRRGetScreenInfo(dpy, info, window);
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return config;
+}
+
+    
+void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config)
+{
+    Xfree (config);
+}
+
+Status XRRSetScreenConfigAndRate (Display *dpy,
+                                 XRRScreenConfiguration *config,
+                                 Drawable draw,
+                                 int size_index,
+                                 Rotation rotation, 
+                                 short rate,
+                                 Time timestamp)
+{
+    XExtDisplayInfo *info = XRRFindDisplay (dpy);
+    xRRSetScreenConfigReply rep;
+    XRandRInfo *xrri;
+    int major, minor;
+
+    RRCheckExtension (dpy, info, 0);
+
+    /* Make sure has_rates is set */
+    if (!XRRQueryVersion (dpy, &major, &minor))
+       return 0;
+    
+    LockDisplay (dpy);
+    xrri = (XRandRInfo *) info->data;
+    if (xrri->has_rates)
+    {
+       xRRSetScreenConfigReq  *req;
+       GetReq (RRSetScreenConfig, req);
+       req->reqType = info->codes->major_opcode;
+       req->randrReqType = X_RRSetScreenConfig;
+       req->drawable = draw;
+       req->sizeID = size_index;
+       req->rotation = rotation;
+       req->timestamp = timestamp;
+       req->configTimestamp = config->config_timestamp;
+       req->rate = rate;
+    }
+    else
+    {
+       xRR1_0SetScreenConfigReq  *req;
+       GetReq (RR1_0SetScreenConfig, req);
+       req->reqType = info->codes->major_opcode;
+       req->randrReqType = X_RRSetScreenConfig;
+       req->drawable = draw;
+       req->sizeID = size_index;
+       req->rotation = rotation;
+       req->timestamp = timestamp;
+       req->configTimestamp = config->config_timestamp;
+    }
+    
+    (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;
+      config->timestamp = rep.newTimestamp;
+      config->screen = ScreenOfDisplay (dpy, XRRRootToScreen(dpy, rep.root));
+      config->current_size = size_index;
+      config->current_rotation = rotation;
+    }
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return(rep.status);
+}
+
+Status XRRSetScreenConfig (Display *dpy,
+                          XRRScreenConfiguration *config,
+                          Drawable draw,
+                          int size_index,
+                          Rotation rotation, Time timestamp)
+{
+    return XRRSetScreenConfigAndRate (dpy, config, draw, size_index,
+                                     rotation, 0, timestamp);
+}
diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c
new file mode 100755 (executable)
index 0000000..697987a
--- /dev/null
@@ -0,0 +1,553 @@
+/*
+ * Copyright © 2006 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"
+
+XRRCrtcInfo *
+XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRGetCrtcInfoReply            rep;
+    xRRGetCrtcInfoReq      *req;
+    int                            nbytes, nbytesRead, rbytes;
+    XRRCrtcInfo                    *xci;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay (dpy);
+    GetReq (RRGetCrtcInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetCrtcInfo;
+    req->crtc = crtc;
+    req->configTimestamp = resources->configTimestamp;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    nbytes = (long) rep.length << 2;
+
+    nbytesRead = (long) (rep.nOutput * 4 +
+                        rep.nPossibleOutput * 4);
+
+    /* 
+     * 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 = (sizeof (XRRCrtcInfo) +
+             rep.nOutput * sizeof (RROutput) +
+             rep.nPossibleOutput * sizeof (RROutput));
+
+    xci = (XRRCrtcInfo *) Xmalloc(rbytes);
+    if (xci == NULL) {
+       _XEatData (dpy, (unsigned long) nbytes);
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    xci->timestamp = rep.timestamp;
+    xci->x = rep.x;
+    xci->y = rep.y;
+    xci->width = rep.width;
+    xci->height = rep.height;
+    xci->mode = rep.mode;
+    xci->rotation = rep.rotation;
+    xci->noutput = rep.nOutput;
+    xci->outputs = (RROutput *) (xci + 1);
+    xci->rotations = rep.rotations;
+    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);
+    
+    /*
+     * Skip any extra data
+     */
+    if (nbytes > nbytesRead)
+       _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+    
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return (XRRCrtcInfo *) xci;
+}
+
+void
+XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo)
+{
+    Xfree (crtcInfo);
+}
+
+Status
+XRRSetCrtcConfig (Display *dpy,
+                 XRRScreenResources *resources,
+                 RRCrtc crtc,
+                 Time timestamp,
+                 int x, int y,
+                 RRMode mode,
+                 Rotation rotation,
+                 RROutput *outputs,
+                 int noutputs)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRSetCrtcConfigReply   rep;
+    xRRSetCrtcConfigReq            *req;
+
+    RRCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq (RRSetCrtcConfig, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRSetCrtcConfig;
+    req->length += noutputs;
+    req->crtc = crtc;
+    req->timestamp = timestamp;
+    req->configTimestamp = resources->configTimestamp;
+    req->x = x;
+    req->y = y;
+    req->mode = mode;
+    req->rotation = rotation;
+    Data32 (dpy, outputs, noutputs << 2);
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+       rep.status = RRSetConfigFailed;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return rep.status;
+}
+
+int
+XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRGetCrtcGammaSizeReply   rep;
+    xRRGetCrtcGammaSizeReq     *req;
+
+    RRCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq (RRGetCrtcGammaSize, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetCrtcGammaSize;
+    req->crtc = crtc;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+       rep.size = 0;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return rep.size;
+}
+
+XRRCrtcGamma *
+XRRGetCrtcGamma (Display *dpy, RRCrtc crtc)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRGetCrtcGammaReply    rep;
+    xRRGetCrtcGammaReq     *req;
+    XRRCrtcGamma           *crtc_gamma = NULL;
+    long                   nbytes;
+    long                   nbytesRead;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay(dpy);
+    GetReq (RRGetCrtcGamma, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetCrtcGamma;
+    req->crtc = crtc;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+       goto out;
+
+    nbytes = (long) rep.length << 2;
+    
+    /* three channels of CARD16 data */
+    nbytesRead = (rep.size * 2 * 3);
+
+    crtc_gamma = XRRAllocGamma (rep.size);
+    
+    if (!crtc_gamma)
+    {
+       _XEatData (dpy, (unsigned long) nbytes);
+       goto out;
+    }
+    _XRead16 (dpy, crtc_gamma->red, rep.size * 2);
+    _XRead16 (dpy, crtc_gamma->green, rep.size * 2);
+    _XRead16 (dpy, crtc_gamma->blue, rep.size * 2);
+    
+    if (nbytes > nbytesRead)
+       _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+
+out:
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return crtc_gamma;
+}
+
+XRRCrtcGamma *
+XRRAllocGamma (int size)
+{
+    XRRCrtcGamma    *crtc_gamma;
+
+    crtc_gamma = Xmalloc (sizeof (XRRCrtcGamma) +
+                         sizeof (crtc_gamma->red[0]) * size * 3);
+    if (!crtc_gamma)
+       return NULL;
+    crtc_gamma->size = size;
+    crtc_gamma->red = (unsigned short *) (crtc_gamma + 1);
+    crtc_gamma->green = crtc_gamma->red + size;
+    crtc_gamma->blue = crtc_gamma->green + size;
+    return crtc_gamma;
+}
+
+void
+XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *crtc_gamma)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRSetCrtcGammaReq     *req;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRSetCrtcGamma, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRSetCrtcGamma;
+    req->crtc = crtc;
+    req->size = crtc_gamma->size;
+    req->length += (crtc_gamma->size * 2 * 3 + 3) >> 2;
+    /*
+     * Note this assumes the structure was allocated with XRRAllocGamma,
+     * otherwise the channels might not be contiguous
+     */
+    Data16 (dpy, crtc_gamma->red, crtc_gamma->size * 2 * 3);
+    
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+void
+XRRFreeGamma (XRRCrtcGamma *crtc_gamma)
+{
+    Xfree (crtc_gamma);
+}
+
+/* Version 1.3 additions */
+
+static void
+XTransform_from_xRenderTransform (XTransform *x,
+                                 xRenderTransform *render)
+{
+    x->matrix[0][0] = render->matrix11;
+    x->matrix[0][1] = render->matrix12;
+    x->matrix[0][2] = render->matrix13;
+
+    x->matrix[1][0] = render->matrix21;
+    x->matrix[1][1] = render->matrix22;
+    x->matrix[1][2] = render->matrix23;
+
+    x->matrix[2][0] = render->matrix31;
+    x->matrix[2][1] = render->matrix32;
+    x->matrix[2][2] = render->matrix33;
+}
+
+static void
+xRenderTransform_from_XTransform (xRenderTransform *render,
+                                 XTransform *x)
+{
+    render->matrix11 = x->matrix[0][0];
+    render->matrix12 = x->matrix[0][1];
+    render->matrix13 = x->matrix[0][2];
+
+    render->matrix21 = x->matrix[1][0];
+    render->matrix22 = x->matrix[1][1];
+    render->matrix23 = x->matrix[1][2];
+
+    render->matrix31 = x->matrix[2][0];
+    render->matrix32 = x->matrix[2][1];
+    render->matrix33 = x->matrix[2][2];
+}
+
+void
+XRRSetCrtcTransform (Display   *dpy,
+                    RRCrtc     crtc, 
+                    XTransform *transform,
+                    char       *filter,
+                    XFixed     *params,
+                    int        nparams)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRSetCrtcTransformReq  *req;
+    int                            nbytes = strlen (filter);
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRSetCrtcTransform, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRSetCrtcTransform;
+    req->crtc = crtc;
+
+    xRenderTransform_from_XTransform (&req->transform, transform);
+
+    req->nbytesFilter = nbytes;
+    req->length += ((nbytes + 3) >> 2) + nparams;
+    Data (dpy, filter, nbytes);
+    Data32 (dpy, params, nparams << 2);
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+#define CrtcTransformExtra     (SIZEOF(xRRGetCrtcTransformReply) - 32)
+                               
+static const xRenderTransform identity = {
+    0x10000, 0, 0,
+    0, 0x10000, 0,
+    0, 0, 0x10000,
+};
+
+static Bool
+_XRRHasTransform (int major, int minor)
+{
+    return major > 1 || (major == 1 && minor >= 3);
+}
+
+Status
+XRRGetCrtcTransform (Display   *dpy,
+                    RRCrtc     crtc,
+                    XRRCrtcTransformAttributes **attributes)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRGetCrtcTransformReply   rep;
+    xRRGetCrtcTransformReq     *req;
+    int                                major_version, minor_version;
+    XRRCrtcTransformAttributes *attr;
+    char                       *extra = NULL, *e;
+    int                                p;
+
+    *attributes = NULL;
+
+    RRCheckExtension (dpy, info, False);
+
+    if (!XRRQueryVersion (dpy, &major_version, &minor_version) || 
+       !_XRRHasTransform (major_version, minor_version))
+    {
+       /* For pre-1.3 servers, just report identity matrices everywhere */
+       rep.pendingTransform = identity;
+       rep.pendingNbytesFilter = 0;
+       rep.pendingNparamsFilter = 0;
+       rep.currentTransform = identity;
+       rep.currentNbytesFilter = 0;
+       rep.currentNparamsFilter = 0;
+    }
+    else
+    {
+       LockDisplay (dpy);
+       GetReq (RRGetCrtcTransform, req);
+       req->reqType = info->codes->major_opcode;
+       req->randrReqType = X_RRGetCrtcTransform;
+       req->crtc = crtc;
+    
+       if (!_XReply (dpy, (xReply *) &rep, CrtcTransformExtra >> 2, xFalse))
+       {
+           rep.pendingTransform = identity;
+           rep.pendingNbytesFilter = 0;
+           rep.pendingNparamsFilter = 0;
+           rep.currentTransform = identity;
+           rep.currentNbytesFilter = 0;
+           rep.currentNparamsFilter = 0;
+       }
+       else
+       {
+           int extraBytes = rep.length * 4 - CrtcTransformExtra;
+           extra = Xmalloc (extraBytes);
+           if (!extra) {
+               _XEatData (dpy, extraBytes);
+               UnlockDisplay (dpy);
+               SyncHandle ();
+               return False;
+           }
+           _XRead (dpy, extra, extraBytes);
+       }
+
+       UnlockDisplay (dpy);
+       SyncHandle ();
+    }
+
+    attr = Xmalloc (sizeof (XRRCrtcTransformAttributes) +
+                   rep.pendingNparamsFilter * sizeof (XFixed) +
+                   rep.currentNparamsFilter * sizeof (XFixed) +
+                   rep.pendingNbytesFilter + 1 +
+                   rep.currentNbytesFilter + 1);
+
+    if (!attr) {
+       XFree (extra);
+       return False;
+    }
+    XTransform_from_xRenderTransform (&attr->pendingTransform, &rep.pendingTransform);
+    XTransform_from_xRenderTransform (&attr->currentTransform, &rep.currentTransform);
+
+    attr->pendingParams = (XFixed *) (attr + 1);
+    attr->currentParams = attr->pendingParams + rep.pendingNparamsFilter;
+    attr->pendingFilter = (char *) (attr->currentParams + rep.currentNparamsFilter);
+    attr->currentFilter = attr->pendingFilter + rep.pendingNbytesFilter + 1;
+
+    e = extra;
+
+    memcpy (attr->pendingFilter, e, rep.pendingNbytesFilter);
+    attr->pendingFilter[rep.pendingNbytesFilter] = '\0';
+    e += (rep.pendingNbytesFilter + 3) & ~3;
+    for (p = 0; p < rep.pendingNparamsFilter; p++) {
+       INT32   f;
+       memcpy (&f, e, 4);
+       e += 4;
+       attr->pendingParams[p] = (XFixed) f;
+    }
+    attr->pendingNparams = rep.pendingNparamsFilter;
+
+    memcpy (attr->currentFilter, e, rep.currentNbytesFilter);
+    attr->currentFilter[rep.currentNbytesFilter] = '\0';
+    e += (rep.currentNbytesFilter + 3) & ~3;
+    for (p = 0; p < rep.currentNparamsFilter; p++) {
+       INT32   f;
+       memcpy (&f, e, 4);
+       e += 4;
+       attr->currentParams[p] = (XFixed) f;
+    }
+    attr->currentNparams = rep.currentNparamsFilter;
+
+    if (extra)
+       XFree (extra);
+    *attributes = attr;
+
+    return True;
+}
+
+XRRPanning *
+XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRGetPanningReply     rep;
+    xRRGetPanningReq       *req;
+    XRRPanning             *xp;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay (dpy);
+    GetReq (RRGetPanning, req);
+    req->reqType         = info->codes->major_opcode;
+    req->randrReqType    = X_RRGetPanning;
+    req->crtc            = crtc;
+
+    if (!_XReply (dpy, (xReply *) &rep, 1, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    if (! (xp = (XRRPanning *) Xmalloc(sizeof(XRRPanning))) ) {
+       _XEatData (dpy, sizeof(XRRPanning));
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    xp->timestamp     = rep.timestamp;
+    xp->left          = rep.left;
+    xp->top           = rep.top;
+    xp->width         = rep.width;
+    xp->height        = rep.height;
+    xp->track_left    = rep.track_left;
+    xp->track_top     = rep.track_top;
+    xp->track_width   = rep.track_width;
+    xp->track_height  = rep.track_height;
+    xp->border_left   = rep.border_left;
+    xp->border_top    = rep.border_top;
+    xp->border_right  = rep.border_right;
+    xp->border_bottom = rep.border_bottom;
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return (XRRPanning *) xp;
+}
+
+void
+XRRFreePanning (XRRPanning *panning)
+{
+    Xfree (panning);
+}
+
+Status
+XRRSetPanning (Display *dpy,
+               XRRScreenResources *resources,
+               RRCrtc crtc,
+               XRRPanning *panning)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRSetPanningReply      rep;
+    xRRSetPanningReq       *req;
+
+    RRCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq (RRSetPanning, req);
+    req->reqType       = info->codes->major_opcode;
+    req->randrReqType  = X_RRSetPanning;
+    req->crtc          = crtc;
+    req->timestamp     = panning->timestamp;
+    req->left          = panning->left;
+    req->top           = panning->top;
+    req->width         = panning->width;
+    req->height        = panning->height;
+    req->track_left    = panning->track_left;
+    req->track_top     = panning->track_top;
+    req->track_width   = panning->track_width;
+    req->track_height  = panning->track_height;
+    req->border_left   = panning->border_left;
+    req->border_top    = panning->border_top;
+    req->border_right  = panning->border_right;
+    req->border_bottom = panning->border_bottom;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+       rep.status = RRSetConfigFailed;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return rep.status;
+}
+
diff --git a/src/XrrMode.c b/src/XrrMode.c
new file mode 100644 (file)
index 0000000..58ef68b
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright © 2006 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"
+
+XRRModeInfo *
+XRRAllocModeInfo (char *name, int nameLength)
+{
+    XRRModeInfo        *mode_info;
+
+    mode_info = Xmalloc (sizeof (XRRModeInfo) + nameLength + 1);
+    if (!mode_info)
+       return NULL;
+    memset (mode_info, '\0', sizeof (XRRModeInfo));
+    mode_info->nameLength = nameLength;
+    mode_info->name = (char *) (mode_info + 1);
+    memcpy (mode_info->name, name, nameLength);
+    mode_info->name[nameLength] = '\0';
+    return mode_info;
+}
+
+RRMode
+XRRCreateMode (Display *dpy, Window window, XRRModeInfo *mode_info)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRCreateModeReq       *req;
+    xRRCreateModeReply     rep;
+
+    RRCheckExtension (dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq (RRCreateMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRCreateMode;
+    req->length += (mode_info->nameLength + 3) >> 2;
+    
+    req->window = window;
+    
+    req->modeInfo.id = 0;
+    req->modeInfo.width = mode_info->width;
+    req->modeInfo.height = mode_info->height;
+    req->modeInfo.dotClock = mode_info->dotClock;
+    req->modeInfo.hSyncStart = mode_info->hSyncStart;
+    req->modeInfo.hSyncEnd = mode_info->hSyncEnd;
+    req->modeInfo.hTotal = mode_info->hTotal;
+    req->modeInfo.hSkew = mode_info->hSkew;
+    req->modeInfo.vSyncStart = mode_info->vSyncStart;
+    req->modeInfo.vSyncEnd = mode_info->vSyncEnd;
+    req->modeInfo.vTotal = mode_info->vTotal;
+    req->modeInfo.nameLength = mode_info->nameLength;
+    req->modeInfo.modeFlags = mode_info->modeFlags;
+    
+    Data (dpy, mode_info->name, mode_info->nameLength);
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return None;
+    }
+    
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return rep.mode;
+}
+
+void
+XRRDestroyMode (Display *dpy, RRMode mode)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRDestroyModeReq      *req;
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRDestroyMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRDestroyMode;
+    req->mode = mode;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+void
+XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRAddOutputModeReq            *req;
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRAddOutputMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRAddOutputMode;
+    req->output = output;
+    req->mode = mode;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+void
+XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRDeleteOutputModeReq  *req;
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRDeleteOutputMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRDeleteOutputMode;
+    req->output = output;
+    req->mode = mode;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+void
+XRRFreeModeInfo (XRRModeInfo *modeInfo)
+{
+    Xfree (modeInfo);
+}
diff --git a/src/XrrOutput.c b/src/XrrOutput.c
new file mode 100644 (file)
index 0000000..18863bd
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Copyright © 2006 Keith Packard
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * 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"
+
+#define OutputInfoExtra        (SIZEOF(xRRGetOutputInfoReply) - 32)
+                               
+XRROutputInfo *
+XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRGetOutputInfoReply      rep;
+    xRRGetOutputInfoReq                *req;
+    int                                nbytes, nbytesRead, rbytes;
+    XRROutputInfo              *xoi;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay (dpy);
+    GetReq (RRGetOutputInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetOutputInfo;
+    req->output = output;
+    req->configTimestamp = resources->configTimestamp;
+
+    if (!_XReply (dpy, (xReply *) &rep, OutputInfoExtra >> 2, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    nbytes = ((long) (rep.length) << 2) - OutputInfoExtra;
+
+    nbytesRead = (long) (rep.nCrtcs * 4 +
+                        rep.nModes * 4 +
+                        rep.nClones * 4 +
+                        ((rep.nameLength + 3) & ~3));
+
+    /* 
+     * 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 = (sizeof (XRROutputInfo) +
+             rep.nCrtcs * sizeof (RRCrtc) +
+             rep.nModes * sizeof (RRMode) +
+             rep.nClones * sizeof (RROutput) +
+             rep.nameLength + 1);          /* '\0' terminate name */
+
+    xoi = (XRROutputInfo *) Xmalloc(rbytes);
+    if (xoi == NULL) {
+       _XEatData (dpy, (unsigned long) nbytes);
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    xoi->timestamp = rep.timestamp;
+    xoi->crtc = rep.crtc;
+    xoi->mm_width = rep.mmWidth;
+    xoi->mm_height = rep.mmHeight;
+    xoi->connection = rep.connection;
+    xoi->subpixel_order = rep.subpixelOrder;
+    xoi->ncrtc = rep.nCrtcs;
+    xoi->crtcs = (RRCrtc *) (xoi + 1);
+    xoi->nmode = rep.nModes;
+    xoi->npreferred = rep.nPreferred;
+    xoi->modes = (RRMode *) (xoi->crtcs + rep.nCrtcs);
+    xoi->nclone = rep.nClones;
+    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);
+    
+    /*
+     * Read name and '\0' terminate
+     */
+    _XReadPad (dpy, xoi->name, rep.nameLength);
+    xoi->name[rep.nameLength] = '\0';
+    
+    /*
+     * Skip any extra data
+     */
+    if (nbytes > nbytesRead)
+       _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+    
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return (XRROutputInfo *) xoi;
+}
+
+void
+XRRFreeOutputInfo (XRROutputInfo *outputInfo)
+{
+    Xfree (outputInfo);
+}
+
+static Bool
+_XRRHasOutputPrimary (int major, int minor)
+{
+    return major > 1 || (major == 1 && minor >= 3);
+}
+
+void
+XRRSetOutputPrimary(Display *dpy, Window window, RROutput output)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRSetOutputPrimaryReq  *req;
+    int                            major_version, minor_version;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    if (!XRRQueryVersion (dpy, &major_version, &minor_version) || 
+       !_XRRHasOutputPrimary (major_version, minor_version))
+       return;
+
+    LockDisplay(dpy);
+    GetReq (RRSetOutputPrimary, req);
+    req->reqType       = info->codes->major_opcode;
+    req->randrReqType  = X_RRSetOutputPrimary;
+    req->window        = window;
+    req->output               = output;
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+RROutput
+XRRGetOutputPrimary(Display *dpy, Window window)
+{
+    XExtDisplayInfo        *info = XRRFindDisplay(dpy);
+    xRRGetOutputPrimaryReq  *req;
+    xRRGetOutputPrimaryReply rep;
+    int                            major_version, minor_version;
+
+    RRCheckExtension (dpy, info, 0);
+
+    if (!XRRQueryVersion (dpy, &major_version, &minor_version) || 
+       !_XRRHasOutputPrimary (major_version, minor_version))
+       return None;
+
+    LockDisplay(dpy);
+    GetReq (RRGetOutputPrimary, req);
+    req->reqType       = info->codes->major_opcode;
+    req->randrReqType  = X_RRGetOutputPrimary;
+    req->window                = window;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+       rep.output = None;
+       
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return rep.output;
+}
diff --git a/src/XrrProperty.c b/src/XrrProperty.c
new file mode 100755 (executable)
index 0000000..1a125b2
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+ * Copyright © 2006 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"
+
+Atom *
+XRRListOutputProperties (Display *dpy, RROutput output, int *nprop)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRListOutputPropertiesReply rep;
+    xRRListOutputPropertiesReq *req;
+    int                                nbytes, rbytes;
+    Atom                       *props = NULL;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay (dpy);
+    GetReq (RRListOutputProperties, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRListOutputProperties;
+    req->output = output;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       *nprop = 0;
+       return NULL;
+    }
+
+    if (rep.nAtoms) {
+       rbytes = rep.nAtoms * sizeof (Atom);
+       nbytes = rep.nAtoms << 2;
+
+       props = (Atom *) Xmalloc (rbytes);
+       if (props == NULL) {
+           _XEatData (dpy, nbytes);
+           UnlockDisplay (dpy);
+           SyncHandle ();
+           *nprop = 0;
+           return NULL;
+       }
+
+       _XRead32 (dpy, props, nbytes);
+    }
+
+    *nprop = rep.nAtoms;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return props;
+}
+
+XRRPropertyInfo *
+XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRQueryOutputPropertyReply rep;
+    xRRQueryOutputPropertyReq  *req;
+    int                                rbytes, nbytes;
+    XRRPropertyInfo            *prop_info;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay (dpy);
+    GetReq (RRQueryOutputProperty, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRQueryOutputProperty;
+    req->output = output;
+    req->property = property;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    rbytes = sizeof (XRRPropertyInfo) + rep.length * sizeof (long);
+    nbytes = rep.length << 2;
+
+    prop_info = (XRRPropertyInfo *) Xmalloc (rbytes);
+    if (prop_info == NULL) {
+       _XEatData (dpy, nbytes);
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    prop_info->pending = rep.pending;
+    prop_info->range = rep.range;
+    prop_info->immutable = rep.immutable;
+    prop_info->num_values = rep.length;
+    if (rep.length != 0) {
+       prop_info->values = (long *) (prop_info + 1);
+       _XRead32 (dpy, prop_info->values, nbytes);
+    } else {
+       prop_info->values = NULL;
+    }
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return prop_info;
+}
+
+void
+XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,
+                           Bool pending, Bool range, int num_values,
+                           long *values)
+{
+    XExtDisplayInfo                *info = XRRFindDisplay(dpy);
+    xRRConfigureOutputPropertyReq   *req;
+    long len;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRConfigureOutputProperty, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRConfigureOutputProperty;
+    req->output = output;
+    req->property = property;
+    req->pending = pending;
+    req->range = range;
+
+    len = num_values;
+    if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+       SetReqLen(req, len, len);
+       len = (long)num_values << 2;
+       Data32 (dpy, values, len);
+    } /* else force BadLength */
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+                       
+void
+XRRChangeOutputProperty (Display *dpy, RROutput output,
+                        Atom property, Atom type,
+                        int format, int mode,
+                        _Xconst unsigned char *data, int nelements)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRChangeOutputPropertyReq *req;
+    long len;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq (RRChangeOutputProperty, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRChangeOutputProperty;
+    req->output = output;
+    req->property = property;
+    req->type = type;
+    req->mode = mode;
+    if (nelements < 0) {
+       req->nUnits = 0;
+       req->format = 0; /* ask for garbage, get garbage */
+    } else {
+       req->nUnits = nelements;
+       req->format = format;
+    }
+
+    switch (req->format) {
+    case 8:
+       len = ((long)nelements + 3) >> 2;
+       if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+           SetReqLen(req, len, len);
+           Data (dpy, (char *)data, nelements);
+       } /* else force BadLength */
+       break;
+
+    case 16:
+       len = ((long)nelements + 1) >> 1;
+       if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+           SetReqLen(req, len, len);
+           len = (long)nelements << 1;
+           Data16 (dpy, (short *) data, len);
+       } /* else force BadLength */
+       break;
+
+    case 32:
+       len = nelements;
+       if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+           SetReqLen(req, len, len);
+           len = (long)nelements << 2;
+           Data32 (dpy, (long *) data, len);
+       } /* else force BadLength */
+       break;
+
+    default:
+       /* BadValue will be generated */ ;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void
+XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRDeleteOutputPropertyReq *req;
+
+    RRSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq(RRDeleteOutputProperty, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRDeleteOutputProperty;
+    req->output = output;
+    req->property = property;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+int
+XRRGetOutputProperty (Display *dpy, RROutput output,
+                     Atom property, long offset, long length,
+                     Bool delete, Bool pending, Atom req_type, 
+                     Atom *actual_type, int *actual_format,
+                     unsigned long *nitems, unsigned long *bytes_after,
+                     unsigned char **prop)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRGetOutputPropertyReply  rep;
+    xRRGetOutputPropertyReq    *req;
+    long                       nbytes, rbytes;
+
+    RRCheckExtension (dpy, info, 1);
+
+    LockDisplay (dpy);
+    GetReq (RRGetOutputProperty, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetOutputProperty;
+    req->output = output;
+    req->property = property;
+    req->type = req_type;
+    req->longOffset = offset;
+    req->longLength = length;
+    req->delete = delete;
+    req->pending = pending;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return ((xError *)&rep)->errorCode;
+    }
+
+    *prop = (unsigned char *) NULL;
+    if (rep.propertyType != None) {
+       /*
+        * One extra byte is malloced than is needed to contain the property
+        * data, but this last byte is null terminated and convenient for
+        * returning string properties, so the client doesn't then have to
+        * recopy the string to make it null terminated.
+        */
+       switch (rep.format) {
+       case 8:
+           nbytes = rep.nItems;
+           rbytes = rep.nItems + 1;
+           if (rbytes > 0 &&
+               (*prop = (unsigned char *) Xmalloc ((unsigned)rbytes)))
+               _XReadPad (dpy, (char *) *prop, nbytes);
+           break;
+
+       case 16:
+           nbytes = rep.nItems << 1;
+           rbytes = rep.nItems * sizeof (short) + 1;
+           if (rbytes > 0 &&
+               (*prop = (unsigned char *) Xmalloc ((unsigned)rbytes)))
+               _XRead16Pad (dpy, (short *) *prop, nbytes);
+           break;
+
+       case 32:
+           nbytes = rep.nItems << 2;
+           rbytes = rep.nItems * sizeof (long) + 1;
+           if (rbytes > 0 &&
+               (*prop = (unsigned char *) Xmalloc ((unsigned)rbytes)))
+               _XRead32 (dpy, (long *) *prop, nbytes);
+           break;
+
+       default:
+           /*
+            * This part of the code should never be reached.  If it is,
+            * the server sent back a property with an invalid format.
+            */
+           nbytes = rep.length << 2;
+           _XEatData(dpy, (unsigned long) nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return(BadImplementation);
+       }
+       if (! *prop) {
+           _XEatData(dpy, (unsigned long) nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return(BadAlloc);
+       }
+       (*prop)[rbytes - 1] = '\0';
+    }
+
+    *actual_type = rep.propertyType;
+    *actual_format = rep.format;
+    *nitems = rep.nItems;
+    *bytes_after = rep.bytesAfter;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    return Success;
+}
diff --git a/src/XrrScreen.c b/src/XrrScreen.c
new file mode 100644 (file)
index 0000000..54bc2ca
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+ * Copyright © 2006 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"
+
+/*
+ * this is cheating on the knowledge that the two requests are identical
+ * but for the request number.
+ */
+static XRRScreenResources *
+doGetScreenResources (Display *dpy, Window window, int poll)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRGetScreenResourcesReply  rep;
+    xRRGetScreenResourcesReq   *req;
+    _XAsyncHandler             async;
+    _XRRVersionState           async_state;
+    int                                nbytes, nbytesRead, rbytes;
+    int                                i;
+    xRRQueryVersionReq         *vreq;
+    XRRScreenResources         *xrsr;
+    char                       *names;
+    char                       *wire_names, *wire_name;
+    Bool                       getting_version = False;
+    XRandRInfo                 *xrri;
+
+    RRCheckExtension (dpy, info, NULL);
+
+    LockDisplay (dpy);
+    xrri = (XRandRInfo *) info->data;
+
+    if (xrri->major_version == -1)
+    {
+       /* hide a version query in the request */
+       GetReq (RRQueryVersion, vreq);
+       vreq->reqType = info->codes->major_opcode;
+       vreq->randrReqType = X_RRQueryVersion;
+       vreq->majorVersion = RANDR_MAJOR;
+       vreq->minorVersion = RANDR_MINOR;
+    
+       async_state.version_seq = dpy->request;
+       async_state.error = False;
+       async.next = dpy->async_handlers;
+       async.handler = _XRRVersionHandler;
+       async.data = (XPointer) &async_state;
+       dpy->async_handlers = &async;
+
+       getting_version = True;
+    }
+
+    GetReq (RRGetScreenResources, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = poll ? X_RRGetScreenResources
+                            : X_RRGetScreenResourcesCurrent;
+    req->window = window;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       if (getting_version)
+           DeqAsyncHandler (dpy, &async);
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+    if (getting_version)
+    {
+       DeqAsyncHandler (dpy, &async);
+       if (async_state.error)
+       {
+           UnlockDisplay (dpy);
+           SyncHandle();
+           LockDisplay (dpy);
+       }
+       xrri->major_version = async_state.major_version;
+       xrri->minor_version = async_state.minor_version;
+       xrri->has_rates = _XRRHasRates (xrri->minor_version, xrri->major_version);
+    }
+
+    nbytes = (long) rep.length << 2;
+
+    nbytesRead = (long) (rep.nCrtcs * 4 +
+                        rep.nOutputs * 4 +
+                        rep.nModes * SIZEOF (xRRModeInfo) +
+                        ((rep.nbytesNames + 3) & ~3));
+
+    /* 
+     * 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 = (sizeof (XRRScreenResources) +
+             rep.nCrtcs * sizeof (RRCrtc) +
+             rep.nOutputs * sizeof (RROutput) +
+             rep.nModes * sizeof (XRRModeInfo) +
+             rep.nbytesNames + rep.nModes);    /* '\0' terminate names */
+
+    xrsr = (XRRScreenResources *) Xmalloc(rbytes);
+    wire_names = (char *) Xmalloc (rep.nbytesNames);
+    if (xrsr == NULL || wire_names == NULL) {
+       if (xrsr) Xfree (xrsr);
+       if (wire_names) Xfree (wire_names);
+       _XEatData (dpy, (unsigned long) nbytes);
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return NULL;
+    }
+
+    xrsr->timestamp = rep.timestamp;
+    xrsr->configTimestamp = rep.configTimestamp;
+    xrsr->ncrtc = rep.nCrtcs;
+    xrsr->crtcs = (RRCrtc *) (xrsr + 1);
+    xrsr->noutput = rep.nOutputs;
+    xrsr->outputs = (RROutput *) (xrsr->crtcs + rep.nCrtcs);
+    xrsr->nmode = rep.nModes;
+    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);
+    
+    for (i = 0; i < rep.nModes; i++)  {
+       xRRModeInfo modeInfo;
+       
+       _XReadPad (dpy, (char *) &modeInfo, SIZEOF (xRRModeInfo));
+       xrsr->modes[i].id = modeInfo.id;
+       xrsr->modes[i].width = modeInfo.width;
+       xrsr->modes[i].height = modeInfo.height;
+       xrsr->modes[i].dotClock = modeInfo.dotClock;
+       xrsr->modes[i].hSyncStart = modeInfo.hSyncStart;
+       xrsr->modes[i].hSyncEnd = modeInfo.hSyncEnd;
+       xrsr->modes[i].hTotal = modeInfo.hTotal;
+       xrsr->modes[i].hSkew = modeInfo.hSkew;
+       xrsr->modes[i].vSyncStart = modeInfo.vSyncStart;
+       xrsr->modes[i].vSyncEnd = modeInfo.vSyncEnd;
+       xrsr->modes[i].vTotal = modeInfo.vTotal;
+       xrsr->modes[i].nameLength = modeInfo.nameLength;
+       xrsr->modes[i].modeFlags = modeInfo.modeFlags;
+    }
+
+    /*
+     * Read names and '\0' pad each one
+     */
+    _XReadPad (dpy, wire_names, rep.nbytesNames);
+    wire_name = wire_names;
+    for (i = 0; i < rep.nModes; i++)  {
+       xrsr->modes[i].name = names;
+       memcpy (names, wire_name, xrsr->modes[i].nameLength);
+       names[xrsr->modes[i].nameLength] = '\0';
+       names += xrsr->modes[i].nameLength + 1;
+       wire_name += xrsr->modes[i].nameLength;
+    }
+    Xfree (wire_names);
+    
+    /*
+     * Skip any extra data
+     */
+    if (nbytes > nbytesRead)
+       _XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
+    
+    UnlockDisplay (dpy);
+    SyncHandle();
+    return (XRRScreenResources *) xrsr;
+}
+
+XRRScreenResources *
+XRRGetScreenResources(Display *dpy, Window window)
+{
+    return doGetScreenResources(dpy, window, 1);
+}
+
+XRRScreenResources *
+XRRGetScreenResourcesCurrent(Display *dpy, Window window)
+{
+    return doGetScreenResources(dpy, window, 0);
+}
+
+void
+XRRFreeScreenResources (XRRScreenResources *resources)
+{
+    Xfree (resources);
+}
+
+Status
+XRRGetScreenSizeRange (Display *dpy, Window window,
+                      int *minWidth, int *minHeight,
+                      int *maxWidth, int *maxHeight)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRGetScreenSizeRangeReq   *req;
+    xRRGetScreenSizeRangeReply rep;
+
+    RRCheckExtension (dpy, info, 0);
+    LockDisplay (dpy);
+    GetReq (RRGetScreenSizeRange, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRGetScreenSizeRange;
+    req->window = window;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return False;
+    }
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    *minWidth = rep.minWidth;
+    *minHeight = rep.minHeight;
+    *maxWidth = rep.maxWidth;
+    *maxHeight = rep.maxHeight;
+   return True;
+}
+
+void
+XRRSetScreenSize (Display *dpy, Window window,
+                 int width, int height,
+                 int mmWidth, int mmHeight)
+{
+    XExtDisplayInfo            *info = XRRFindDisplay(dpy);
+    xRRSetScreenSizeReq                *req;
+
+    RRSimpleCheckExtension (dpy, info);
+    LockDisplay (dpy);
+    GetReq (RRSetScreenSize, req);
+    req->reqType = info->codes->major_opcode;
+    req->randrReqType = X_RRSetScreenSize;
+    req->window = window;
+    req->width = width;
+    req->height = height;
+    req->widthInMillimeters = mmWidth;
+    req->heightInMillimeters = mmHeight;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
diff --git a/xrandr.pc.in b/xrandr.pc.in
new file mode 100644 (file)
index 0000000..c691d17
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xrandr
+Description: X RandR Library
+Version: @VERSION@
+Requires: xproto randrproto >= @RANDR_VERSION@
+Requires.private: x11 xext xrender
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXrandr