diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2016-03-06 13:45:30 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2016-03-06 13:45:30 +0000 |
commit | e13d672526896d77b819481d2b2d85a5fcc6bade (patch) | |
tree | e2b5afa0d2cd963137012dfce18b4b2b36e1e3cf /app | |
parent | cd0778747371da9cf85661fce6e167344ade431f (diff) |
Update to xrandr 1.5.0
Diffstat (limited to 'app')
-rw-r--r-- | app/xrandr/ChangeLog | 139 | ||||
-rw-r--r-- | app/xrandr/Makefile.in | 2 | ||||
-rw-r--r-- | app/xrandr/compile | 347 | ||||
-rw-r--r-- | app/xrandr/configure | 38 | ||||
-rw-r--r-- | app/xrandr/configure.ac | 4 | ||||
-rw-r--r-- | app/xrandr/keystone.5c | 118 | ||||
-rw-r--r-- | app/xrandr/xrandr.c | 394 |
7 files changed, 927 insertions, 115 deletions
diff --git a/app/xrandr/ChangeLog b/app/xrandr/ChangeLog index 5be4d027e..34ed9061b 100644 --- a/app/xrandr/ChangeLog +++ b/app/xrandr/ChangeLog @@ -1,3 +1,128 @@ +commit 65fd628cdfd1c95bd01a50706d4577655d1dd404 +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Tue Feb 23 10:22:26 2016 -0800 + + xrandr 1.5.0 + + Signed-off-by: Aaron Plattner <aplattner@nvidia.com> + +commit d62030b506f6b686ffe1e750ea9d3a855beec1f0 +Author: Chris Wilson <chris@chris-wilson.co.uk> +Date: Sun Sep 13 11:40:37 2015 +0100 + + Only use the current information when setting modes + + Before we change the state (e.g. adding a mode or applying one to an + output), we query the screen resources for the right identifiers. This + should only use the current information rather than force a reprobe on + all hardware - not only can that reprobe be very slow (e.g. EDID + timeouts on the order of seconds), but it may perturb the setup that the + user is trying to configure. + + Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> + +commit 3d03be780fca4949b11ead46c5ea5d3266c03c32 +Author: Chris Wilson <chris@chris-wilson.co.uk> +Date: Thu Jun 18 08:27:49 2015 +0100 + + Mark all CRTC as currently unused for second picking CRTC pass + + We perform two passes over the CRTC in order to find the preferred CRTC + for each enabled output. In the first pass, we try to preserve the + existing output <-> CRTC relationships (to avoid unnecessary flicker). + If that pass fails, we try again but with all outputs first disabled. + However, the logic to preserve an active CRTC was not disabled along + with the outputs - meaning that if one was active but its associated + output was disabled by the user, then that CRTC would remain unavailable + for other outputs. The result would be that we would try to assign more + CRTC than available (i.e. if the user request 3 new HDMI outputs on a + system with only 3 CRTC, and wished to switch off an active internal + panel, we would report "cannot find CRTC" even though that configuration + could be established.) + + Reported-and-tested-by: Nathan Schulte <nmschulte@gmail.com> + Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> + +commit 53ef3fc13b3e282902892e3140765460c6f93276 +Author: Chris Wilson <chris@chris-wilson.co.uk> +Date: Thu Jun 18 08:27:48 2015 +0100 + + Mark disabling an output as a change in its CRTC + + When an output is disabled via the cmdline, we can use that information + to prevent assigning the current CRTC to the output and free it up for + reuse by other outputs in the first pass of picking CRTC. + + Reported-and-tested-by: Nathan Schulte <nmschulte@gmail.com> + Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> + +commit 09989b09a342b273ee30e1d96267dced3cbe61b0 +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Thu Apr 9 11:14:54 2015 -0700 + + Split verbose mode printing into a helper function + + Combine the two forms of verbose mode printing into a single function. Pass the + 'current' and 'preferred' flags as arguments. This fixes the code that prints + unassociated modes to print the flags as well. + + Signed-off-by: Aaron Plattner <aplattner@nvidia.com> + Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> + +commit d06730e94320175d40ff6f2bb38dce55312f2e54 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 16 01:57:45 2014 -0800 + + Add monitor support (v2) + + This adds the ability to query, set and delete monitors + + v2: [airlied] add list active monitors + + Reviewed-by: Dave Airlie <airlied@redhat.com> + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3076c3494b6f3f00b9c4509c2dab6f40858af4cf +Author: Dave Airlie <airlied@redhat.com> +Date: Tue Mar 31 11:49:00 2015 +1000 + + xrandr: don't return NULL from a void + + Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> + Signed-off-by: Dave Airlie <airlied@redhat.com> + +commit 6957ad0cf3cdd10e8f4a5638b36f25c7a9b4ea25 +Author: Dave Airlie <airlied@redhat.com> +Date: Mon Mar 30 14:51:49 2015 +1000 + + xrandr: parse property returns correctly. + + Xlib uses longs for 32-bit, so when we get values back they + are in longs, this fixes the xrandr parsing code to parse + the correct sized values according to Xlib. + + Reviewed-by: Keith Packard <keithp@keithp.com> + Signed-off-by: Dave Airlie <airlied@redhat.com> + +commit f429a517684e8f99c15bc2858e62bbd112331456 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Oct 8 13:16:07 2014 +0200 + + keystone: Report matrix error. Deal with "primary" in xrandr output + + Compute the error cause by the fixed point matrix representation and + display that. + + Accept the 'primary' word found in xrandr output and ignore it. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 527d83dde0cb78cbfbb67d203d073e41e110d4a1 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Jul 9 10:52:52 2012 -0700 + + Increase keystone.5c default window size + commit 9887ed4989e0abd48004598be0eb5cb06fa40bd1 Author: Aaron Plattner <aplattner@nvidia.com> Date: Fri Aug 1 23:14:42 2014 -0700 @@ -7,7 +132,7 @@ Date: Fri Aug 1 23:14:42 2014 -0700 Signed-off-by: Aaron Plattner <aplattner@nvidia.com> commit 20d76f773cf8de474cf7a3f1082961605732c3f1 -Merge: 00477d8 193a358 +Merge: 00477d88297e 193a358563a5 Author: Aaron Plattner <aplattner@nvidia.com> Date: Fri Aug 1 23:10:46 2014 -0700 @@ -293,7 +418,7 @@ Date: Tue Feb 12 13:24:38 2013 -0800 Signed-off-by: Aaron Plattner <aplattner@nvidia.com> commit 3e5f160c4198a5160be5e9a3f21ba3f4130d4318 -Merge: dac72db bd16618 +Merge: dac72dbbc750 bd166184f6c1 Author: Aaron Plattner <aplattner@nvidia.com> Date: Tue Feb 12 12:30:20 2013 -0800 @@ -1559,7 +1684,7 @@ Date: Mon Dec 1 21:45:47 2008 +0100 Fix build outside of the source dir commit 63ba316bcbe8ad61ba63d9fe62c82e7d56dcc399 -Merge: a813c4d 1b95e32 +Merge: a813c4da7f0b 1b95e32b4b0a Author: Julien Cristau <jcristau@debian.org> Date: Mon Dec 1 21:33:35 2008 +0100 @@ -2037,7 +2162,7 @@ Date: Sun Feb 18 21:27:55 2007 -0800 Update version number to 1.2.0 for release. commit 13cef2baa884039e96f5dfd9245bb949aed99448 -Merge: 065f09c a175972 +Merge: 065f09cc304d a175972de6fb Author: Keith Packard <keithp@neko.keithp.com> Date: Sun Feb 18 21:26:50 2007 -0800 @@ -2079,7 +2204,7 @@ Date: Sat Feb 10 16:14:58 2007 -0800 Display set of available CRTCs per output in --verbose mode. commit 067cafb5cda0aa6e34773e888fd469ff657760c2 -Merge: 7c25c24 b0a00df +Merge: 7c25c245bceb b0a00df69f83 Author: Keith Packard <keithp@guitar.keithp.com> Date: Wed Jan 31 15:25:35 2007 -0800 @@ -2238,7 +2363,7 @@ Date: Tue Dec 19 16:27:46 2006 -0800 Actually respect the --fb option commit 7b32611632ab08b6a123db5df1c2b919b3a12104 -Merge: a0df3aa 4bb1a9c +Merge: a0df3aa81205 4bb1a9cd6f9c Author: Keith Packard <keithp@guitar.keithp.com> Date: Tue Dec 19 15:58:38 2006 -0800 @@ -2251,7 +2376,7 @@ Date: Tue Dec 19 15:58:21 2006 -0800 Correct format for sscanf to double variable "dpi" commit 4bb1a9cd6f9cc3ed61d7913528afa3f573092833 -Merge: b6c0382 6ef400f +Merge: b6c03827bae7 6ef400f35d7d Author: Keith Packard <keithp@bouzouki.jf.intel.com> Date: Wed Dec 13 11:36:36 2006 -0800 diff --git a/app/xrandr/Makefile.in b/app/xrandr/Makefile.in index d288cd21d..0eff2c307 100644 --- a/app/xrandr/Makefile.in +++ b/app/xrandr/Makefile.in @@ -76,7 +76,7 @@ bin_PROGRAMS = xrandr$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure COPYING ChangeLog INSTALL NEWS compile \ + $(top_srcdir)/configure COPYING ChangeLog INSTALL compile \ config.guess config.sub depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac diff --git a/app/xrandr/compile b/app/xrandr/compile index 1b1d23216..0fc915d98 100644 --- a/app/xrandr/compile +++ b/app/xrandr/compile @@ -1,4 +1,351 @@ #! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2014 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: +#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2005-05-14.22 diff --git a/app/xrandr/configure b/app/xrandr/configure index 5eb0415b5..42f0502e6 100644 --- a/app/xrandr/configure +++ b/app/xrandr/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xrandr 1.4.3. +# Generated by GNU Autoconf 2.69 for xrandr 1.5.0. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -581,8 +581,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xrandr' PACKAGE_TARNAME='xrandr' -PACKAGE_VERSION='1.4.3' -PACKAGE_STRING='xrandr 1.4.3' +PACKAGE_VERSION='1.5.0' +PACKAGE_STRING='xrandr 1.5.0' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' PACKAGE_URL='' @@ -1311,7 +1311,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 xrandr 1.4.3 to adapt to many kinds of systems. +\`configure' configures xrandr 1.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1381,7 +1381,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xrandr 1.4.3:";; + short | recursive ) echo "Configuration of xrandr 1.5.0:";; esac cat <<\_ACEOF @@ -1489,7 +1489,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xrandr configure 1.4.3 +xrandr configure 1.5.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1746,7 +1746,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 xrandr $as_me 1.4.3, which was +It was created by xrandr $as_me 1.5.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2575,7 +2575,7 @@ fi # Define the identity of the package. PACKAGE='xrandr' - VERSION='1.4.3' + VERSION='1.5.0' cat >>confdefs.h <<_ACEOF @@ -10421,12 +10421,12 @@ if test -n "$XRANDR_CFLAGS"; then pkg_cv_XRANDR_CFLAGS="$XRANDR_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xrandr >= 1.4 xrender x11 xproto >= 7.0.17\""; } >&5 - ($PKG_CONFIG --exists --print-errors "xrandr >= 1.4 xrender x11 xproto >= 7.0.17") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xrandr >= 1.5 xrender x11 xproto >= 7.0.17\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xrandr >= 1.5 xrender x11 xproto >= 7.0.17") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_XRANDR_CFLAGS=`$PKG_CONFIG --cflags "xrandr >= 1.4 xrender x11 xproto >= 7.0.17" 2>/dev/null` + pkg_cv_XRANDR_CFLAGS=`$PKG_CONFIG --cflags "xrandr >= 1.5 xrender x11 xproto >= 7.0.17" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -10438,12 +10438,12 @@ if test -n "$XRANDR_LIBS"; then pkg_cv_XRANDR_LIBS="$XRANDR_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xrandr >= 1.4 xrender x11 xproto >= 7.0.17\""; } >&5 - ($PKG_CONFIG --exists --print-errors "xrandr >= 1.4 xrender x11 xproto >= 7.0.17") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xrandr >= 1.5 xrender x11 xproto >= 7.0.17\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xrandr >= 1.5 xrender x11 xproto >= 7.0.17") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_XRANDR_LIBS=`$PKG_CONFIG --libs "xrandr >= 1.4 xrender x11 xproto >= 7.0.17" 2>/dev/null` + pkg_cv_XRANDR_LIBS=`$PKG_CONFIG --libs "xrandr >= 1.5 xrender x11 xproto >= 7.0.17" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -10464,14 +10464,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - XRANDR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xrandr >= 1.4 xrender x11 xproto >= 7.0.17" 2>&1` + XRANDR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xrandr >= 1.5 xrender x11 xproto >= 7.0.17" 2>&1` else - XRANDR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xrandr >= 1.4 xrender x11 xproto >= 7.0.17" 2>&1` + XRANDR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xrandr >= 1.5 xrender x11 xproto >= 7.0.17" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$XRANDR_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (xrandr >= 1.4 xrender x11 xproto >= 7.0.17) were not met: + as_fn_error $? "Package requirements (xrandr >= 1.5 xrender x11 xproto >= 7.0.17) were not met: $XRANDR_PKG_ERRORS @@ -11040,7 +11040,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 xrandr $as_me 1.4.3, which was +This file was extended by xrandr $as_me 1.5.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11106,7 +11106,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="\\ -xrandr config.status 1.4.3 +xrandr config.status 1.5.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/app/xrandr/configure.ac b/app/xrandr/configure.ac index fa7cb48c4..9fd434b83 100644 --- a/app/xrandr/configure.ac +++ b/app/xrandr/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xrandr], [1.4.3], +AC_INIT([xrandr], [1.5.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xrandr]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) @@ -40,7 +40,7 @@ XORG_DEFAULT_OPTIONS AC_CHECK_LIB(m,floor) # Checks for pkg-config packages -PKG_CHECK_MODULES(XRANDR, xrandr >= 1.4 xrender x11 xproto >= 7.0.17) +PKG_CHECK_MODULES(XRANDR, xrandr >= 1.5 xrender x11 xproto >= 7.0.17) AC_CONFIG_FILES([ Makefile diff --git a/app/xrandr/keystone.5c b/app/xrandr/keystone.5c index 4b698ee7b..f73aa8b72 100644 --- a/app/xrandr/keystone.5c +++ b/app/xrandr/keystone.5c @@ -50,7 +50,7 @@ extend namespace Nichrome { } protected void natural (cairo_t cr, &quad_t quad) { - rectangle (cr, 0, 0, 256, 256); + rectangle (cr, 0, 0, 400, 300); } void text_at (cairo_t cr, point_t p, string text) { @@ -354,16 +354,17 @@ rescale (m_t m, real limit) string m_print (m_t m) { - /* + return sprintf ("%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f", m[0,0],m[0,1],m[0,2], m[1,0],m[1,1],m[1,2], m[2,0],m[2,1],m[2,2]); - */ +/* return sprintf ("%v,%v,%v,%v,%v,%v,%v,%v,%v", m[0,0],m[0,1],m[0,2], m[1,0],m[1,1],m[1,2], m[2,0],m[2,1],m[2,2]); +*/ } int @@ -372,6 +373,33 @@ fixed (real x) return floor (x * 65536 + 0.5) & 0xffffffff; } +m_t +to_fixed(m_t m) +{ + m_t r; + + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) + r[i,j] = floor(m[i,j] * 65536 + 0.5) / 65536; + return r; +} + +m_t +error(m_t r, m_t f) +{ + m_t e; + + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) { + real diff = abs(r[i,j] - f[i,j]); + if (r[i,j] != 0) + e[i,j] = diff / abs(r[i,j]); + else + e[i,j] = 0; + } + return e; +} + void m_print_fix (m_t m) { @@ -382,6 +410,55 @@ m_print_fix (m_t m) } } +real[2] +map(m_t m, real x, real y) +{ + real[3] in = { x, y, 1 }; + real[3] out = { 0 ... }; + + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) + out[i] += m[i,j] * in[j]; + } + return (real[2]) { out[0] / out[2], out[1]/ out[2] }; +} + +real +position_error(m_t r, m_t f, real x, real y) +{ + real[2] p_r = map(r, x, y); + real[2] p_f = map(f, x, y); + real error; + + error = sqrt((p_r[0] - p_f[0]) ** 2 + (p_r[1] - p_f[1]) ** 2); + printf ("x: %g y: %g error %g\n", x, y, error); + printf ("\treal x: %g y: %g\n", p_r[0], p_r[1]); + printf ("\tfix x: %g y: %g\n", p_f[0], p_f[1]); + return error; +} + +real +max_error(m_t r, m_t f) { + real max = 0, max_x = 0, max_y = 0; + + for (int x = 0; x <= 2560; x += 2560) + for (int y = 0; y <= 1600; y += 1600) { + real error = position_error(r, f, x, y); + if (error > max) { + max = error; + max_x = x; + max_y = y; + } + } + printf ("max error %g at %d, %d\n", max, max_x, max_y); + real[2] p_r = map(r, max_x ,max_y); + real[2] p_f = map(f, max_x, max_y); + printf ("\tdesired %7.2f, %7.2f actual %7.2f, %7.2f\n", + p_r[0], p_r[1], + p_f[0], p_f[1]); + return max; +} + string m_row (m_t m, int row) { @@ -414,18 +491,22 @@ output_t[*] get_outputs () { { while (!File::end (randr)) { string[*] words = String::wordsplit (File::fgets (randr), " "); - if (dim (words) >= 3 && words[1] == "connected" && - File::sscanf (words[2], "%dx%d+%d+%d", - &(int width), &(int height), - &(int x), &(int y)) == 4) - { - outputs[dim(outputs)] = (output_t) { - name = words[0], - geometry = { - x = x, y = y, width = width, height = height - } - }; - } + if (dim (words) >= 3 && words[1] == "connected") { + int geom = 2; + if (words[geom] == "primary") + geom++; + if (File::sscanf (words[geom], "%dx%d+%d+%d", + &(int width), &(int height), + &(int x), &(int y)) == 4) + { + outputs[dim(outputs)] = (output_t) { + name = words[0], + geometry = { + x = x, y = y, width = width, height = height + } + }; + } + } } } return outputs; @@ -433,7 +514,7 @@ output_t[*] get_outputs () { void main () { - m_t m = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }, m_i, m_r; + m_t m = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }, m_i, m_r, m_f, m_e; bool m_available = true; output_t[*] outputs = get_outputs (); output_t target_output; @@ -529,8 +610,13 @@ void main () printf ("normal: %s\n", m_print (m)); printf ("inverse: %s\n", m_print (m_i)); printf ("scaled: %s\n", m_print (m_r)); + m_f = to_fixed(m_r); + printf ("round: %s\n", m_print(m_f)); printf ("fixed:\n"); m_print_fix (m_i); + m_e = error(m_r, m_f); + printf ("error: %s\n", m_print (m_e)); + max_error(m_r, m_f); } } diff --git a/app/xrandr/xrandr.c b/app/xrandr/xrandr.c index 366f6dc63..dcfdde073 100644 --- a/app/xrandr/xrandr.c +++ b/app/xrandr/xrandr.c @@ -153,7 +153,11 @@ usage(void) " --delmode <output> <name>\n" " --listproviders\n" " --setprovideroutputsource <prov-xid> <source-xid>\n" - " --setprovideroffloadsink <prov-xid> <sink-xid>\n"); + " --setprovideroffloadsink <prov-xid> <sink-xid>\n" + " --listmonitors\n" + " --listactivemonitors\n" + " --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}\n" + " --delmonitor <name>\n"); } static void _X_NORETURN _X_ATTRIBUTE_PRINTF(1,2) @@ -304,6 +308,8 @@ typedef struct _transform transform_t; typedef struct _umode umode_t; typedef struct _output_prop output_prop_t; typedef struct _provider provider_t; +typedef struct _monitors monitors_t; +typedef struct _umonitor umonitor_t; struct _transform { XTransform transform; @@ -397,6 +403,22 @@ struct _provider { XRRProviderInfo *info; }; +struct _monitors { + int n; + XRRMonitorInfo *monitors; +}; + +struct _umonitor { + struct _umonitor *next; + char *name; + Bool set; + Bool primary; + int x, y, width, height; + int mmwidth, mmheight; + int noutput; + name_t *outputs; +}; + static const char *connection[3] = { "connected", "disconnected", @@ -431,7 +453,10 @@ static int minWidth, maxWidth, minHeight, maxHeight; static Bool has_1_2 = False; static Bool has_1_3 = False; static Bool has_1_4 = False; +static Bool has_1_5 = False; static name_t provider_name, output_source_provider_name, offload_sink_provider_name; +static monitors_t *monitors; +static umonitor_t *umonitors; static int mode_height (XRRModeInfo *mode_info, Rotation rotation) @@ -541,7 +566,7 @@ mode_geometry (XRRModeInfo *mode_info, Rotation rotation, /* v refresh frequency in Hz */ static double -mode_refresh (XRRModeInfo *mode_info) +mode_refresh (const XRRModeInfo *mode_info) { double rate; double vTotal = mode_info->vTotal; @@ -567,7 +592,7 @@ mode_refresh (XRRModeInfo *mode_info) /* h sync frequency in Hz */ static double -mode_hsync (XRRModeInfo *mode_info) +mode_hsync (const XRRModeInfo *mode_info) { double rate; @@ -579,6 +604,30 @@ mode_hsync (XRRModeInfo *mode_info) } static void +print_verbose_mode (const XRRModeInfo *mode, Bool current, Bool preferred) +{ + int f; + + printf (" %s (0x%x) %6.3fMHz", + mode->name, (int)mode->id, + (double)mode->dotClock / 1000000.0); + for (f = 0; mode_flags[f].flag; f++) + if (mode->modeFlags & mode_flags[f].flag) + printf (" %s", mode_flags[f].string); + if (current) + printf (" *current"); + if (preferred) + printf (" +preferred"); + printf ("\n"); + printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.2fKHz\n", + mode->width, mode->hSyncStart, mode->hSyncEnd, + mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); + printf (" v: height %4d start %4d end %4d total %4d clock %6.2fHz\n", + mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, + mode_refresh (mode)); +} + +static void init_name (name_t *name) { name->kind = name_none; @@ -2194,6 +2243,8 @@ static void pick_crtcs (void) { output_t *output; + int saved_crtc_noutput[num_crtcs]; + int n; /* * First try to match up newly enabled outputs with spare crtcs @@ -2225,7 +2276,18 @@ pick_crtcs (void) */ for (output = all_outputs; output; output = output->next) output->current_crtc_info = output->crtc_info; + + /* Mark all CRTC as currently unused */ + for (n = 0; n < num_crtcs; n++) { + saved_crtc_noutput[n] = crtcs[n].crtc_info->noutput; + crtcs[n].crtc_info->noutput = 0; + } + pick_crtcs_score (all_outputs); + + for (n = 0; n < num_crtcs; n++) + crtcs[n].crtc_info->noutput = saved_crtc_noutput[n]; + for (output = all_outputs; output; output = output->next) { if (output->mode_info && !output->crtc_info) @@ -2262,12 +2324,24 @@ property_values_from_string(const char *str, const Atom type, const int format, { char *token, *tmp; void *returned_bytes = NULL; - int nitems = 0, bytes_per_item = format / 8; + int nitems = 0, bytes_per_item; - if ((type != XA_INTEGER && type != XA_CARDINAL) || - (format != 8 && format != 16 && format != 32)) - { + if (type != XA_INTEGER && type != XA_CARDINAL) return NULL; + + /* compute memory needed for Xlib datatype (sigh) */ + switch (format) { + case 8: + bytes_per_item = sizeof(char); + break; + case 16: + bytes_per_item = sizeof(short); + break; + case 32: + bytes_per_item = sizeof(long); + break; + default: + return NULL; } tmp = strdup (str); @@ -2286,33 +2360,33 @@ property_values_from_string(const char *str, const Atom type, const int format, if (type == XA_INTEGER && format == 8) { - int8_t *ptr = returned_bytes; - ptr[nitems] = (int8_t) val; + signed char *ptr = returned_bytes; + ptr[nitems] = (char) val; } else if (type == XA_INTEGER && format == 16) { - int16_t *ptr = returned_bytes; - ptr[nitems] = (int16_t) val; + short *ptr = returned_bytes; + ptr[nitems] = (short) val; } else if (type == XA_INTEGER && format == 32) { - int32_t *ptr = returned_bytes; - ptr[nitems] = (int32_t) val; + long *ptr = returned_bytes; + ptr[nitems] = (long) val; } else if (type == XA_CARDINAL && format == 8) { - uint8_t *ptr = returned_bytes; - ptr[nitems] = (uint8_t) val; + unsigned char *ptr = returned_bytes; + ptr[nitems] = (unsigned char) val; } else if (type == XA_CARDINAL && format == 16) { - uint16_t *ptr = returned_bytes; - ptr[nitems] = (uint16_t) val; + unsigned short *ptr = returned_bytes; + ptr[nitems] = (unsigned short) val; } else if (type == XA_CARDINAL && format == 32) { - uint32_t *ptr = returned_bytes; - ptr[nitems] = (uint32_t) val; + unsigned long *ptr = returned_bytes; + ptr[nitems] = (unsigned long) val; } else { @@ -2352,20 +2426,20 @@ print_output_property_value(int value_format, /* 8, 16, 32 */ { if (value_format == 8) { - const int8_t *val = value_bytes; - printf ("%" PRId8, *val); + const signed char *val = value_bytes; + printf ("%d", *val); return; } if (value_format == 16) { - const int16_t *val = value_bytes; - printf ("%" PRId16, *val); + const short *val = value_bytes; + printf ("%d", *val); return; } if (value_format == 32) { - const int32_t *val = value_bytes; - printf ("%" PRId32, *val); + const long *val = value_bytes; + printf ("%ld", *val); return; } } @@ -2374,20 +2448,20 @@ print_output_property_value(int value_format, /* 8, 16, 32 */ { if (value_format == 8) { - const uint8_t *val = value_bytes; - printf ("%" PRIu8, *val); + const unsigned char *val = value_bytes; + printf ("%u", *val); return; } if (value_format == 16) { - const uint16_t *val = value_bytes; - printf ("%" PRIu16, *val); + const unsigned short *val = value_bytes; + printf ("%u", *val); return; } if (value_format == 32) { - const uint32_t *val = value_bytes; - printf ("%" PRIu32, *val); + const unsigned long *val = value_bytes; + printf ("%lu", *val); return; } } @@ -2441,9 +2515,22 @@ print_output_property(const char *atom_name, int nitems, const unsigned char *prop) { - int bytes_per_item = value_format / 8; + int bytes_per_item; int k; + switch (value_format) { + case 8: + bytes_per_item = sizeof(char); + break; + case 16: + bytes_per_item = sizeof(short); + break; + case 32: + bytes_per_item = sizeof(long); + break; + default: + return; + } /* * Check for properties that need special formatting. */ @@ -2531,6 +2618,22 @@ find_provider (name_t *name) exit (1); } +static void +get_monitors(Bool get_active) +{ + XRRMonitorInfo *m; + int n; + + if (!has_1_5 || monitors) + return; + + m = XRRGetMonitors(dpy, root, get_active, &n); + if (n == -1) + fatal("get monitors failed\n"); + monitors = calloc(1, sizeof (monitors_t)); + monitors->n = n; + monitors->monitors = m; +} int main (int argc, char **argv) @@ -2570,6 +2673,9 @@ main (int argc, char **argv) Bool list_providers = False; Bool provsetoutsource = False; Bool provsetoffsink = False; + Bool monitorit = False; + Bool list_monitors = False; + Bool list_active_monitors = False; int major, minor; Bool current = False; Bool toggle_x = False; @@ -2936,7 +3042,7 @@ main (int argc, char **argv) if (!config_output) argerr ("%s must be used after --output\n", argv[i]); set_name_xid (&config_output->mode, None); set_name_xid (&config_output->crtc, None); - config_output->changes |= changes_mode; + config_output->changes |= changes_mode | changes_crtc; continue; } if (!strcmp ("--fb", argv[i])) { @@ -3105,6 +3211,72 @@ main (int argc, char **argv) provsetoffsink = True; continue; } + if (!strcmp("--listmonitors", argv[i])) + { + list_monitors = True; + action_requested = True; + continue; + } + if (!strcmp("--listactivemonitors", argv[i])) + { + list_active_monitors = True; + action_requested = True; + continue; + } + if (!strcmp("--setmonitor", argv[i])) + { + umonitor_t *m = calloc(1, sizeof (umonitor_t)), **l; + char *t; + char *o; + char *n; + char *geom; + + if (i+3 >= argc) argerr("%s requires three argument\n", argv[i]); + n = argv[++i]; + if (*n == '*') { + m->primary = True; + n++; + } + m->name = n; + m->set = True; + geom = argv[++i]; + + if (strncmp (geom, "auto", 4) != 0) { + if (sscanf(geom, "%d/%dx%d/%d+%d+%d", + &m->width, &m->mmwidth, &m->height, &m->mmheight, &m->x, &m->y) != 6) + argerr ("failed to parse '%s' as monitor geometry\n", argv[i]); + } + + o = argv[++i]; + if (strcmp(o, "none") != 0) { + printf ("output list %s\n", o); + for (; (t = strtok(o, ",")) != NULL; o = NULL) { + m->outputs = realloc(m->outputs, (m->noutput + 1) * sizeof (name_t)); + printf ("add monitor %s\n", t); + set_name(&m->outputs[m->noutput++], t, name_string|name_xid|name_index); + printf ("output name %s\n", m->outputs[m->noutput-1].string); + } + } + for (l = &umonitors; *l; l = &((*l)->next)); + *l = m; + action_requested = True; + monitorit = True; + continue; + } + if (!strcmp("--delmonitor", argv[i])) + { + umonitor_t *m = calloc(1, sizeof (umonitor_t)), **l; + + if (++i >= argc) argerr("%s requires an argument\n", argv[i-1]); + + m->name = argv[i]; + m->set = False; + for (l = &umonitors; *l; l = &((*l)->next)); + *l = m; + action_requested = True; + monitorit = True; + continue; + } argerr ("unrecognized option '%s'\n", argv[i]); } @@ -3147,12 +3319,13 @@ main (int argc, char **argv) has_1_3 = True; if (major > 1 || (major == 1 && minor >= 4)) has_1_4 = True; - + if (major > 1 || (major == 1 && minor >= 5)) + has_1_5 = True; if (has_1_2 && modeit) { umode_t *m; - get_screen (current); + get_screen (True); get_crtcs(); get_outputs(); @@ -3191,7 +3364,7 @@ main (int argc, char **argv) break; } } - if (!setit_1_2) + if (!propit && !setit_1_2 && !monitorit) { XSync (dpy, False); exit (0); @@ -3201,7 +3374,7 @@ main (int argc, char **argv) { output_t *output; - get_screen (current); + get_screen (True); get_crtcs(); get_outputs(); @@ -3292,7 +3465,7 @@ main (int argc, char **argv) if (!has_1_4) fatal ("--setprovideroutputsource requires RandR 1.4\n"); - get_screen (current); + get_screen (True); get_providers (); provider = find_provider (&provider_name); @@ -3307,7 +3480,7 @@ main (int argc, char **argv) if (!has_1_4) fatal ("--setprovideroffloadsink requires RandR 1.4\n"); - get_screen (current); + get_screen (True); get_providers (); provider = find_provider (&provider_name); @@ -3317,7 +3490,7 @@ main (int argc, char **argv) } if (setit_1_2) { - get_screen (current); + get_screen (True); get_crtcs (); get_outputs (); set_positions (); @@ -3402,6 +3575,73 @@ main (int argc, char **argv) */ apply (); + if (!monitorit) { + XSync (dpy, False); + exit (0); + } + } + if (monitorit) { + umonitor_t *u; + Atom name; + + if (!has_1_5) { + printf("RandR 1.5 not supported\n"); + exit(0); + } + + get_screen(True); + get_monitors(True); + get_crtcs(); + get_outputs(); + + for (u = umonitors; u; u = u->next) { + if (u->set) { + XRRMonitorInfo *m; + int o; + + name = XInternAtom(dpy, u->name, False); + m = XRRAllocateMonitor(dpy, u->noutput); + + m->name = name; + m->primary = u->primary; + m->x = u->x; + m->y = u->y; + m->width = u->width; + m->height = u->height; + m->mwidth = u->mmwidth; + m->mheight = u->mmheight; + for (o = 0; o < u->noutput; o++) { + output_t *output = find_output(&u->outputs[o]); + if (!output) + fatal("cannot find output\n"); + m->outputs[o] = output->output.xid; + } + + XRRSetMonitor(dpy, root, m); + + XRRFreeMonitors(m); + } else { + int m; + + name = XInternAtom(dpy, u->name, True); + if (!name) { + printf("No monitor named '%s'\n", u->name); + } else { + if (!monitors) + printf ("No monitors\n"); + else { + for (m = 0; m < monitors->n; m++) { + if (monitors->monitors[m].name == name) + break; + } + if (m == monitors->n) + printf("No monitor named '%s'\n", u->name); + else + XRRDeleteMonitor(dpy, root, name); + } + } + } + } XSync (dpy, False); exit (0); } @@ -3633,25 +3873,9 @@ main (int argc, char **argv) for (j = 0; j < output_info->nmode; j++) { XRRModeInfo *mode = find_mode_by_xid (output_info->modes[j]); - int f; - - printf (" %s (0x%x) %6.3fMHz", - mode->name, (int)mode->id, - (double)mode->dotClock / 1000000.0); - for (f = 0; mode_flags[f].flag; f++) - if (mode->modeFlags & mode_flags[f].flag) - printf (" %s", mode_flags[f].string); - if (mode == output->mode_info) - printf (" *current"); - if (j < output_info->npreferred) - printf (" +preferred"); - printf ("\n"); - printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.2fKHz\n", - mode->width, mode->hSyncStart, mode->hSyncEnd, - mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); - printf (" v: height %4d start %4d end %4d total %4d clock %6.2fHz\n", - mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, - mode_refresh (mode)); + + print_verbose_mode (mode, mode == output->mode_info, + j < output_info->npreferred); mode->modeFlags |= ModeShown; } } @@ -3696,17 +3920,7 @@ main (int argc, char **argv) XRRModeInfo *mode = &res->modes[m]; if (!(mode->modeFlags & ModeShown)) - { - printf (" %s (0x%x) %6.3fMHz\n", - mode->name, (int)mode->id, - (double)mode->dotClock / 1000000.0); - printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.2fKHz\n", - mode->width, mode->hSyncStart, mode->hSyncEnd, - mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); - printf (" v: height %4d start %4d end %4d total %4d clock %6.2fHz\n", - mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, - mode_refresh (mode)); - } + print_verbose_mode(mode, False, False); } exit (0); } @@ -3739,6 +3953,46 @@ main (int argc, char **argv) } } } + if (list_monitors || list_active_monitors) { + + if (!has_1_5) { + printf("RandR 1.5 not supported\n"); + exit(0); + } + + get_screen(current); + get_monitors(list_active_monitors ? True : False); + get_crtcs(); + get_outputs(); + + if (monitors) { + int m, o; + + printf("Monitors: %d\n", monitors->n); + + for (m = 0; m < monitors->n; m++) { + printf (" %d: %s%s%s %d/%dx%d/%d+%d+%d ", + m, + monitors->monitors[m].automatic ? "+" : "", + monitors->monitors[m].primary ? "*" : "", + XGetAtomName(dpy, monitors->monitors[m].name), + monitors->monitors[m].width, + monitors->monitors[m].mwidth, + monitors->monitors[m].height, + monitors->monitors[m].mheight, + monitors->monitors[m].x, + monitors->monitors[m].y); + for (o = 0; o < monitors->monitors[m].noutput; o++) { + output_t *output = find_output_by_xid(monitors->monitors[m].outputs[o]); + if (output) + printf (" %s", output->output.string); + else + printf (" unknown output 0x%x\n", (CARD32) monitors->monitors[m].outputs[o]); + } + printf ("\n"); + } + } + } sc = XRRGetScreenInfo (dpy, root); |