diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2016-03-06 13:37:22 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2016-03-06 13:37:22 +0000 |
commit | cd0778747371da9cf85661fce6e167344ade431f (patch) | |
tree | e3e908fbc9065e4841be0ec0149a389c4973ac76 | |
parent | e12bdab6b3d939f6bde7e0614d18cf217d0d5095 (diff) |
Update to libXrandr 1.5.0
-rw-r--r-- | lib/libXrandr/ChangeLog | 43 | ||||
-rw-r--r-- | lib/libXrandr/Makefile.bsd-wrapper | 4 | ||||
-rw-r--r-- | lib/libXrandr/Makefile.in | 4 | ||||
-rw-r--r-- | lib/libXrandr/aclocal.m4 | 61 | ||||
-rw-r--r-- | lib/libXrandr/compile | 347 | ||||
-rw-r--r-- | lib/libXrandr/configure | 153 | ||||
-rw-r--r-- | lib/libXrandr/configure.ac | 12 | ||||
-rw-r--r-- | lib/libXrandr/include/X11/extensions/Xrandr.h | 30 | ||||
-rw-r--r-- | lib/libXrandr/src/Makefile.am | 3 | ||||
-rw-r--r-- | lib/libXrandr/src/Makefile.in | 6 | ||||
-rw-r--r-- | lib/libXrandr/src/Xrandr.c | 82 | ||||
-rw-r--r-- | lib/libXrandr/src/Xrandrint.h | 14 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrCrtc.c | 4 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrMonitor.c | 200 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrOutput.c | 6 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrProperty.c | 2 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrProvider.c | 8 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrProviderProperty.c | 2 | ||||
-rw-r--r-- | lib/libXrandr/src/XrrScreen.c | 4 |
19 files changed, 490 insertions, 495 deletions
diff --git a/lib/libXrandr/ChangeLog b/lib/libXrandr/ChangeLog index c43ecd3dc..4587bfccb 100644 --- a/lib/libXrandr/ChangeLog +++ b/lib/libXrandr/ChangeLog @@ -1,3 +1,46 @@ +commit 4437436906cbba5121115e552d564262e8b4c784 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 16 01:55:30 2014 -0800 + + Add monitors, update to version 1.5 (v2) + + v2: [airlied] + xrandr was giving the outputs from 0 for each monitor instead of + incrementing the pointer. + add get_active support. + + Reviewed-by: Dave Airlie <airlied@redhat.com> + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7402eaa0185110a60cf4aae32d7b470c1372b45b +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 16 17:05:18 2014 -0800 + + libXrandr: Clean up compiler warnings + + This removes warnings about shadowing local variables with the same + name, and type mismatches with _XRead32. + + Reviewed-by: Dave Airlie <airlied@redhat.com> + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bc00b4fb0b52ed2f6f8544fa3b5da9693ee7ed90 +Author: Michael Joost <mehl@michael-joost.de> +Date: Mon Nov 18 16:11:26 2013 +0100 + + Remove fallback for _XEatDataWords, require libX11 1.6 for it + + _XEatDataWords was orignally introduced with the May 2013 security + patches, and in order to ease the process of delivering those, + fallback versions of _XEatDataWords were included in the X extension + library patches so they could be applied to older versions that didn't + have libX11 1.6 yet. Now that we're past that hurdle, we can drop + the fallbacks and just require libX11 1.6 for building new versions + of the extension libraries. + + Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit 30a7b506ae2071b8d265ce4eaeed1af60bc7ee7b Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Sep 7 21:50:49 2013 -0700 diff --git a/lib/libXrandr/Makefile.bsd-wrapper b/lib/libXrandr/Makefile.bsd-wrapper index 1e534403e..0eec47095 100644 --- a/lib/libXrandr/Makefile.bsd-wrapper +++ b/lib/libXrandr/Makefile.bsd-wrapper @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2013/08/13 07:07:17 guenther Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.6 2016/03/06 13:37:21 matthieu Exp $ -SHARED_LIBS= Xrandr 7.0 +SHARED_LIBS= Xrandr 7.1 .include <bsd.xorg.mk> diff --git a/lib/libXrandr/Makefile.in b/lib/libXrandr/Makefile.in index d8ebb6465..a6d70070d 100644 --- a/lib/libXrandr/Makefile.in +++ b/lib/libXrandr/Makefile.in @@ -75,8 +75,8 @@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/xrandr.pc.in $(top_srcdir)/configure AUTHORS COPYING \ - ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ - install-sh ltmain.sh missing + ChangeLog INSTALL config.guess config.sub depcomp install-sh \ + ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ diff --git a/lib/libXrandr/aclocal.m4 b/lib/libXrandr/aclocal.m4 index 91089525c..49909c9c1 100644 --- a/lib/libXrandr/aclocal.m4 +++ b/lib/libXrandr/aclocal.m4 @@ -9828,7 +9828,7 @@ dnl DEALINGS IN THE SOFTWARE. # See the "minimum version" comment for each macro you use to see what # version you require. m4_defun([XORG_MACROS_VERSION],[ -m4_define([vers_have], [1.17.1]) +m4_define([vers_have], [1.19.0]) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_if(m4_cmp(maj_have, maj_needed), 0,, @@ -9878,6 +9878,7 @@ if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then AC_MSG_RESULT([no]) else if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + TRADITIONALCPPFLAGS="-traditional" RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" AC_MSG_RESULT([yes]) else @@ -9886,6 +9887,7 @@ else fi rm -f conftest.$ac_ext AC_SUBST(RAWCPPFLAGS) +AC_SUBST(TRADITIONALCPPFLAGS) ]) # XORG_PROG_RAWCPP # XORG_MANPAGE_SECTIONS() @@ -10410,9 +10412,10 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) ]) # XORG_WITH_ASCIIDOC # XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) -# -------------------------------- +# ------------------------------------------- # Minimum version: 1.5.0 # Minimum version for optional DEFAULT argument: 1.11.0 +# Minimum version for optional DOT checking: 1.18.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the @@ -10432,6 +10435,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) # AC_DEFUN([XORG_WITH_DOXYGEN],[ AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) +AC_ARG_VAR([DOT], [Path to the dot graphics utility]) m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(doxygen, AS_HELP_STRING([--with-doxygen], @@ -10475,6 +10479,20 @@ m4_ifval([$1], AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) fi]) fi]) + +dnl Check for DOT if we have doxygen. The caller decides if it is mandatory +dnl HAVE_DOT is a variable that can be used in your doxygen.in config file: +dnl HAVE_DOT = @HAVE_DOT@ +HAVE_DOT=no +if test "x$have_doxygen" = "xyes"; then + AC_PATH_PROG([DOT], [dot]) + if test "x$DOT" != "x"; then + HAVE_DOT=yes + fi +fi + +AC_SUBST([HAVE_DOT]) +AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) ]) # XORG_WITH_DOXYGEN @@ -10657,6 +10675,29 @@ fi]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) ]) # XORG_WITH_FOP +# XORG_WITH_M4([MIN-VERSION]) +# --------------------------- +# Minimum version: 1.19.0 +# +# This macro attempts to locate an m4 macro processor which supports +# -I option and is only useful for modules relying on M4 in order to +# expand macros in source code files. +# +# Interface to module: +# M4: returns the path of the m4 program found +# returns the path set by the user in the environment +# +AC_DEFUN([XORG_WITH_M4], [ +AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4], + [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], + [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \ + ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], + [AC_MSG_ERROR([could not find m4 that supports -I option])], + [$PATH:/usr/gnu/bin])]) + +AC_SUBST([M4], [$ac_cv_path_M4]) +]) # XORG_WITH_M4 + # XORG_WITH_PS2PDF([DEFAULT]) # ---------------- # Minimum version: 1.6.0 @@ -11111,7 +11152,8 @@ AC_ARG_ENABLE(malloc0returnsnull, AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then - AC_RUN_IFELSE([AC_LANG_PROGRAM([ +AC_CACHE_VAL([xorg_cv_malloc0_returns_null], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include <stdlib.h> ],[ char *m0, *r0, *c0, *p; @@ -11121,9 +11163,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], - [MALLOC_ZERO_RETURNS_NULL=yes], - [MALLOC_ZERO_RETURNS_NULL=no], - [MALLOC_ZERO_RETURNS_NULL=yes]) + [xorg_cv_malloc0_returns_null=yes], + [xorg_cv_malloc0_returns_null=no])]) +MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) @@ -11412,7 +11454,7 @@ AC_LANG_CASE( XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) - XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) @@ -11421,16 +11463,17 @@ AC_LANG_CASE( XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) -XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. -# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidently get successful builds # when there are problems that should be fixed. diff --git a/lib/libXrandr/compile b/lib/libXrandr/compile deleted file mode 100644 index 531136b06..000000000 --- a/lib/libXrandr/compile +++ /dev/null @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# Written by Tom Tromey <tromey@cygnus.com>. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to <bug-automake@gnu.org> or send patches to -# <automake-patches@gnu.org>. - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to <bug-automake@gnu.org>. -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/lib/libXrandr/configure b/lib/libXrandr/configure index 7d91911da..b0556b21e 100644 --- a/lib/libXrandr/configure +++ b/lib/libXrandr/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libXrandr 1.4.2. +# Generated by GNU Autoconf 2.69 for libXrandr 1.5.0. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libXrandr' PACKAGE_TARNAME='libXrandr' -PACKAGE_VERSION='1.4.2' -PACKAGE_STRING='libXrandr 1.4.2' +PACKAGE_VERSION='1.5.0' +PACKAGE_STRING='libXrandr 1.5.0' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' PACKAGE_URL='' @@ -1347,7 +1347,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libXrandr 1.4.2 to adapt to many kinds of systems. +\`configure' configures libXrandr 1.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1417,7 +1417,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libXrandr 1.4.2:";; + short | recursive ) echo "Configuration of libXrandr 1.5.0:";; esac cat <<\_ACEOF @@ -1538,7 +1538,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libXrandr configure 1.4.2 +libXrandr configure 1.5.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1862,7 +1862,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libXrandr $as_me 1.4.2, which was +It was created by libXrandr $as_me 1.5.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2691,7 +2691,7 @@ fi # Define the identity of the package. PACKAGE='libXrandr' - VERSION='1.4.2' + VERSION='1.5.0' cat >>confdefs.h <<_ACEOF @@ -12769,6 +12769,55 @@ $as_echo "$supported" >&6; } fi fi + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -fd" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -fd" >&5 +$as_echo_n "checking if $CC supports -fd... " >&6; } + cacheid=xorg_cv_cc_flag__fd + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -fd" + found="yes" + fi + fi + @@ -13323,11 +13372,11 @@ found="no" CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi - CFLAGS="$CFLAGS -Wcast-qual" + CFLAGS="$CFLAGS -Wmissing-noreturn" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wcast-qual" >&5 -$as_echo_n "checking if $CC supports -Wcast-qual... " >&6; } - cacheid=xorg_cv_cc_flag__Wcast_qual + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-noreturn" >&5 +$as_echo_n "checking if $CC supports -Wmissing-noreturn... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_noreturn if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13358,7 +13407,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 $as_echo "$supported" >&6; } if test "$supported" = "yes" ; then - BASE_CFLAGS="$BASE_CFLAGS -Wcast-qual" + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-noreturn" found="yes" fi fi @@ -13441,11 +13490,11 @@ found="no" CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi - CFLAGS="$CFLAGS -Wmissing-noreturn" + CFLAGS="$CFLAGS -Wmissing-format-attribute" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-noreturn" >&5 -$as_echo_n "checking if $CC supports -Wmissing-noreturn... " >&6; } - cacheid=xorg_cv_cc_flag__Wmissing_noreturn + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-format-attribute" >&5 +$as_echo_n "checking if $CC supports -Wmissing-format-attribute... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_format_attribute if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13476,12 +13525,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 $as_echo "$supported" >&6; } if test "$supported" = "yes" ; then - BASE_CFLAGS="$BASE_CFLAGS -Wmissing-noreturn" + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-format-attribute" found="yes" fi fi +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) @@ -13559,11 +13609,11 @@ found="no" CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi - CFLAGS="$CFLAGS -Wmissing-format-attribute" + CFLAGS="$CFLAGS -Wlogical-op" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-format-attribute" >&5 -$as_echo_n "checking if $CC supports -Wmissing-format-attribute... " >&6; } - cacheid=xorg_cv_cc_flag__Wmissing_format_attribute + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wlogical-op" >&5 +$as_echo_n "checking if $CC supports -Wlogical-op... " >&6; } + cacheid=xorg_cv_cc_flag__Wlogical_op if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13594,7 +13644,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 $as_echo "$supported" >&6; } if test "$supported" = "yes" ; then - BASE_CFLAGS="$BASE_CFLAGS -Wmissing-format-attribute" + BASE_CFLAGS="$BASE_CFLAGS -Wlogical-op" found="yes" fi fi @@ -13604,9 +13654,9 @@ $as_echo "$supported" >&6; } # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. -# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidently get successful builds # when there are problems that should be fixed. @@ -17461,8 +17511,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc(0) returns NULL" >&5 $as_echo_n "checking whether malloc(0) returns NULL... " >&6; } if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then - if test "$cross_compiling" = yes; then : - MALLOC_ZERO_RETURNS_NULL=yes +if ${xorg_cv_malloc0_returns_null+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17485,15 +17541,18 @@ main () } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - MALLOC_ZERO_RETURNS_NULL=yes + xorg_cv_malloc0_returns_null=yes else - MALLOC_ZERO_RETURNS_NULL=no + xorg_cv_malloc0_returns_null=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi + +MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null +fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MALLOC_ZERO_RETURNS_NULL" >&5 $as_echo "$MALLOC_ZERO_RETURNS_NULL" >&6; } @@ -17527,12 +17586,12 @@ if test -n "$RANDR_CFLAGS"; then pkg_cv_RANDR_CFLAGS="$RANDR_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 randrproto >= \$RANDR_VERSION xext xextproto xrender renderproto\""; } >&5 - ($PKG_CONFIG --exists --print-errors "x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 >= 1.6 randrproto >= \$RANDR_VERSION xext xextproto xrender renderproto\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_RANDR_CFLAGS=`$PKG_CONFIG --cflags "x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>/dev/null` + pkg_cv_RANDR_CFLAGS=`$PKG_CONFIG --cflags "x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -17544,12 +17603,12 @@ if test -n "$RANDR_LIBS"; then pkg_cv_RANDR_LIBS="$RANDR_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 randrproto >= \$RANDR_VERSION xext xextproto xrender renderproto\""; } >&5 - ($PKG_CONFIG --exists --print-errors "x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 >= 1.6 randrproto >= \$RANDR_VERSION xext xextproto xrender renderproto\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_RANDR_LIBS=`$PKG_CONFIG --libs "x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>/dev/null` + pkg_cv_RANDR_LIBS=`$PKG_CONFIG --libs "x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -17570,14 +17629,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - RANDR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>&1` + RANDR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>&1` else - RANDR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>&1` + RANDR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$RANDR_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto) were not met: + as_fn_error $? "Package requirements (x11 >= 1.6 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto) were not met: $RANDR_PKG_ERRORS @@ -17626,22 +17685,6 @@ done LIBS="$SAVE_LIBS" -# Check for _XEatDataWords function that may be patched into older Xlib release -SAVE_LIBS="$LIBS" -LIBS="$RANDR_LIBS" -for ac_func in _XEatDataWords -do : - ac_fn_c_check_func "$LINENO" "_XEatDataWords" "ac_cv_func__XEatDataWords" -if test "x$ac_cv_func__XEatDataWords" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE__XEATDATAWORDS 1 -_ACEOF - -fi -done - -LIBS="$SAVE_LIBS" - ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile xrandr.pc" cat >confcache <<\_ACEOF @@ -18174,7 +18217,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libXrandr $as_me 1.4.2, which was +This file was extended by libXrandr $as_me 1.5.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18240,7 +18283,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libXrandr config.status 1.4.2 +libXrandr config.status 1.5.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/lib/libXrandr/configure.ac b/lib/libXrandr/configure.ac index c41a076ee..8cb48eb09 100644 --- a/lib/libXrandr/configure.ac +++ b/lib/libXrandr/configure.ac @@ -1,5 +1,5 @@ dnl -dnl $Id: configure.ac,v 1.8 2013/09/28 17:47:02 matthieu Exp $ +dnl $Id: configure.ac,v 1.9 2016/03/06 13:37:21 matthieu Exp $ # # Copyright © 2003 Keith Packard, Noah Levitt # @@ -31,7 +31,7 @@ AC_PREREQ([2.60]) # digit in the version number to track changes which don't affect the # protocol, so Xrandr version l.n.m corresponds to protocol version l.n # -AC_INIT([libXrandr], [1.4.2], +AC_INIT([libXrandr], [1.5.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXrandr]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) @@ -55,13 +55,7 @@ RANDR_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`] AC_SUBST(RANDR_VERSION) # Obtain compiler/linker options for depedencies -PKG_CHECK_MODULES(RANDR, x11 randrproto >= $RANDR_VERSION xext xextproto xrender renderproto) - -# Check for _XEatDataWords function that may be patched into older Xlib release -SAVE_LIBS="$LIBS" -LIBS="$RANDR_LIBS" -AC_CHECK_FUNCS([_XEatDataWords]) -LIBS="$SAVE_LIBS" +PKG_CHECK_MODULES(RANDR, [x11 >= 1.6] randrproto >= $RANDR_VERSION xext xextproto xrender renderproto) # Check for _XEatDataWords function that may be patched into older Xlib release SAVE_LIBS="$LIBS" diff --git a/lib/libXrandr/include/X11/extensions/Xrandr.h b/lib/libXrandr/include/X11/extensions/Xrandr.h index f3948640c..65940bbdb 100644 --- a/lib/libXrandr/include/X11/extensions/Xrandr.h +++ b/lib/libXrandr/include/X11/extensions/Xrandr.h @@ -552,6 +552,36 @@ XRRGetProviderProperty (Display *dpy, RRProvider provider, unsigned long *nitems, unsigned long *bytes_after, unsigned char **prop); + +typedef struct _XRRMonitorInfo { + Atom name; + Bool primary; + Bool automatic; + int noutput; + int x; + int y; + int width; + int height; + int mwidth; + int mheight; + RROutput *outputs; +} XRRMonitorInfo; + +XRRMonitorInfo * +XRRAllocateMonitor(Display *dpy, int noutput); + +XRRMonitorInfo * +XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors); + +void +XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor); + +void +XRRDeleteMonitor(Display *dpy, Window window, Atom name); + +void +XRRFreeMonitors(XRRMonitorInfo *monitors); + _XFUNCPROTOEND #endif /* _XRANDR_H_ */ diff --git a/lib/libXrandr/src/Makefile.am b/lib/libXrandr/src/Makefile.am index 21138469b..673fe2c51 100644 --- a/lib/libXrandr/src/Makefile.am +++ b/lib/libXrandr/src/Makefile.am @@ -10,7 +10,8 @@ libXrandr_la_SOURCES = \ XrrProperty.c \ XrrScreen.c \ XrrProvider.c \ - XrrProviderProperty.c + XrrProviderProperty.c \ + XrrMonitor.c libXrandr_la_LIBADD = @RANDR_LIBS@ diff --git a/lib/libXrandr/src/Makefile.in b/lib/libXrandr/src/Makefile.in index 5072bf20f..a333d391a 100644 --- a/lib/libXrandr/src/Makefile.in +++ b/lib/libXrandr/src/Makefile.in @@ -95,7 +95,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES) libXrandr_la_DEPENDENCIES = am_libXrandr_la_OBJECTS = Xrandr.lo XrrConfig.lo XrrCrtc.lo XrrMode.lo \ XrrOutput.lo XrrProperty.lo XrrScreen.lo XrrProvider.lo \ - XrrProviderProperty.lo + XrrProviderProperty.lo XrrMonitor.lo libXrandr_la_OBJECTS = $(am_libXrandr_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -302,7 +302,8 @@ libXrandr_la_SOURCES = \ XrrProperty.c \ XrrScreen.c \ XrrProvider.c \ - XrrProviderProperty.c + XrrProviderProperty.c \ + XrrMonitor.c libXrandr_la_LIBADD = @RANDR_LIBS@ AM_CFLAGS = \ @@ -395,6 +396,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrConfig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrCrtc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrMode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrMonitor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrOutput.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrProperty.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XrrProvider.Plo@am__quote@ diff --git a/lib/libXrandr/src/Xrandr.c b/lib/libXrandr/src/Xrandr.c index a9fba8772..fd247e077 100644 --- a/lib/libXrandr/src/Xrandr.c +++ b/lib/libXrandr/src/Xrandr.c @@ -219,62 +219,62 @@ static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire) awire->subCode = aevent->subtype; switch (aevent->subtype) { case RRNotify_OutputChange: { - xRROutputChangeNotifyEvent *awire = (xRROutputChangeNotifyEvent *) wire; - XRROutputChangeNotifyEvent *aevent = (XRROutputChangeNotifyEvent *) event; - awire->window = aevent->window; - awire->output = aevent->output; - awire->crtc = aevent->crtc; - awire->mode = aevent->mode; - awire->rotation = aevent->rotation; - awire->connection = aevent->connection; - awire->subpixelOrder = aevent->subpixel_order; + xRROutputChangeNotifyEvent *sawire = (xRROutputChangeNotifyEvent *) wire; + XRROutputChangeNotifyEvent *saevent = (XRROutputChangeNotifyEvent *) event; + sawire->window = saevent->window; + sawire->output = saevent->output; + sawire->crtc = saevent->crtc; + sawire->mode = saevent->mode; + sawire->rotation = saevent->rotation; + sawire->connection = saevent->connection; + sawire->subpixelOrder = saevent->subpixel_order; return True; } case RRNotify_CrtcChange: { - xRRCrtcChangeNotifyEvent *awire = (xRRCrtcChangeNotifyEvent *) wire; - XRRCrtcChangeNotifyEvent *aevent = (XRRCrtcChangeNotifyEvent *) event; - awire->window = aevent->window; - awire->crtc = aevent->crtc; - awire->mode = aevent->mode; - awire->rotation = aevent->rotation; - awire->x = aevent->x; - awire->y = aevent->y; - awire->width = aevent->width; - awire->height = aevent->height; + xRRCrtcChangeNotifyEvent *sawire = (xRRCrtcChangeNotifyEvent *) wire; + XRRCrtcChangeNotifyEvent *saevent = (XRRCrtcChangeNotifyEvent *) event; + sawire->window = saevent->window; + sawire->crtc = saevent->crtc; + sawire->mode = saevent->mode; + sawire->rotation = saevent->rotation; + sawire->x = saevent->x; + sawire->y = saevent->y; + sawire->width = saevent->width; + sawire->height = saevent->height; return True; } case RRNotify_OutputProperty: { - xRROutputPropertyNotifyEvent *awire = (xRROutputPropertyNotifyEvent *) wire; - XRROutputPropertyNotifyEvent *aevent = (XRROutputPropertyNotifyEvent *) event; - awire->window = aevent->window; - awire->output = aevent->output; - awire->atom = aevent->property; - awire->timestamp = aevent->timestamp; - awire->state = aevent->state; + xRROutputPropertyNotifyEvent *sawire = (xRROutputPropertyNotifyEvent *) wire; + XRROutputPropertyNotifyEvent *saevent = (XRROutputPropertyNotifyEvent *) event; + sawire->window = saevent->window; + sawire->output = saevent->output; + sawire->atom = saevent->property; + sawire->timestamp = saevent->timestamp; + sawire->state = saevent->state; return True; } case RRNotify_ProviderChange: { - xRRProviderChangeNotifyEvent *awire = (xRRProviderChangeNotifyEvent *) wire; - XRRProviderChangeNotifyEvent *aevent = (XRRProviderChangeNotifyEvent *) event; - awire->window = aevent->window; - awire->provider = aevent->provider; + xRRProviderChangeNotifyEvent *sawire = (xRRProviderChangeNotifyEvent *) wire; + XRRProviderChangeNotifyEvent *saevent = (XRRProviderChangeNotifyEvent *) event; + sawire->window = saevent->window; + sawire->provider = saevent->provider; return True; } case RRNotify_ProviderProperty: { - xRRProviderPropertyNotifyEvent *awire = (xRRProviderPropertyNotifyEvent *) wire; - XRRProviderPropertyNotifyEvent *aevent = (XRRProviderPropertyNotifyEvent *) event; - awire->window = aevent->window; - awire->provider = aevent->provider; - awire->atom = aevent->property; - awire->timestamp = aevent->timestamp; - awire->state = aevent->state; + xRRProviderPropertyNotifyEvent *sawire = (xRRProviderPropertyNotifyEvent *) wire; + XRRProviderPropertyNotifyEvent *saevent = (XRRProviderPropertyNotifyEvent *) event; + sawire->window = saevent->window; + sawire->provider = saevent->provider; + sawire->atom = saevent->property; + sawire->timestamp = saevent->timestamp; + sawire->state = saevent->state; return True; } case RRNotify_ResourceChange: { - xRRResourceChangeNotifyEvent *awire = (xRRResourceChangeNotifyEvent *) wire; - XRRResourceChangeNotifyEvent *aevent = (XRRResourceChangeNotifyEvent *) event; - awire->window = aevent->window; - awire->timestamp = aevent->timestamp; + xRRResourceChangeNotifyEvent *sawire = (xRRResourceChangeNotifyEvent *) wire; + XRRResourceChangeNotifyEvent *saevent = (XRRResourceChangeNotifyEvent *) event; + sawire->window = saevent->window; + sawire->timestamp = saevent->timestamp; return True; } } diff --git a/lib/libXrandr/src/Xrandrint.h b/lib/libXrandr/src/Xrandrint.h index 1687c29bd..75facac72 100644 --- a/lib/libXrandr/src/Xrandrint.h +++ b/lib/libXrandr/src/Xrandrint.h @@ -42,20 +42,6 @@ extern char XRRExtensionName[]; XExtDisplayInfo *XRRFindDisplay (Display *dpy); -#ifndef HAVE__XEATDATAWORDS -#include <X11/Xmd.h> /* for LONG64 on 64-bit platforms */ -#include <limits.h> - -static inline void _XEatDataWords(Display *dpy, unsigned long n) -{ -# ifndef LONG64 - if (n >= (ULONG_MAX >> 2)) - _XIOError(dpy); -# endif - _XEatData (dpy, n << 2); -} -#endif - /* deliberately opaque internal data structure; can be extended, but not reordered */ struct _XRRScreenConfiguration { diff --git a/lib/libXrandr/src/XrrCrtc.c b/lib/libXrandr/src/XrrCrtc.c index a704a52e5..5ae35c56e 100644 --- a/lib/libXrandr/src/XrrCrtc.c +++ b/lib/libXrandr/src/XrrCrtc.c @@ -93,8 +93,8 @@ XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc) xci->npossible = rep.nPossibleOutput; xci->possible = (RROutput *) (xci->outputs + rep.nOutput); - _XRead32 (dpy, xci->outputs, rep.nOutput << 2); - _XRead32 (dpy, xci->possible, rep.nPossibleOutput << 2); + _XRead32 (dpy, (long *) xci->outputs, rep.nOutput << 2); + _XRead32 (dpy, (long *) xci->possible, rep.nPossibleOutput << 2); /* * Skip any extra data diff --git a/lib/libXrandr/src/XrrMonitor.c b/lib/libXrandr/src/XrrMonitor.c new file mode 100644 index 000000000..71d394392 --- /dev/null +++ b/lib/libXrandr/src/XrrMonitor.c @@ -0,0 +1,200 @@ +/* + * Copyright © 2014 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <X11/Xlib.h> +/* we need to be able to manipulate the Display structure on events */ +#include <X11/Xlibint.h> +#include <X11/extensions/render.h> +#include <X11/extensions/Xrender.h> +#include "Xrandrint.h" + +XRRMonitorInfo * +XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors) +{ + XExtDisplayInfo *info = XRRFindDisplay(dpy); + xRRGetMonitorsReply rep; + xRRGetMonitorsReq *req; + int nbytes, nbytesRead, rbytes; + int nmon, noutput; + int m, o; + char *buf, *buf_head; + xRRMonitorInfo *xmon; + CARD32 *xoutput; + XRRMonitorInfo *mon = NULL; + RROutput *output; + + RRCheckExtension (dpy, info, NULL); + + *nmonitors = -1; + + LockDisplay (dpy); + GetReq (RRGetMonitors, req); + req->reqType = info->codes->major_opcode; + req->randrReqType = X_RRGetMonitors; + req->window = window; + req->get_active = get_active; + + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) + { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + nbytes = (long) rep.length << 2; + nmon = rep.nmonitors; + noutput = rep.noutputs; + nbytesRead = nmon * SIZEOF(xRRMonitorInfo) + noutput * 4; + + if (nmon > 0) { + + /* + * first we must compute how much space to allocate for + * randr library's use; we'll allocate the structures in a single + * allocation, on cleanlyness grounds. + */ + + rbytes = nmon * sizeof (XRRMonitorInfo) + noutput * sizeof(RROutput); + + buf = buf_head = Xmalloc (nbytesRead); + mon = Xmalloc (rbytes); + + if (buf == NULL || mon == NULL) { + if (buf != NULL) Xfree(buf); + if (mon != NULL) Xfree(mon); + _XEatDataWords (dpy, rep.length); + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + _XReadPad(dpy, buf, nbytesRead); + + output = (RROutput *) (mon + nmon); + + for (m = 0; m < nmon; m++) { + xmon = (xRRMonitorInfo *) buf; + mon[m].name = xmon->name; + mon[m].primary = xmon->primary; + mon[m].automatic = xmon->automatic; + mon[m].noutput = xmon->noutput; + mon[m].x = xmon->x; + mon[m].y = xmon->y; + mon[m].width = xmon->width; + mon[m].height = xmon->height; + mon[m].mwidth = xmon->widthInMillimeters; + mon[m].mheight = xmon->heightInMillimeters; + mon[m].outputs = output; + buf += SIZEOF (xRRMonitorInfo); + xoutput = (CARD32 *) buf; + for (o = 0; o < xmon->noutput; o++) + output[o] = xoutput[o]; + output += xmon->noutput; + buf += xmon->noutput * 4; + } + Xfree(buf_head); + } + + /* + * Skip any extra data + */ + if (nbytes > nbytesRead) + _XEatData (dpy, (unsigned long) (nbytes - nbytesRead)); + + UnlockDisplay (dpy); + SyncHandle (); + + *nmonitors = nmon; + return mon; +} + +void +XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor) +{ + XExtDisplayInfo *info = XRRFindDisplay(dpy); + xRRSetMonitorReq *req; + + RRSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq (RRSetMonitor, req); + req->reqType = info->codes->major_opcode; + req->randrReqType = X_RRSetMonitor; + req->length += monitor->noutput; + req->window = window; + req->monitor.name = monitor->name; + req->monitor.primary = monitor->primary; + req->monitor.automatic = False; + req->monitor.noutput = monitor->noutput; + req->monitor.x = monitor->x; + req->monitor.y = monitor->y; + req->monitor.width = monitor->width; + req->monitor.height = monitor->height; + req->monitor.widthInMillimeters = monitor->mwidth; + req->monitor.heightInMillimeters = monitor->mheight; + Data32 (dpy, monitor->outputs, monitor->noutput * 4); + + UnlockDisplay (dpy); + SyncHandle (); +} + +void +XRRDeleteMonitor(Display *dpy, Window window, Atom name) +{ + XExtDisplayInfo *info = XRRFindDisplay(dpy); + xRRDeleteMonitorReq *req; + + RRSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq (RRDeleteMonitor, req); + req->reqType = info->codes->major_opcode; + req->randrReqType = X_RRDeleteMonitor; + req->window = window; + req->name = name; + UnlockDisplay (dpy); + SyncHandle (); +} + +XRRMonitorInfo * +XRRAllocateMonitor(Display *dpy, int noutput) +{ + XRRMonitorInfo *monitor = calloc(1, sizeof (XRRMonitorInfo) + noutput * sizeof (RROutput)); + if (!monitor) + return NULL; + monitor->outputs = (RROutput *) (monitor + 1); + monitor->noutput = noutput; + return monitor; +} + +void +XRRFreeMonitors(XRRMonitorInfo *monitors) +{ + if (monitors) + Xfree(monitors); +} + diff --git a/lib/libXrandr/src/XrrOutput.c b/lib/libXrandr/src/XrrOutput.c index 4df894ead..85f0b6ec9 100644 --- a/lib/libXrandr/src/XrrOutput.c +++ b/lib/libXrandr/src/XrrOutput.c @@ -102,9 +102,9 @@ XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output) xoi->clones = (RROutput *) (xoi->modes + rep.nModes); xoi->name = (char *) (xoi->clones + rep.nClones); - _XRead32 (dpy, xoi->crtcs, rep.nCrtcs << 2); - _XRead32 (dpy, xoi->modes, rep.nModes << 2); - _XRead32 (dpy, xoi->clones, rep.nClones << 2); + _XRead32 (dpy, (long *) xoi->crtcs, rep.nCrtcs << 2); + _XRead32 (dpy, (long *) xoi->modes, rep.nModes << 2); + _XRead32 (dpy, (long *) xoi->clones, rep.nClones << 2); /* * Read name and '\0' terminate diff --git a/lib/libXrandr/src/XrrProperty.c b/lib/libXrandr/src/XrrProperty.c index 2096c5618..502e8347b 100644 --- a/lib/libXrandr/src/XrrProperty.c +++ b/lib/libXrandr/src/XrrProperty.c @@ -70,7 +70,7 @@ XRRListOutputProperties (Display *dpy, RROutput output, int *nprop) return NULL; } - _XRead32 (dpy, props, nbytes); + _XRead32 (dpy, (long *) props, nbytes); } *nprop = rep.nAtoms; diff --git a/lib/libXrandr/src/XrrProvider.c b/lib/libXrandr/src/XrrProvider.c index 014ddd9da..9e620c737 100644 --- a/lib/libXrandr/src/XrrProvider.c +++ b/lib/libXrandr/src/XrrProvider.c @@ -77,7 +77,7 @@ XRRGetProviderResources(Display *dpy, Window window) xrpr->nproviders = rep.nProviders; xrpr->providers = (RRProvider *)(xrpr + 1); - _XRead32(dpy, xrpr->providers, rep.nProviders << 2); + _XRead32(dpy, (long *) xrpr->providers, rep.nProviders << 2); if (nbytes > nbytesRead) _XEatData (dpy, (unsigned long) (nbytes - nbytesRead)); @@ -152,10 +152,10 @@ XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provi xpi->associated_capability = (unsigned int *)(xpi->associated_providers + rep.nAssociatedProviders); xpi->name = (char *)(xpi->associated_capability + rep.nAssociatedProviders); - _XRead32(dpy, xpi->crtcs, rep.nCrtcs << 2); - _XRead32(dpy, xpi->outputs, rep.nOutputs << 2); + _XRead32(dpy, (long *) xpi->crtcs, rep.nCrtcs << 2); + _XRead32(dpy, (long *) xpi->outputs, rep.nOutputs << 2); - _XRead32(dpy, xpi->associated_providers, rep.nAssociatedProviders << 2); + _XRead32(dpy, (long *) xpi->associated_providers, rep.nAssociatedProviders << 2); /* * _XRead32 reads a series of 32-bit values from the protocol and writes diff --git a/lib/libXrandr/src/XrrProviderProperty.c b/lib/libXrandr/src/XrrProviderProperty.c index 34cc0820e..241e8ee5f 100644 --- a/lib/libXrandr/src/XrrProviderProperty.c +++ b/lib/libXrandr/src/XrrProviderProperty.c @@ -70,7 +70,7 @@ XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop) return NULL; } - _XRead32 (dpy, props, nbytes); + _XRead32 (dpy, (long *) props, nbytes); } *nprop = rep.nAtoms; diff --git a/lib/libXrandr/src/XrrScreen.c b/lib/libXrandr/src/XrrScreen.c index 08710b668..f29071ca6 100644 --- a/lib/libXrandr/src/XrrScreen.c +++ b/lib/libXrandr/src/XrrScreen.c @@ -145,8 +145,8 @@ doGetScreenResources (Display *dpy, Window window, int poll) xrsr->modes = (XRRModeInfo *) (xrsr->outputs + rep.nOutputs); names = (char *) (xrsr->modes + rep.nModes); - _XRead32 (dpy, xrsr->crtcs, rep.nCrtcs << 2); - _XRead32 (dpy, xrsr->outputs, rep.nOutputs << 2); + _XRead32 (dpy, (long *) xrsr->crtcs, rep.nCrtcs << 2); + _XRead32 (dpy, (long *) xrsr->outputs, rep.nOutputs << 2); for (i = 0; i < rep.nModes; i++) { xRRModeInfo modeInfo; |