Laércio de Sousa has proposed merging lp:~oiteam/epoptes/x11vnc-wrapper-with-alt-input-grabbing into lp:epoptes.
Requested reviews: Epoptes Developers (epoptes) Related bugs: Bug #1428141 in Epoptes: "Clients' local pointer movement can't be grabbed when they get assisted" https://bugs.launchpad.net/epoptes/+bug/1428141 For more details, see: https://code.launchpad.net/~oiteam/epoptes/x11vnc-wrapper-with-alt-input-grabbing/+merge/273703 We're proposing a x11vnc wrapper with an alternative treatment for -grabkbd and -grabptr options. This is a workaround for a x11vnc -grabptr limitation where only mouse buttons, but not pointer movement, can be grabbed. It's also a workaround for a x11vnc bug where remote client windows can't be dragged within VNC viewer, if -grabkbd is passed (https://github.com/LibVNC/x11vnc/issues/18). -- Your team Orientadores de Informática is subscribed to branch lp:~oiteam/epoptes/x11vnc-wrapper-with-alt-input-grabbing.
=== modified file 'data/client-functions' --- data/client-functions 2015-08-22 17:30:18 +0000 +++ data/client-functions 2015-10-07 14:43:39 +0000 @@ -222,6 +222,79 @@ background ./message "$1" "$2" "$3" } +# Wraps x11vnc with an alternative treatment +# for -grabkbd and -grabptr options. +# +# This is a workaround for a x11vnc -grabptr limitation +# where only mouse buttons, but not pointer movement, +# can be grabbed. +# +# It's also a workaround for a x11vnc bug where +# remote client windows can't be dragged within +# VNC viewer, if -grabkbd is passed. +# (https://github.com/LibVNC/x11vnc/issues/18) +# +# Parameters: +# $1..$N = x11vnc arguments. +x11vnc_wrapper() { + local devices="" + local args="" + local x11vnc_pid="" + + while [ $# -gt 0 ]; do + case "$1" in + -grabkbd) + devices="$devices $(xinput --list | awk '/slave.*keyboard/ { + if ($0 !~ /XTEST/) { + match($0, /id=[0-9]+/) + if (RSTART) + print substr($0, RSTART+3, RLENGTH-3) + } + }')" + ;; + + -grabptr) + devices="$devices $(xinput --list | awk '/slave.*pointer/ { + if ($0 !~ /XTEST/) { + match($0, /id=[0-9]+/) + if (RSTART) + print substr($0, RSTART+3, RLENGTH-3) + } + }')" + ;; + + *) + args="$args $1" + ;; + esac + + shift + done + + # Grab input devices + for i in $devices; do + xinput --set-prop $i "Device Enabled" 0 + done + + # Just a safety measure to ensure input devices + # will be properly ungrabbed if we receive a + # SIGTERM or SIGINT while x11vnc is running. + # + # Uses SIGTERM-propagation scheme as proposed in + # http://veithen.github.io/2014/11/16/sigterm-propagation.html + trap 'kill -TERM $x11vnc_pid' TERM INT + x11vnc $args & + x11vnc_pid=$! + wait $x11vnc_pid + trap - TERM INT + wait $x11vnc_pid + + # Ungrab input devices + for i in $devices; do + xinput --set-prop $i "Device Enabled" 1 + done +} + # Connect to the server to be monitored. # Parameters: # $1 = port. @@ -234,7 +307,7 @@ # $1 = port. # $2 = grab keyboard and mouse. get_assisted() { - background x11vnc -noshm -24to32 ${2:+-grabptr -grabkbd} -connect_or_exit "$SERVER:$1" + background x11vnc_wrapper -noshm -24to32 ${2:+-grabptr -grabkbd} -connect_or_exit "$SERVER:$1" } # Deactivate the screensaver, in order for the users to watch a broadcast. === modified file 'debian/control' --- debian/control 2015-10-06 19:20:25 +0000 +++ debian/control 2015-10-07 14:43:39 +0000 @@ -32,7 +32,7 @@ Architecture: all Depends: ${python:Depends}, ${misc:Depends}, bsdmainutils, iperf, iproute2 | iproute, librsvg2-common, procps, python-gtk2, - screen, socat, x11vnc, xvnc4viewer | ssvnc | vnc-viewer + screen, socat, x11vnc, xvnc4viewer | ssvnc | vnc-viewer, xinput Recommends: openssl, xterm Suggests: ethtool Description: Computer lab management tool (client)
-- Mailing list: https://launchpad.net/~oiteam Post to : oiteam@lists.launchpad.net Unsubscribe : https://launchpad.net/~oiteam More help : https://help.launchpad.net/ListHelp