This is copied directly from libXrandr with some tweaking based on xrandr configs.
Signed-off-by: Bryce Harrington <br...@canonical.com> --- .gitignore | 78 ++++++++++++++++++++++++++++++++++ Makefile.am | 37 ++++++++++++++++ autogen.sh | 12 +++++ configure.ac | 61 ++++++++++++++++++++++++++ man/Makefile.am | 19 ++++++++ man/XrandrUtils.man | 32 ++++++++++++++ src/Makefile.am | 18 ++++++++ xrandr-utils.pc.in | 12 +++++ 8 files changed, 269 insertions(+), 0 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 include/X11/extensions/XrandrUtils.h create mode 100644 man/Makefile.am create mode 100644 man/XrandrUtils.man create mode 100644 src/Makefile.am create mode 100644 src/XrandrUtils.c create mode 100644 xrandr-utils.pc.in diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b372cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,78 @@ +# +# X.Org module default exclusion patterns +# The next section is for module specific patterns +# +# Do not edit the following section +# GNU Build System (Autotools) +aclocal.m4 +autom4te.cache/ +autoscan.log +ChangeLog +compile +config.guess +config.h +config.h.in +config.log +config-ml.in +config.py +config.status +config.status.lineno +config.sub +configure +configure.scan +depcomp +.deps/ +INSTALL +install-sh +.libs/ +libtool +libtool.m4 +ltmain.sh +lt~obsolete.m4 +ltoptions.m4 +ltsugar.m4 +ltversion.m4 +Makefile +Makefile.in +mdate-sh +missing +mkinstalldirs +*.pc +py-compile +stamp-h? +symlink-tree +texinfo.tex +ylwrap + +# Do not edit the following section +# Edit Compile Debug Document Distribute +*~ +*.[0-9] +*.[0-9]x +*.bak +*.bin +core +*.dll +*.exe +*-ISO*.bdf +*-JIS*.bdf +*-KOI8*.bdf +*.kld +*.ko +*.ko.cmd +*.lai +*.l[oa] +*.[oa] +*.obj +*.patch +*.so +*.pcf.gz +*.pdb +*.tar.bz2 +*.tar.gz +# +# Add & Override patterns for libxrandr-utils +# +# Edit the following section as needed +# For example, !report.pc overrides *.pc. See 'man gitignore' +# diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1b5ac68 --- /dev/null +++ b/Makefile.am @@ -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 = man src + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xrandr-utils.pc + +MAINTAINERCLEANFILES = ChangeLog INSTALL + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..904cd67 --- /dev/null +++ b/autogen.sh @@ -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 100644 index 0000000..794ba19 --- /dev/null +++ b/configure.ac @@ -0,0 +1,61 @@ +# +# 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. +# + +# Initialize Autoconf +AC_PREREQ([2.60]) +# +# Version should match the current Randr version. XRRQueryVersion +# returns the version from randr.h, NOT the version we set here. But we +# try to keep these the same. Note that the library has an extra +# digit in the version number to track changes which don't affect the +# protocol, so Xrandr version l.n.m corresponds to protocol version l.n +# +AC_INIT([libXrandrUtils], [0.1.0], + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXrandrUtils]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) + +# Initialize Automake +AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_MAINTAINER_MODE + +# Initialize libtool +AC_PROG_LIBTOOL + +# 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 +XORG_CHECK_MALLOC_ZERO + +AC_CHECK_LIB(m,floor) + +# Obtain compiler/linker options for depedencies +PKG_CHECK_MODULES(RANDRUTILS, x11 xrandr >= 1.3 xrender xproto >= 7.0.17) + +AC_CONFIG_FILES([ + Makefile + man/Makefile + src/Makefile + xrandr-utils.pc]) +AC_OUTPUT diff --git a/include/X11/extensions/XrandrUtils.h b/include/X11/extensions/XrandrUtils.h new file mode 100644 index 0000000..e69de29 diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..ed64295 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,19 @@ + +libmandir = $(LIB_MAN_DIR) + +libman_PRE = \ + $(Xrandr_shadows:=.man) + +Xrandr_shadows = \ + XrandrUtils + +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/XrandrUtils.man b/man/XrandrUtils.man new file mode 100644 index 0000000..1258b81 --- /dev/null +++ b/man/XrandrUtils.man @@ -0,0 +1,32 @@ +.de TQ +.br +.ns +.TP \\$1 +.. +.TH XRANDR-UTILS __libmansuffix__ __vendorversion__ + +.SH NAME + XrandrUtils \- Wrapper library for libXrandr. +.SH SYNTAX +\&#include <X11/extensions/XrandrUtils.h> +.nf +.sp + +.SH DATATYPES + +typedef struct { +}; + +.SH DESCRIPTION +.B XrandrUtils +is a high level library designed to wrapper the Xrandr library with +a more convenient API for doing common screen configuration operations. + +.SH FUNCTIONS +.PP + +.SH RESTRICTIONS +.B XrandrUtils +will remain upward compatible after the current 1.0 release. +.SH AUTHOR +Keith Packard, Intel; Bryce Harrington, Canonical. diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..1b22613 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,18 @@ +lib_LTLIBRARIES = libXrandrUtils.la + +libXrandrUtils_la_SOURCES = \ + XrandrUtils.c + +libXrandrUtils_la_LIBADD = @RANDRUTILS_LIBS@ + +AM_CFLAGS = \ + $(RANDRUTILS_CFLAGS) \ + $(MALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) + +INCLUDES = -I$(top_srcdir)/include/X11/extensions + +libXrandrUtils_la_LDFLAGS = -version-number 2:2:0 -no-undefined + +libXrandrUtilsincludedir = $(includedir)/X11/extensions +libXrandrUtilsinclude_HEADERS = $(top_srcdir)/include/X11/extensions/XrandrUtils.h diff --git a/src/XrandrUtils.c b/src/XrandrUtils.c new file mode 100644 index 0000000..e69de29 diff --git a/xrandr-utils.pc.in b/xrandr-utils.pc.in new file mode 100644 index 0000000..92eb049 --- /dev/null +++ b/xrandr-utils.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XrandrUtils +Description: X RandR Utils Library +Version: @VERSION@ +Requires: xrandr >= 1.3 +Requires.private: x11 xrender xproto >= 7.0.17 +Cflags: -I${includedir} +Libs: -L${libdir} -lXrandrUtils -- 1.7.4.1 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel