SCRIPTLINKS += play-rawk
SCRIPTLINKS += x2x-privsep
SCRIPTLINKS += xduplic-terminal
+SCRIPTLINKS += xzoomscr
DOTCPP += .Xdefaults
Xdefaults_DEFS = -DEMACSWD=$(call mdw-conf,emacs-width,77)
--- /dev/null
+#! /bin/sh -e
+
+case $# in 1) ;; *) echo >&2 "usage: $1 ZOOM"; exit 2 ;; esac
+zoom=$1
+
+ok=nil
+case ${DISPLAY-nil} in
+ *:*[!0-9.]*) ;;
+ *:*.*.*) ;;
+ *:*.*) ok=t dpybase=${DISPLAY%.*} ;;
+ *:*) ok=t dpybase=$DISPLAY ;;
+esac
+case ok in nil) echo >&2 "$0: bad DISPLAY"; exit 2 ;; esac
+
+set -- $(xqueryptr); scr=$1 x=$2 y=$3
+DISPLAY=$dpybase.$scr; export DISPLAY
+
+eval $(xscsize -b)
+
+case $(( $XWIDTH % $zoom || XHEIGHT % $zoom )) in
+ 0) ;;
+ *) echo >&2 "$0: zoom multiplier doesn't divide screen size"; exit 2 ;;
+esac
+
+{ read _
+ found=nil
+ while read _ _ respos name; do
+ res=${respos%%+*} pos=${respos#*+}
+ ww=${res%x*} hh=${res#*x}
+ w=${ww%/*} h=${hh%/*}
+ x0=${pos%+*} y0=${pos#*+}
+ x1=$(( $x0 + $w )) y1=$(( $y0 + $h ))
+ case $(( $x0 <= $x && $x < $x1 && $y0 <= $y && $y < $y1 )) in
+ 1) found=t; break ;;
+ esac
+ done
+} <<EOF
+$(xrandr --listmonitors)
+EOF
+
+case $found in nil) echo >&2 "$0: pointer not on any screen?"; exit 2 ;; esac
+
+case $zoom in
+ 1) pan= ;;
+ *) pan="--panning ${XWIDTH}x${XHEIGHT}" ;;
+esac
+
+xrandr --fb ${XWIDTH}x${XHEIGHT} \
+ --output $name \
+ --mode $(( $XWIDTH/$zoom ))x$(( $XHEIGHT/$zoom )) \
+ $pan
KeyDown 5 Down area move 0 1
KeyDown 5 Left area move -1 0
KeyDown 5 Right area move 1 0
+KeyDown C5 1 exec xzoomscr 1
+KeyDown C5 2 exec xzoomscr 2
+KeyDown C5 3 exec xzoomscr 3
+KeyDown C5 4 exec xzoomscr 4
KeyDown C5 a desk arrange
KeyDown C5 c cm start
KeyDown C5 d exec xfce4-display-settings