Commit 07952847 authored by runge's avatar runge

x11vnc: add uinput support for full input into linux fb device (e.g. qt-embed).

parent 8cda6096
2006-07-08 Karl Runge <runge@karlrunge.com>
* configure.ac: add <linux/uinput.h> for linux console.
2006-07-04 Karl Runge <runge@karlrunge.com> 2006-07-04 Karl Runge <runge@karlrunge.com>
* configure.ac: add getspnam. * configure.ac: add getspnam.
......
...@@ -62,6 +62,8 @@ AH_TEMPLATE(HAVE_IRIX_XREADDISPLAY, [IRIX XReadDisplay available]) ...@@ -62,6 +62,8 @@ AH_TEMPLATE(HAVE_IRIX_XREADDISPLAY, [IRIX XReadDisplay available])
AH_TEMPLATE(HAVE_FBPM, [FBPM extension build environment present]) AH_TEMPLATE(HAVE_FBPM, [FBPM extension build environment present])
AH_TEMPLATE(HAVE_LINUX_VIDEODEV_H, [video4linux build environment present]) AH_TEMPLATE(HAVE_LINUX_VIDEODEV_H, [video4linux build environment present])
AH_TEMPLATE(HAVE_LINUX_FB_H, [linux fb device build environment present]) AH_TEMPLATE(HAVE_LINUX_FB_H, [linux fb device build environment present])
AH_TEMPLATE(HAVE_LINUX_INPUT_H, [linux/input.h present])
AH_TEMPLATE(HAVE_LINUX_UINPUT_H, [linux uinput device build environment present])
AC_ARG_WITH(xkeyboard, AC_ARG_WITH(xkeyboard,
[ --without-xkeyboard disable xkeyboard extension support],,) [ --without-xkeyboard disable xkeyboard extension support],,)
...@@ -83,6 +85,8 @@ AC_ARG_WITH(v4l, ...@@ -83,6 +85,8 @@ AC_ARG_WITH(v4l,
[ --without-v4l disable video4linux support],,) [ --without-v4l disable video4linux support],,)
AC_ARG_WITH(fbdev, AC_ARG_WITH(fbdev,
[ --without-fbdev disable linux fb device support],,) [ --without-fbdev disable linux fb device support],,)
AC_ARG_WITH(uinput,
[ --without-uinput disable linux uinput device support],,)
if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
AC_CHECK_LIB(X11, XGetImage, HAVE_X="true", AC_CHECK_LIB(X11, XGetImage, HAVE_X="true",
...@@ -237,6 +241,14 @@ if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then ...@@ -237,6 +241,14 @@ if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
AC_CHECK_HEADER(linux/fb.h, AC_CHECK_HEADER(linux/fb.h,
[AC_DEFINE(HAVE_LINUX_FB_H)],,) [AC_DEFINE(HAVE_LINUX_FB_H)],,)
fi fi
if test "x$with_uinput" != "xno"; then
AC_CHECK_HEADER(linux/input.h,
[AC_DEFINE(HAVE_LINUX_INPUT_H) HAVE_LINUX_INPUT_H="true"],,)
if test "x$HAVE_LINUX_INPUT_H" = "xtrue"; then
AC_CHECK_HEADER(linux/uinput.h,
[AC_DEFINE(HAVE_LINUX_UINPUT_H)],, [#include <linux/input.h>])
fi
fi
X_LIBS="$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS" X_LIBS="$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS"
fi fi
......
2006-07-08 Karl Runge <runge@karlrunge.com>
* x11vnc: add uinput support (-pipeinput UINPUT:...) for full
mouse and key input to linux console (e.g. for qt-embedded apps)
add -allinput for handleEventsEagerly.
2006-07-04 Karl Runge <runge@karlrunge.com> 2006-07-04 Karl Runge <runge@karlrunge.com>
* x11vnc: 2nd -accept popup with WAIT, and UNIX: info for unixpw * x11vnc: 2nd -accept popup with WAIT, and UNIX: info for unixpw
login. Use RFB_CLIENT_ON_HOLD for -unixpw. -unixpw white arrow login. Use RFB_CLIENT_ON_HOLD for -unixpw. -unixpw white arrow
......
...@@ -13,7 +13,7 @@ endif ...@@ -13,7 +13,7 @@ endif
if HAVE_X if HAVE_X
bin_PROGRAMS=x11vnc bin_PROGRAMS=x11vnc
x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c uinput.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h uinput.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h
INCLUDES=@X_CFLAGS@ INCLUDES=@X_CFLAGS@
x11vnc_LDADD=$(LDADD) @X_LIBS@ $(LD_CYGIPC) x11vnc_LDADD=$(LDADD) @X_LIBS@ $(LD_CYGIPC)
endif endif
......
x11vnc README file Date: Tue Jul 4 19:57:31 EDT 2006 x11vnc README file Date: Sat Jul 8 19:22:13 EDT 2006
The following information is taken from these URLs: The following information is taken from these URLs:
...@@ -7196,7 +7196,7 @@ x11vnc: a VNC server for real X displays ...@@ -7196,7 +7196,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.8.2 lastmod: 2006-07-04 x11vnc: allow VNC connections to real X11 displays. 0.8.2 lastmod: 2006-07-08
x11vnc options: x11vnc options:
-display disp -auth file -id windowid -display disp -auth file -id windowid
...@@ -7246,21 +7246,21 @@ x11vnc options: ...@@ -7246,21 +7246,21 @@ x11vnc options:
-fixscreen string -debug_scroll -noxrecord -fixscreen string -debug_scroll -noxrecord
-grab_buster -nograb_buster -debug_grabs -grab_buster -nograb_buster -debug_grabs
-debug_sel -pointer_mode n -input_skip n -debug_sel -pointer_mode n -input_skip n
-speeds rd,bw,lat -wmdt string -debug_pointer -allinput -speeds rd,bw,lat -wmdt string
-debug_keyboard -defer time -wait time -debug_pointer -debug_keyboard -defer time
-wait_ui factor -nowait_bog -slow_fb time -wait time -wait_ui factor -nowait_bog
-readtimeout n -nap -nonap -slow_fb time -readtimeout n -nap
-sb time -nofbpm -fbpm -nonap -sb time -nofbpm
-noxdamage -xd_area A -xd_mem f -fbpm -noxdamage -xd_area A
-sigpipe string -threads -nothreads -xd_mem f -sigpipe string -threads
-fs f -gaps n -grow n -nothreads -fs f -gaps n
-fuzz n -debug_tiles -snapfb -grow n -fuzz n -debug_tiles
-rawfb string -freqtab file -pipeinput cmd -snapfb -rawfb string -freqtab file
-gui [gui-opts] -remote command -query variable -pipeinput cmd -gui [gui-opts] -remote command
-QD variable -sync -noremote -query variable -QD variable -sync
-yesremote -unsafe -safer -noremote -yesremote -unsafe
-privremote -nocmds -allowedcmds list -safer -privremote -nocmds
-deny_all -allowedcmds list -deny_all
libvncserver options: libvncserver options:
-rfbport port TCP port for RFB protocol -rfbport port TCP port for RFB protocol
...@@ -7294,7 +7294,7 @@ libvncserver-tight-extension options: ...@@ -7294,7 +7294,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.8.2 lastmod: 2006-07-04 x11vnc: allow VNC connections to real X11 displays. 0.8.2 lastmod: 2006-07-08
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)
...@@ -9457,6 +9457,9 @@ Options: ...@@ -9457,6 +9457,9 @@ Options:
means to act as though there is always user input. means to act as though there is always user input.
Default: 10 Default: 10
-allinput Have x11vnc read and process all available client input
before proceeding.
-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that -speeds rd,bw,lat x11vnc tries to estimate some speed parameters that
are used to optimize scheduling (e.g. -pointer_mode are used to optimize scheduling (e.g. -pointer_mode
4, -wireframe, -scrollcopyrect) and other things. 4, -wireframe, -scrollcopyrect) and other things.
...@@ -9613,13 +9616,19 @@ Options: ...@@ -9613,13 +9616,19 @@ Options:
For shared memory segments string is of the For shared memory segments string is of the
form: "shm:N@WxHxB" which specifies a shmid form: "shm:N@WxHxB" which specifies a shmid
N and framebuffer Width, Height, and Bits N and framebuffer Width, Height, and Bits
per pixel. To memory map mmap(2) a file use: per pixel.
"map:/path/to/a/file@WxHxB". If there is trouble
with mmap, use "file:/..." for slower lseek(2) based For file polling to memory map mmap(2) a file use:
reading. Use "snap:..." to imply -snapfb mode and the "map:/path/to/a/file@WxHxB", with WxHxB as above.
"file:" access (this is for devices that only provide "mmap:..." is the same. If there is trouble with mmap,
the fb all at once). If you do not supply a type "map" use "file:/..." for slower lseek(2) based reading.
is assumed if the file exists. Use "snap:..." to imply -snapfb mode and the "file:"
access (this is for devices that only provide the fb
all at once).
If you do not supply a type "map" is assumed if
the file exists (see the next paragraphs for some
exceptions to this.)
If string is "setup:cmd", then the command "cmd" If string is "setup:cmd", then the command "cmd"
is run and the first line from it is read and used is run and the first line from it is read and used
...@@ -9627,13 +9636,14 @@ Options: ...@@ -9627,13 +9636,14 @@ Options:
determining WxHxB, etc. These are often done as root determining WxHxB, etc. These are often done as root
so take care. so take care.
If the string begins with "video", see the video4linux If the string begins with "video", see the VIDEO4LINUX
discusion below where the device may be queried for discusion below where the device may be queried for
(and possibly set) the framebuffer parameters. (and possibly set) the framebuffer parameters.
If the strings begins with "cons", see the linux If the string begins with "cons", "/dev/fb", or
console discussion below where the framebuffer device "fb", see the LINUX CONSOLE discussion below where
is opened and keystrokes are inserted into the console. the framebuffer device is opened and keystrokes (and
possibly mouse events) are inserted into the console.
Optional suffixes are ":R/G/B" and "+O" to specify Optional suffixes are ":R/G/B" and "+O" to specify
red, green, and blue masks and an offset into the red, green, and blue masks and an offset into the
...@@ -9653,11 +9663,12 @@ Options: ...@@ -9653,11 +9663,12 @@ Options:
(see ipcs(1) and fbset(1) for the first two examples) (see ipcs(1) and fbset(1) for the first two examples)
All user input is discarded by default (but see the In general all user input is discarded by default (see
-pipeinput option). Most of the X11 (screen, keyboard, the -pipeinput option for how to use a helper program
mouse) options do not make sense and many will cause to insert). Most of the X11 (screen, keyboard, mouse)
this mode to crash, so please think twice before options do not make sense and many will cause this
setting or changing them in a running x11vnc. mode to crash, so please think twice before setting or
changing them in a running x11vnc.
If you DO NOT want x11vnc to close the X DISPLAY in If you DO NOT want x11vnc to close the X DISPLAY in
rawfb mode, prepend a "+" e.g. +file:/dev/fb0... rawfb mode, prepend a "+" e.g. +file:/dev/fb0...
...@@ -9676,13 +9687,13 @@ Options: ...@@ -9676,13 +9687,13 @@ Options:
SNAPFB_RAWFB_RESET=1 as well. SNAPFB_RAWFB_RESET=1 as well.
If you want x11vnc to dynamically transform a 24bpp If you want x11vnc to dynamically transform a 24bpp
rawfb to 32bpp (note that this will be slower) use rawfb to 32bpp (note that this will be slower) also
the -24to32 option. This would be useful for, say, supply the -24to32 option. This would be useful for,
for a video camera that delivers the pixel data as say, a video camera that delivers the pixel data as
24bpp packed RGB. This is the default under "video" 24bpp packed RGB. This is the default under "video"
mode if the bpp is 24. mode if the bpp is 24.
video4linux: on Linux some attempt is made to handle VIDEO4LINUX: on Linux some attempt is made to handle
video devices (webcams or TV tuners) automatically. video devices (webcams or TV tuners) automatically.
The idea is the WxHxB will be extracted from the The idea is the WxHxB will be extracted from the
device itself. So if you do not supply "@WxHxB... device itself. So if you do not supply "@WxHxB...
...@@ -9760,44 +9771,63 @@ Options: ...@@ -9760,44 +9771,63 @@ Options:
See the -pipeinput VID option below for a way to control See the -pipeinput VID option below for a way to control
the settings through the VNC Viewer via keystrokes. the settings through the VNC Viewer via keystrokes.
As a shortcut, if the string begins "Video.." instead
of "video.." then -pipeinput VID is implied.
As above, if you specify a "@WxHxB..." after the As above, if you specify a "@WxHxB..." after the
<settings> string they are used verbatim: the device <settings> string they are used verbatim: the device
is not queried for the current values. Otherwise the is not queried for the current values. Otherwise the
device will be queried. device will be queried.
Linux console: If the libvncserver LinuxVNC command is LINUX CONSOLE: If the libvncserver LinuxVNC program
on your system use that instead of the following method is on your system you may want to use that instead of
because it will be faster and more accurate for Linux the following method because it will be faster and more
text console. accurate for Linux text console.
If the rawfb string begins with "cons" the framebuffer If the rawfb string begins with "cons" the framebuffer
device /dev/fb0 is opened (this requires the appropriate device /dev/fb0 is opened (this requires the appropriate
kernel modules) and so is /dev/tty0. The latter is kernel modules to be installed) and so is /dev/tty0.
used to inject keystrokes (not all are supported, The latter is used to inject keystrokes (not all are
but the basic ones are). You will need to be root to supported, but the basic ones are). You will need to
inject keystrokes. /dev/tty0 refers to the active VT, be root to inject keystrokes. /dev/tty0 refers to the
to indicate one explicitly, use "cons2", etc. using active VT, to indicate one explicitly, use "cons2",
the VT number. Note you can change VT remotely using etc. using the VT number.
the chvt(1) command. Sometimes switching out and back
corrects the framebuffer. To skip injecting entirely If the Linux version seems to be 2.6 or later and the
use "consx". "uinput" module appears to be present, then the uinput
method will be used instead of /dev/ttyN. uinput allows
insertion of BOTH keystrokes and mouse input and so it
preferred when accessing graphical (e.g. QT-embedded)
linux console apps. See -pipeinput UINPUT below
for more information on this mode (you may want to
also use the -nodragging and -cursor none options).
Use "cons0", etc or -pipeinput CONS to force the
/dev/ttyN method.
Note you can change VT remotely using the chvt(1)
command. Sometimes switching out and back corrects
the framebuffer state.
To skip input injecting entirely use "consx".
The strings "console", or "/dev/fb0" can be used The strings "console", or "/dev/fb0" can be used
instead of "cons". The latter can be used to specify instead of "cons". The latter can be used to specify
a different framebuffer device, e.g. /dev/fb1. If the a different framebuffer device, e.g. /dev/fb1. As a
name is something nonstandard, use "cons:/dev/foofb" shortcut the "/dev/" can be dropped. If the name is
something nonstandard, use "cons:/dev/foofb"
If you do not want x11vnc to guess the framebuffer's If you do not want x11vnc to guess the framebuffer's
WxHxB and masks automatically, specify them with a WxHxB and masks automatically (sometimes the kernel
given inaccurate information), specify them with a
@WxHxB at the end of the string. @WxHxB at the end of the string.
Examples: Examples:
-rawfb cons (same as -rawfb console) -rawfb cons (same as -rawfb console)
-rawfb /dev/fb0 (same) -rawfb /dev/fb0 (same)
-rawfb cons3 (force /dev/tty3) -rawfb cons3 (force /dev/tty3)
-rawfb consx (no keystrokes) -rawfb consx (no keystrokes or mouse)
-rawfb console:/dev/nonstd -rawfb console:/dev/nonstd
-rawfb cons -pipeinput UINPUT:accel=1.5
-freqtab file For use with "-rawfb video" for TV tuner devices to -freqtab file For use with "-rawfb video" for TV tuner devices to
specify station frequencies. Instead of using the built specify station frequencies. Instead of using the built
...@@ -9826,6 +9856,8 @@ Options: ...@@ -9826,6 +9856,8 @@ Options:
value is stored in X11VNC_RAWFB_STR for the pipe command value is stored in X11VNC_RAWFB_STR for the pipe command
to use if it wants. Do 'env | grep X11VNC' for more. to use if it wants. Do 'env | grep X11VNC' for more.
Built-in pipeinput modes:
If cmd is "VID" and you are using the -rawfb for a If cmd is "VID" and you are using the -rawfb for a
video capture device, then an internal list of keyboard video capture device, then an internal list of keyboard
mappings is used to set parameters of the video. mappings is used to set parameters of the video.
...@@ -9844,7 +9876,57 @@ Options: ...@@ -9844,7 +9876,57 @@ Options:
If cmd is "CONS" or "CONSn" where n is a Linux If cmd is "CONS" or "CONSn" where n is a Linux
console number, then the linux console keystroke console number, then the linux console keystroke
insertion (see -rawfb cons) is performed. insertion to /dev/ttyN (see -rawfb cons) is performed.
If cmd begins with "UINPUT" then the Linux uinput
module is used to insert both keystroke and mouse events
to the Linux console (see -rawfb above). This usually
is the /dev/input/uinput device file (you may need to
create it with "mknod /dev/input/uinput c 10 223"
and insert the module with "modprobe uinput".
The UINPUT mode currently only does US keyboards (a
scan code option may be added), and not all keysyms
are supported.
You may want to use the options -cursor none and
-nodragging in this mode.
Additional tuning options may be supplied via:
UINPUT:opt1,opt2,... (a comma separated list). If an
option begins with "/" it is taken as the uinput
device file.
Which uinput is injected can be controlled by an option
string made of the characters "K", "M", and "B"
(see the -input option), e.g. "KM" allows keystroke
and motion but not button clicks.
A UINPUT option of the form: accel=f, or accel=fx+fy
sets the mouse motion "acceleration". This is used
to correct raw mouse relative motion into how much the
application cursor moves (x11vnc has no control over
how the application interprets the raw mouse motions).
Typically the acceleration for an X display is 2 (see
xset "m" option). "f" is a floating point number,
e.g. 2.0. Use "fx+fy" if you need to supply different
corrections for x and y.
Note: the default acceleration is 2.0 since it seems
both X and qt-embedded often use this value.
Even with a correct accel setting the mouse position
will get out of sync (probably due to a mouse
"threshold" setting where the acceleration doe not
apply, set xset(1)). The option reset=N sets the number
of ms (default 500) after which the cursor is attempted
to be reset (by forcing the mouse to (0, 0) via small
increments and then back out to (x, y) in 1 jump), This
correction seems to be needed but can cause jerkiness
or unexpected behavior. Use reset=0 to disable.
Example:
-pipeinput UINPUT:accel=1.0 -cursor none
-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote -gui [gui-opts] Start up a simple tcl/tk gui based on the the remote
control options -remote/-query described below. control options -remote/-query described below.
...@@ -10166,6 +10248,8 @@ n ...@@ -10166,6 +10248,8 @@ n
reset_record reset RECORD extension (if avail.) reset_record reset RECORD extension (if avail.)
pointer_mode:n set -pointer_mode to n. same as "pm" pointer_mode:n set -pointer_mode to n. same as "pm"
input_skip:n set -input_skip to n. input_skip:n set -input_skip to n.
allinput enable use of -allinput mode.
noallinput disable use of -allinput mode.
speeds:str set -speeds to str. speeds:str set -speeds to str.
wmdt:str set -wmdt to str. wmdt:str set -wmdt to str.
debug_pointer enable -debug_pointer, same as "dp" debug_pointer enable -debug_pointer, same as "dp"
...@@ -10195,6 +10279,8 @@ n ...@@ -10195,6 +10279,8 @@ n
snapfb enable -snapfb mode. snapfb enable -snapfb mode.
nosnapfb disable -snapfb mode. nosnapfb disable -snapfb mode.
rawfb:str set -rawfb mode to "str". rawfb:str set -rawfb mode to "str".
uinput_accel:f set uinput_accel to f.
uinput_reset:n set uinput_reset to n ms.
progressive:n set libvncserver -progressive slice progressive:n set libvncserver -progressive slice
height parameter to n. height parameter to n.
desktop:str set -desktop name to str for new clients desktop:str set -desktop name to str for new clients
...@@ -10268,7 +10354,6 @@ n ...@@ -10268,7 +10354,6 @@ n
remote command, we hope the name makes it obvious what remote command, we hope the name makes it obvious what
the returned value corresponds to (hint: the ext_* the returned value corresponds to (hint: the ext_*
variables correspond to the presence of X extensions): variables correspond to the presence of X extensions):
ans= stop quit exit shutdown ping blacken zero ans= stop quit exit shutdown ping blacken zero
refresh reset close disconnect id sid waitmapped refresh reset close disconnect id sid waitmapped
nowaitmapped clip flashcmap noflashcmap shiftcmap nowaitmapped clip flashcmap noflashcmap shiftcmap
...@@ -10299,16 +10384,17 @@ n ...@@ -10299,16 +10384,17 @@ n
nodragging wireframe_mode wireframe wf nowireframe nodragging wireframe_mode wireframe wf nowireframe
nowf wirecopyrect wcr nowirecopyrect nowcr scr_area nowf wirecopyrect wcr nowirecopyrect nowcr scr_area
scr_skip scr_inc scr_keys scr_term scr_keyrepeat scr_skip scr_inc scr_keys scr_term scr_keyrepeat
scr_parms scrollcopyrect scr noscrollcopyrect noscr scr_parms scrollcopyrect scr noscrollcopyrect
fixscreen noxrecord xrecord reset_record pointer_mode noscr fixscreen noxrecord xrecord reset_record
pm input_skip input grabkbd nograbkbd grabptr pointer_mode pm input_skip allinput noallinput input
nograbptr client_input speeds wmdt debug_pointer dp grabkbd nograbkbd grabptr nograbptr client_input
nodebug_pointer nodp debug_keyboard dk nodebug_keyboard speeds wmdt debug_pointer dp nodebug_pointer nodp
nodk deferupdate defer wait_ui wait_bog nowait_bog debug_keyboard dk nodebug_keyboard nodk deferupdate
slow_fb wait readtimeout nap nonap sb screen_blank defer wait_ui wait_bog nowait_bog slow_fb wait
fbpm nofbpm fs gaps grow fuzz snapfb nosnapfb rawfb readtimeout nap nonap sb screen_blank fbpm nofbpm
progressive rfbport http nohttp httpport httpdir fs gaps grow fuzz snapfb nosnapfb rawfb uinput_accel
enablehttpproxy noenablehttpproxy alwaysshared uinput_reset progressive rfbport http nohttp httpport
httpdir enablehttpproxy noenablehttpproxy alwaysshared
noalwaysshared nevershared noalwaysshared dontdisconnect noalwaysshared nevershared noalwaysshared dontdisconnect
nodontdisconnect desktop debug_xevents nodebug_xevents nodontdisconnect desktop debug_xevents nodebug_xevents
debug_xevents debug_xdamage nodebug_xdamage debug_xevents debug_xdamage nodebug_xdamage
...@@ -10333,7 +10419,6 @@ n ...@@ -10333,7 +10419,6 @@ n
mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y
wdpy_x wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y wdpy_x wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y
rfbauth passwd viewpasswd rfbauth passwd viewpasswd
-QD variable Just like -query variable, but returns the default -QD variable Just like -query variable, but returns the default
value for that parameter (no running x11vnc server value for that parameter (no running x11vnc server
is consulted) is consulted)
......
...@@ -2192,6 +2192,9 @@ void print_help(int mode) { ...@@ -2192,6 +2192,9 @@ void print_help(int mode) {
" means to act as though there is always user input.\n" " means to act as though there is always user input.\n"
" Default: %d\n" " Default: %d\n"
"\n" "\n"
"-allinput Have x11vnc read and process all available client input\n"
" before proceeding.\n"
"\n"
"-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that\n" "-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that\n"
" are used to optimize scheduling (e.g. -pointer_mode\n" " are used to optimize scheduling (e.g. -pointer_mode\n"
" 4, -wireframe, -scrollcopyrect) and other things.\n" " 4, -wireframe, -scrollcopyrect) and other things.\n"
...@@ -2348,13 +2351,19 @@ void print_help(int mode) { ...@@ -2348,13 +2351,19 @@ void print_help(int mode) {
" For shared memory segments string is of the\n" " For shared memory segments string is of the\n"
" form: \"shm:N@WxHxB\" which specifies a shmid\n" " form: \"shm:N@WxHxB\" which specifies a shmid\n"
" N and framebuffer Width, Height, and Bits\n" " N and framebuffer Width, Height, and Bits\n"
" per pixel. To memory map mmap(2) a file use:\n" " per pixel.\n"
" \"map:/path/to/a/file@WxHxB\". If there is trouble\n" "\n"
" with mmap, use \"file:/...\" for slower lseek(2) based\n" " For file polling to memory map mmap(2) a file use:\n"
" reading. Use \"snap:...\" to imply -snapfb mode and the\n" " \"map:/path/to/a/file@WxHxB\", with WxHxB as above.\n"
" \"file:\" access (this is for devices that only provide\n" " \"mmap:...\" is the same. If there is trouble with mmap,\n"
" the fb all at once). If you do not supply a type \"map\"\n" " use \"file:/...\" for slower lseek(2) based reading.\n"
" is assumed if the file exists.\n" " Use \"snap:...\" to imply -snapfb mode and the \"file:\"\n"
" access (this is for devices that only provide the fb\n"
" all at once).\n"
"\n"
" If you do not supply a type \"map\" is assumed if\n"
" the file exists (see the next paragraphs for some\n"
" exceptions to this.)\n"
"\n" "\n"
" If string is \"setup:cmd\", then the command \"cmd\"\n" " If string is \"setup:cmd\", then the command \"cmd\"\n"
" is run and the first line from it is read and used\n" " is run and the first line from it is read and used\n"
...@@ -2362,13 +2371,14 @@ void print_help(int mode) { ...@@ -2362,13 +2371,14 @@ void print_help(int mode) {
" determining WxHxB, etc. These are often done as root\n" " determining WxHxB, etc. These are often done as root\n"
" so take care.\n" " so take care.\n"
"\n" "\n"
" If the string begins with \"video\", see the video4linux\n" " If the string begins with \"video\", see the VIDEO4LINUX\n"
" discusion below where the device may be queried for\n" " discusion below where the device may be queried for\n"
" (and possibly set) the framebuffer parameters.\n" " (and possibly set) the framebuffer parameters.\n"
"\n" "\n"
" If the strings begins with \"cons\", see the linux\n" " If the string begins with \"cons\", \"/dev/fb\", or\n"
" console discussion below where the framebuffer device\n" " \"fb\", see the LINUX CONSOLE discussion below where\n"
" is opened and keystrokes are inserted into the console.\n" " the framebuffer device is opened and keystrokes (and\n"
" possibly mouse events) are inserted into the console.\n"
"\n" "\n"
" Optional suffixes are \":R/G/B\" and \"+O\" to specify\n" " Optional suffixes are \":R/G/B\" and \"+O\" to specify\n"
" red, green, and blue masks and an offset into the\n" " red, green, and blue masks and an offset into the\n"
...@@ -2388,11 +2398,12 @@ void print_help(int mode) { ...@@ -2388,11 +2398,12 @@ void print_help(int mode) {
"\n" "\n"
" (see ipcs(1) and fbset(1) for the first two examples)\n" " (see ipcs(1) and fbset(1) for the first two examples)\n"
"\n" "\n"
" All user input is discarded by default (but see the\n" " In general all user input is discarded by default (see\n"
" -pipeinput option). Most of the X11 (screen, keyboard,\n" " the -pipeinput option for how to use a helper program\n"
" mouse) options do not make sense and many will cause\n" " to insert). Most of the X11 (screen, keyboard, mouse)\n"
" this mode to crash, so please think twice before\n" " options do not make sense and many will cause this\n"
" setting or changing them in a running x11vnc.\n" " mode to crash, so please think twice before setting or\n"
" changing them in a running x11vnc.\n"
"\n" "\n"
" If you DO NOT want x11vnc to close the X DISPLAY in\n" " If you DO NOT want x11vnc to close the X DISPLAY in\n"
" rawfb mode, prepend a \"+\" e.g. +file:/dev/fb0...\n" " rawfb mode, prepend a \"+\" e.g. +file:/dev/fb0...\n"
...@@ -2411,13 +2422,13 @@ void print_help(int mode) { ...@@ -2411,13 +2422,13 @@ void print_help(int mode) {
" SNAPFB_RAWFB_RESET=1 as well.\n" " SNAPFB_RAWFB_RESET=1 as well.\n"
"\n" "\n"
" If you want x11vnc to dynamically transform a 24bpp\n" " If you want x11vnc to dynamically transform a 24bpp\n"
" rawfb to 32bpp (note that this will be slower) use\n" " rawfb to 32bpp (note that this will be slower) also\n"
" the -24to32 option. This would be useful for, say,\n" " supply the -24to32 option. This would be useful for,\n"
" for a video camera that delivers the pixel data as\n" " say, a video camera that delivers the pixel data as\n"
" 24bpp packed RGB. This is the default under \"video\"\n" " 24bpp packed RGB. This is the default under \"video\"\n"
" mode if the bpp is 24.\n" " mode if the bpp is 24.\n"
"\n" "\n"
" video4linux: on Linux some attempt is made to handle\n" " VIDEO4LINUX: on Linux some attempt is made to handle\n"
" video devices (webcams or TV tuners) automatically.\n" " video devices (webcams or TV tuners) automatically.\n"
" The idea is the WxHxB will be extracted from the\n" " The idea is the WxHxB will be extracted from the\n"
" device itself. So if you do not supply \"@WxHxB...\n" " device itself. So if you do not supply \"@WxHxB...\n"
...@@ -2495,44 +2506,63 @@ void print_help(int mode) { ...@@ -2495,44 +2506,63 @@ void print_help(int mode) {
"\n" "\n"
" See the -pipeinput VID option below for a way to control\n" " See the -pipeinput VID option below for a way to control\n"
" the settings through the VNC Viewer via keystrokes.\n" " the settings through the VNC Viewer via keystrokes.\n"
" As a shortcut, if the string begins \"Video..\" instead\n"
" of \"video..\" then -pipeinput VID is implied.\n"
"\n" "\n"
" As above, if you specify a \"@WxHxB...\" after the\n" " As above, if you specify a \"@WxHxB...\" after the\n"
" <settings> string they are used verbatim: the device\n" " <settings> string they are used verbatim: the device\n"
" is not queried for the current values. Otherwise the\n" " is not queried for the current values. Otherwise the\n"
" device will be queried.\n" " device will be queried.\n"
"\n" "\n"
" Linux console: If the libvncserver LinuxVNC command is\n" " LINUX CONSOLE: If the libvncserver LinuxVNC program\n"
" on your system use that instead of the following method\n" " is on your system you may want to use that instead of\n"
" because it will be faster and more accurate for Linux\n" " the following method because it will be faster and more\n"
" text console.\n" " accurate for Linux text console.\n"
"\n" "\n"
" If the rawfb string begins with \"cons\" the framebuffer\n" " If the rawfb string begins with \"cons\" the framebuffer\n"
" device /dev/fb0 is opened (this requires the appropriate\n" " device /dev/fb0 is opened (this requires the appropriate\n"
" kernel modules) and so is /dev/tty0. The latter is\n" " kernel modules to be installed) and so is /dev/tty0.\n"
" used to inject keystrokes (not all are supported,\n" " The latter is used to inject keystrokes (not all are\n"
" but the basic ones are). You will need to be root to\n" " supported, but the basic ones are). You will need to\n"
" inject keystrokes. /dev/tty0 refers to the active VT,\n" " be root to inject keystrokes. /dev/tty0 refers to the\n"
" to indicate one explicitly, use \"cons2\", etc. using\n" " active VT, to indicate one explicitly, use \"cons2\",\n"
" the VT number. Note you can change VT remotely using\n" " etc. using the VT number.\n"
" the chvt(1) command. Sometimes switching out and back\n" "\n"
" corrects the framebuffer. To skip injecting entirely\n" " If the Linux version seems to be 2.6 or later and the\n"
" use \"consx\".\n" " \"uinput\" module appears to be present, then the uinput\n"
" method will be used instead of /dev/ttyN. uinput allows\n"
" insertion of BOTH keystrokes and mouse input and so it\n"
" preferred when accessing graphical (e.g. QT-embedded)\n"
" linux console apps. See -pipeinput UINPUT below\n"
" for more information on this mode (you may want to\n"
" also use the -nodragging and -cursor none options).\n"
" Use \"cons0\", etc or -pipeinput CONS to force the\n"
" /dev/ttyN method.\n"
"\n"
" Note you can change VT remotely using the chvt(1)\n"
" command. Sometimes switching out and back corrects\n"
" the framebuffer state.\n"
"\n"
" To skip input injecting entirely use \"consx\".\n"
"\n" "\n"
" The strings \"console\", or \"/dev/fb0\" can be used\n" " The strings \"console\", or \"/dev/fb0\" can be used\n"
" instead of \"cons\". The latter can be used to specify\n" " instead of \"cons\". The latter can be used to specify\n"
" a different framebuffer device, e.g. /dev/fb1. If the\n" " a different framebuffer device, e.g. /dev/fb1. As a\n"
" name is something nonstandard, use \"cons:/dev/foofb\"\n" " shortcut the \"/dev/\" can be dropped. If the name is\n"
" something nonstandard, use \"cons:/dev/foofb\"\n"
"\n" "\n"
" If you do not want x11vnc to guess the framebuffer's\n" " If you do not want x11vnc to guess the framebuffer's\n"
" WxHxB and masks automatically, specify them with a\n" " WxHxB and masks automatically (sometimes the kernel\n"
" given inaccurate information), specify them with a\n"
" @WxHxB at the end of the string.\n" " @WxHxB at the end of the string.\n"
"\n" "\n"
" Examples:\n" " Examples:\n"
" -rawfb cons (same as -rawfb console)\n" " -rawfb cons (same as -rawfb console)\n"
" -rawfb /dev/fb0 (same)\n" " -rawfb /dev/fb0 (same)\n"
" -rawfb cons3 (force /dev/tty3)\n" " -rawfb cons3 (force /dev/tty3)\n"
" -rawfb consx (no keystrokes)\n" " -rawfb consx (no keystrokes or mouse)\n"
" -rawfb console:/dev/nonstd\n" " -rawfb console:/dev/nonstd\n"
" -rawfb cons -pipeinput UINPUT:accel=1.5\n"
"\n" "\n"
"-freqtab file For use with \"-rawfb video\" for TV tuner devices to\n" "-freqtab file For use with \"-rawfb video\" for TV tuner devices to\n"
" specify station frequencies. Instead of using the built\n" " specify station frequencies. Instead of using the built\n"
...@@ -2561,6 +2591,8 @@ void print_help(int mode) { ...@@ -2561,6 +2591,8 @@ void print_help(int mode) {
" value is stored in X11VNC_RAWFB_STR for the pipe command\n" " value is stored in X11VNC_RAWFB_STR for the pipe command\n"
" to use if it wants. Do 'env | grep X11VNC' for more.\n" " to use if it wants. Do 'env | grep X11VNC' for more.\n"
"\n" "\n"
" Built-in pipeinput modes:\n"
"\n"
" If cmd is \"VID\" and you are using the -rawfb for a\n" " If cmd is \"VID\" and you are using the -rawfb for a\n"
" video capture device, then an internal list of keyboard\n" " video capture device, then an internal list of keyboard\n"
" mappings is used to set parameters of the video.\n" " mappings is used to set parameters of the video.\n"
...@@ -2579,7 +2611,57 @@ void print_help(int mode) { ...@@ -2579,7 +2611,57 @@ void print_help(int mode) {
"\n" "\n"
" If cmd is \"CONS\" or \"CONSn\" where n is a Linux\n" " If cmd is \"CONS\" or \"CONSn\" where n is a Linux\n"
" console number, then the linux console keystroke\n" " console number, then the linux console keystroke\n"
" insertion (see -rawfb cons) is performed.\n" " insertion to /dev/ttyN (see -rawfb cons) is performed.\n"
"\n"
" If cmd begins with \"UINPUT\" then the Linux uinput\n"
" module is used to insert both keystroke and mouse events\n"
" to the Linux console (see -rawfb above). This usually\n"
" is the /dev/input/uinput device file (you may need to\n"
" create it with \"mknod /dev/input/uinput c 10 223\"\n"
" and insert the module with \"modprobe uinput\".\n"
"\n"
" The UINPUT mode currently only does US keyboards (a\n"
" scan code option may be added), and not all keysyms\n"
" are supported.\n"
"\n"
" You may want to use the options -cursor none and\n"
" -nodragging in this mode.\n"
"\n"
" Additional tuning options may be supplied via:\n"
" UINPUT:opt1,opt2,... (a comma separated list). If an\n"
" option begins with \"/\" it is taken as the uinput\n"
" device file.\n"
" \n"
" Which uinput is injected can be controlled by an option\n"
" string made of the characters \"K\", \"M\", and \"B\"\n"
" (see the -input option), e.g. \"KM\" allows keystroke\n"
" and motion but not button clicks.\n"
"\n"
" A UINPUT option of the form: accel=f, or accel=fx+fy\n"
" sets the mouse motion \"acceleration\". This is used\n"
" to correct raw mouse relative motion into how much the\n"
" application cursor moves (x11vnc has no control over\n"
" how the application interprets the raw mouse motions).\n"
" Typically the acceleration for an X display is 2 (see\n"
" xset \"m\" option). \"f\" is a floating point number,\n"
" e.g. 2.0. Use \"fx+fy\" if you need to supply different\n"
" corrections for x and y.\n"
"\n"
" Note: the default acceleration is 2.0 since it seems\n"
" both X and qt-embedded often use this value.\n"
"\n"
" Even with a correct accel setting the mouse position\n"
" will get out of sync (probably due to a mouse\n"
" \"threshold\" setting where the acceleration doe not\n"
" apply, set xset(1)). The option reset=N sets the number\n"
" of ms (default 500) after which the cursor is attempted\n"
" to be reset (by forcing the mouse to (0, 0) via small\n"
" increments and then back out to (x, y) in 1 jump), This\n"
" correction seems to be needed but can cause jerkiness\n"
" or unexpected behavior. Use reset=0 to disable.\n"
"\n"
" Example:\n"
" -pipeinput UINPUT:accel=1.0 -cursor none\n"
"\n" "\n"
"-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n" "-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n"
" control options -remote/-query described below.\n" " control options -remote/-query described below.\n"
...@@ -2907,6 +2989,8 @@ void print_help(int mode) { ...@@ -2907,6 +2989,8 @@ void print_help(int mode) {
" reset_record reset RECORD extension (if avail.)\n" " reset_record reset RECORD extension (if avail.)\n"
" pointer_mode:n set -pointer_mode to n. same as \"pm\"\n" " pointer_mode:n set -pointer_mode to n. same as \"pm\"\n"
" input_skip:n set -input_skip to n.\n" " input_skip:n set -input_skip to n.\n"
" allinput enable use of -allinput mode.\n"
" noallinput disable use of -allinput mode.\n"
" speeds:str set -speeds to str.\n" " speeds:str set -speeds to str.\n"
" wmdt:str set -wmdt to str.\n" " wmdt:str set -wmdt to str.\n"
" debug_pointer enable -debug_pointer, same as \"dp\"\n" " debug_pointer enable -debug_pointer, same as \"dp\"\n"
...@@ -2936,6 +3020,8 @@ void print_help(int mode) { ...@@ -2936,6 +3020,8 @@ void print_help(int mode) {
" snapfb enable -snapfb mode.\n" " snapfb enable -snapfb mode.\n"
" nosnapfb disable -snapfb mode.\n" " nosnapfb disable -snapfb mode.\n"
" rawfb:str set -rawfb mode to \"str\".\n" " rawfb:str set -rawfb mode to \"str\".\n"
" uinput_accel:f set uinput_accel to f.\n"
" uinput_reset:n set uinput_reset to n ms.\n"
" progressive:n set libvncserver -progressive slice\n" " progressive:n set libvncserver -progressive slice\n"
" height parameter to n.\n" " height parameter to n.\n"
" desktop:str set -desktop name to str for new clients.\n" " desktop:str set -desktop name to str for new clients.\n"
...@@ -3009,7 +3095,6 @@ void print_help(int mode) { ...@@ -3009,7 +3095,6 @@ void print_help(int mode) {
" remote command, we hope the name makes it obvious what\n" " remote command, we hope the name makes it obvious what\n"
" the returned value corresponds to (hint: the ext_*\n" " the returned value corresponds to (hint: the ext_*\n"
" variables correspond to the presence of X extensions):\n" " variables correspond to the presence of X extensions):\n"
"\n"
" ans= stop quit exit shutdown ping blacken zero\n" " ans= stop quit exit shutdown ping blacken zero\n"
" refresh reset close disconnect id sid waitmapped\n" " refresh reset close disconnect id sid waitmapped\n"
" nowaitmapped clip flashcmap noflashcmap shiftcmap\n" " nowaitmapped clip flashcmap noflashcmap shiftcmap\n"
...@@ -3040,16 +3125,17 @@ void print_help(int mode) { ...@@ -3040,16 +3125,17 @@ void print_help(int mode) {
" nodragging wireframe_mode wireframe wf nowireframe\n" " nodragging wireframe_mode wireframe wf nowireframe\n"
" nowf wirecopyrect wcr nowirecopyrect nowcr scr_area\n" " nowf wirecopyrect wcr nowirecopyrect nowcr scr_area\n"
" scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n" " scr_skip scr_inc scr_keys scr_term scr_keyrepeat\n"
" scr_parms scrollcopyrect scr noscrollcopyrect noscr\n" " scr_parms scrollcopyrect scr noscrollcopyrect\n"
" fixscreen noxrecord xrecord reset_record pointer_mode\n" " noscr fixscreen noxrecord xrecord reset_record\n"
" pm input_skip input grabkbd nograbkbd grabptr\n" " pointer_mode pm input_skip allinput noallinput input\n"
" nograbptr client_input speeds wmdt debug_pointer dp\n" " grabkbd nograbkbd grabptr nograbptr client_input\n"
" nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n" " speeds wmdt debug_pointer dp nodebug_pointer nodp\n"
" nodk deferupdate defer wait_ui wait_bog nowait_bog\n" " debug_keyboard dk nodebug_keyboard nodk deferupdate\n"
" slow_fb wait readtimeout nap nonap sb screen_blank\n" " defer wait_ui wait_bog nowait_bog slow_fb wait\n"
" fbpm nofbpm fs gaps grow fuzz snapfb nosnapfb rawfb\n" " readtimeout nap nonap sb screen_blank fbpm nofbpm\n"
" progressive rfbport http nohttp httpport httpdir\n" " fs gaps grow fuzz snapfb nosnapfb rawfb uinput_accel\n"
" enablehttpproxy noenablehttpproxy alwaysshared\n" " uinput_reset progressive rfbport http nohttp httpport\n"
" httpdir enablehttpproxy noenablehttpproxy alwaysshared\n"
" noalwaysshared nevershared noalwaysshared dontdisconnect\n" " noalwaysshared nevershared noalwaysshared dontdisconnect\n"
" nodontdisconnect desktop debug_xevents nodebug_xevents\n" " nodontdisconnect desktop debug_xevents nodebug_xevents\n"
" debug_xevents debug_xdamage nodebug_xdamage\n" " debug_xevents debug_xdamage nodebug_xdamage\n"
...@@ -3074,7 +3160,6 @@ void print_help(int mode) { ...@@ -3074,7 +3160,6 @@ void print_help(int mode) {
" mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y\n" " mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y\n"
" wdpy_x wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y\n" " wdpy_x wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y\n"
" rfbauth passwd viewpasswd\n" " rfbauth passwd viewpasswd\n"
"\n"
"-QD variable Just like -query variable, but returns the default\n" "-QD variable Just like -query variable, but returns the default\n"
" value for that parameter (no running x11vnc server\n" " value for that parameter (no running x11vnc server\n"
" is consulted)\n" " is consulted)\n"
......
...@@ -2461,6 +2461,7 @@ void get_allowed_input(rfbClientPtr client, allowed_input_t *input) { ...@@ -2461,6 +2461,7 @@ void get_allowed_input(rfbClientPtr client, allowed_input_t *input) {
str = "KMBC"; str = "KMBC";
} }
} }
if (0) fprintf(stderr, "GAI: %s - %s\n", str, cd->input);
while (*str) { while (*str) {
if (*str == 'K') { if (*str == 'K') {
...@@ -2485,9 +2486,10 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { ...@@ -2485,9 +2486,10 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
if (pipeinput_int == PIPEINPUT_VID) { if (pipeinput_int == PIPEINPUT_VID) {
v4l_key_command(down, keysym, client); v4l_key_command(down, keysym, client);
} } else if (pipeinput_int == PIPEINPUT_CONS) {
if (pipeinput_int == PIPEINPUT_CONS) {
console_key_command(down, keysym, client); console_key_command(down, keysym, client);
} else if (pipeinput_int == PIPEINPUT_UINPUT) {
uinput_key_command(down, keysym, client);
} }
if (pipeinput_fh == NULL) { if (pipeinput_fh == NULL) {
return; return;
...@@ -2495,7 +2497,7 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { ...@@ -2495,7 +2497,7 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
if (! view_only) { if (! view_only) {
get_allowed_input(client, &input); get_allowed_input(client, &input);
if (input.motion || input.button) { if (input.keystroke) {
can_input = 1; /* XXX distinguish later */ can_input = 1; /* XXX distinguish later */
} }
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "xinerama.h" #include "xinerama.h"
#include "screen.h" #include "screen.h"
#include "pointer.h" #include "pointer.h"
#include "allowed_input_t.h"
#if LIBVNCSERVER_HAVE_SYS_IOCTL_H #if LIBVNCSERVER_HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
...@@ -21,7 +22,8 @@ void console_pointer_command(int mask, int x, int y, rfbClientPtr client); ...@@ -21,7 +22,8 @@ void console_pointer_command(int mask, int x, int y, rfbClientPtr client);
char *console_guess(char *str, int *fd) { char *console_guess(char *str, int *fd) {
char *q, *in = strdup(str); char *q, *in = strdup(str);
char *atparms = NULL, *file = NULL; char *atparms = NULL, *file = NULL;
int tty = -1; int do_input, have_uinput, tty = -1;
if (strstr(in, "/dev/fb") == in) { if (strstr(in, "/dev/fb") == in) {
free(in); free(in);
in = (char *) malloc(strlen("cons:") + strlen(str) + 1); in = (char *) malloc(strlen("cons:") + strlen(str) + 1);
...@@ -67,22 +69,43 @@ char *console_guess(char *str, int *fd) { ...@@ -67,22 +69,43 @@ char *console_guess(char *str, int *fd) {
} }
rfbLog("console_guess: file is %s\n", file); rfbLog("console_guess: file is %s\n", file);
if (!strcmp(in, "cons") || !strcmp(in, "console")) { do_input = 1;
if (pipeinput_str) {
have_uinput = 0;
do_input = 0;
} else {
have_uinput = check_uinput();
}
if (!strcmp(in, "consx") || !strcmp(in, "consolex")) {
do_input = 0;
} else if (!strcmp(in, "cons") || !strcmp(in, "console")) {
/* current active VT: */ /* current active VT: */
tty = 0; if (! have_uinput) {
tty = 0;
}
} else { } else {
int n; int n;
if (sscanf(in, "cons%d", &n) == 1) { if (sscanf(in, "cons%d", &n) == 1) {
tty = n; tty = n;
have_uinput = 0;
} else if (sscanf(in, "console%d", &n) != 1) { } else if (sscanf(in, "console%d", &n) != 1) {
tty = n; tty = n;
have_uinput = 0;
} }
} }
if (tty >=0 && tty < 64) {
if (pipeinput_str == NULL) { if (do_input) {
if (tty >=0 && tty < 64) {
pipeinput_str = (char *) malloc(10); pipeinput_str = (char *) malloc(10);
sprintf(pipeinput_str, "CONS%d", tty); sprintf(pipeinput_str, "CONS%d", tty);
rfbLog("console_guess: file pipeinput %s\n", pipeinput_str); rfbLog("console_guess: file pipeinput %s\n",
pipeinput_str);
initialize_pipeinput();
} else if (have_uinput) {
pipeinput_str = strdup("UINPUT");
rfbLog("console_guess: file pipeinput %s\n",
pipeinput_str);
initialize_pipeinput(); initialize_pipeinput();
} }
} }
...@@ -143,10 +166,20 @@ char *console_guess(char *str, int *fd) { ...@@ -143,10 +166,20 @@ char *console_guess(char *str, int *fd) {
void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
static int control = 0, alt = 0; static int control = 0, alt = 0;
allowed_input_t input;
if (debug_keyboard) fprintf(stderr, "console_key_command: %d %s\n", (int) keysym, down ? "down" : "up"); if (debug_keyboard) fprintf(stderr, "console_key_command: %d %s\n", (int) keysym, down ? "down" : "up");
if (pipeinput_cons_fd < 0) { if (pipeinput_cons_fd < 0) {
return; return;
} }
if (view_only) {
return;
}
get_allowed_input(client, &input);
if (! input.keystroke) {
return;
}
/* From LinuxVNC.c: */ /* From LinuxVNC.c: */
if (keysym == XK_Control_L || keysym == XK_Control_R) { if (keysym == XK_Control_L || keysym == XK_Control_R) {
...@@ -250,6 +283,7 @@ void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { ...@@ -250,6 +283,7 @@ void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
} }
void console_pointer_command(int mask, int x, int y, rfbClientPtr client) { void console_pointer_command(int mask, int x, int y, rfbClientPtr client) {
/* do not forget viewonly perms */
if (mask || x || y || client) {} if (mask || x || y || client) {}
} }
...@@ -290,6 +290,7 @@ int naptile = 4; /* tile change threshold per poll to take a nap */ ...@@ -290,6 +290,7 @@ int naptile = 4; /* tile change threshold per poll to take a nap */
int napfac = 4; /* time = napfac*waitms, cut load with extra waits */ int napfac = 4; /* time = napfac*waitms, cut load with extra waits */
int napmax = 1500; /* longest nap in ms. */ int napmax = 1500; /* longest nap in ms. */
int ui_skip = 10; /* see watchloop. negative means ignore input */ int ui_skip = 10; /* see watchloop. negative means ignore input */
int all_input = 0;
#if LIBVNCSERVER_HAVE_FBPM #if LIBVNCSERVER_HAVE_FBPM
......
...@@ -219,6 +219,7 @@ extern int naptile; ...@@ -219,6 +219,7 @@ extern int naptile;
extern int napfac; extern int napfac;
extern int napmax; extern int napmax;
extern int ui_skip; extern int ui_skip;
extern int all_input;
extern int watch_fbpm; extern int watch_fbpm;
......
...@@ -35,8 +35,11 @@ ...@@ -35,8 +35,11 @@
#define MAXN 256 #define MAXN 256
#define PIPEINPUT_NONE 0x0 #define PIPEINPUT_NONE 0x0
#define PIPEINPUT_VID 0x1 #define PIPEINPUT_VID 0x1
#define PIPEINPUT_CONS 0x2 #define PIPEINPUT_CONS 0x2
#define PIPEINPUT_UINPUT 0x3
#define MAX_BUTTONS 5
#endif /* _X11VNC_PARAMS_H */ #endif /* _X11VNC_PARAMS_H */
...@@ -43,7 +43,6 @@ typedef struct ptrremap { ...@@ -43,7 +43,6 @@ typedef struct ptrremap {
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
MUTEX(pointerMutex); MUTEX(pointerMutex);
#endif #endif
#define MAX_BUTTONS 5
#define MAX_BUTTON_EVENTS 50 #define MAX_BUTTON_EVENTS 50
static prtremap_t pointer_map[MAX_BUTTONS+1][MAX_BUTTON_EVENTS]; static prtremap_t pointer_map[MAX_BUTTONS+1][MAX_BUTTON_EVENTS];
...@@ -522,9 +521,10 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -522,9 +521,10 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) {
if (pipeinput_int == PIPEINPUT_VID) { if (pipeinput_int == PIPEINPUT_VID) {
v4l_pointer_command(mask, x, y, client); v4l_pointer_command(mask, x, y, client);
} } else if (pipeinput_int == PIPEINPUT_CONS) {
if (pipeinput_int == PIPEINPUT_CONS) {
console_pointer_command(mask, x, y, client); console_pointer_command(mask, x, y, client);
} else if (pipeinput_int == PIPEINPUT_UINPUT) {
uinput_pointer_command(mask, x, y, client);
} }
if (pipeinput_fh == NULL) { if (pipeinput_fh == NULL) {
return; return;
...@@ -536,6 +536,7 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -536,6 +536,7 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) {
can_input = 1; /* XXX distinguish later */ can_input = 1; /* XXX distinguish later */
} }
} }
if (cd) { if (cd) {
uid = cd->uid; uid = cd->uid;
} }
...@@ -594,6 +595,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -594,6 +595,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
if (mask >= 0) { if (mask >= 0) {
got_pointer_calls++; got_pointer_calls++;
} }
get_allowed_input(client, &input);
if (debug_pointer && mask >= 0) { if (debug_pointer && mask >= 0) {
static int show_motion = -1; static int show_motion = -1;
...@@ -631,7 +633,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -631,7 +633,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
y = nfix(y, dpy_y); y = nfix(y, dpy_y);
} }
if (pipeinput_fh != NULL && mask >= 0) { if ((pipeinput_fh != NULL || pipeinput_int) && mask >= 0) {
pipe_pointer(mask, x, y, client); pipe_pointer(mask, x, y, client);
if (! pipeinput_tee) { if (! pipeinput_tee) {
if (! view_only || raw_fb) { /* raw_fb hack */ if (! view_only || raw_fb) { /* raw_fb hack */
...@@ -639,7 +641,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -639,7 +641,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
got_keyboard_input++; got_keyboard_input++;
last_pointer_client = client; last_pointer_client = client;
} }
if (view_only && raw_fb) { if (input.motion) {
/* raw_fb hack track button state */ /* raw_fb hack track button state */
button_mask_prev = button_mask; button_mask_prev = button_mask;
button_mask = mask; button_mask = mask;
...@@ -659,7 +661,6 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -659,7 +661,6 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
* mask = -1 is a special case call from scan_for_updates() * mask = -1 is a special case call from scan_for_updates()
* to flush the event queue; there is no real pointer event. * to flush the event queue; there is no real pointer event.
*/ */
get_allowed_input(client, &input);
if (! input.motion && ! input.button) { if (! input.motion && ! input.button) {
return; return;
} }
...@@ -863,7 +864,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { ...@@ -863,7 +864,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
} }
void initialize_pipeinput(void) { void initialize_pipeinput(void) {
char *p; char *p = NULL;
if (pipeinput_fh != NULL) { if (pipeinput_fh != NULL) {
rfbLog("closing pipeinput stream: %p\n", pipeinput_fh); rfbLog("closing pipeinput stream: %p\n", pipeinput_fh);
...@@ -882,7 +883,11 @@ void initialize_pipeinput(void) { ...@@ -882,7 +883,11 @@ void initialize_pipeinput(void) {
} }
/* look for options: tee, reopen, ... */ /* look for options: tee, reopen, ... */
p = strchr(pipeinput_str, ':'); if (strstr(pipeinput_str, "UINPUT") == pipeinput_str) {
;
} else {
p = strchr(pipeinput_str, ':');
}
if (p != NULL) { if (p != NULL) {
char *str, *opt, *q; char *str, *opt, *q;
int got = 0; int got = 0;
...@@ -919,8 +924,7 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); ...@@ -919,8 +924,7 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
if (!strcmp(p, "VID")) { if (!strcmp(p, "VID")) {
pipeinput_int = PIPEINPUT_VID; pipeinput_int = PIPEINPUT_VID;
return; return;
} } else if (strstr(p, "CONS") == p) {
if (strstr(p, "CONS") == p) {
int tty = 0, n; int tty = 0, n;
char dev[32]; char dev[32];
if (sscanf(p, "CONS%d", &n) == 1) { if (sscanf(p, "CONS%d", &n) == 1) {
...@@ -940,6 +944,14 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); ...@@ -940,6 +944,14 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
rfbLogPerror("open"); rfbLogPerror("open");
} }
return; return;
} else if (strstr(p, "UINPUT") == p) {
char *q = strchr(p, ':');
if (q) {
parse_uinput_str(q+1);
}
pipeinput_int = PIPEINPUT_UINPUT;
initialize_uinput();
return;
} }
set_child_info(); set_child_info();
...@@ -990,16 +1002,16 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); ...@@ -990,16 +1002,16 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
"# It can be:\n" "# It can be:\n"
"#\n" "#\n"
"# None (nothing to report)\n" "# None (nothing to report)\n"
"# ButtonPress-N (this event will cause button-1 to be pressed) \n" "# ButtonPress-N (this event will cause button-N to be pressed) \n"
"# ButtonRelease-N (this event will cause button-1 to be released) \n" "# ButtonRelease-N (this event will cause button-N to be released) \n"
"#\n" "#\n"
"# if two more more buttons change state in one event they are listed\n" "# if two more more buttons change state in one event they are listed\n"
"# separated by commas.\n" "# separated by commas.\n"
"#\n" "#\n"
"# One might parse a Pointer line with:\n" "# One might parse a Pointer line with:\n"
"#\n" "#\n"
"# int client, x, y, mask; char *hint;\n" "# int client, x, y, mask; char hint[100];\n"
"# sscanf(line, \"Pointer %d %d %d %s\", &client, &x, &y, &mask, &hint);\n" "# sscanf(line, \"Pointer %d %d %d %d %s\", &client, &x, &y, &mask, hint);\n"
"#\n" "#\n"
"#\n" "#\n"
"# Keysym events (keyboard presses and releases) come in the form:\n" "# Keysym events (keyboard presses and releases) come in the form:\n"
...@@ -1023,8 +1035,8 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); ...@@ -1023,8 +1035,8 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
"#\n" "#\n"
"# One might parse a Keysym line with:\n" "# One might parse a Keysym line with:\n"
"#\n" "#\n"
"# int client, down, keysym; char *name, *hint;\n" "# int client, down, keysym; char name[100], hint[100];\n"
"# sscanf(line, \"Keysym %d %d %s %s\", &client, &down, &keysym, &name, &hint);\n" "# sscanf(line, \"Keysym %d %d %d %s %s\", &client, &down, &keysym, name, hint);\n"
"#\n" "#\n"
"# The <hint> value is currently just None, KeyPress, or KeyRelease.\n" "# The <hint> value is currently just None, KeyPress, or KeyRelease.\n"
"#\n" "#\n"
...@@ -1041,6 +1053,20 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p); ...@@ -1041,6 +1053,20 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
"# info will be enough for most purposes (having identical keyboards on\n" "# info will be enough for most purposes (having identical keyboards on\n"
"# both sides helps).\n" "# both sides helps).\n"
"#\n" "#\n"
"# Parsing example for perl:\n"
"#\n"
"# while (<>) {\n"
"# chomp;\n"
"# if (/^Pointer/) {\n"
"# my ($p, $client, $x, $y, $mask, $hint) = split(' ', $_, 6);\n"
"# do_pointer($client, $x, $y, $mask, $hint);\n"
"# } elsif (/^Keysym/) {\n"
"# my ($k, $client, $down, $keysym, $name, $hint) = split(' ', $_, 6);\n"
"# do_keysym($client, $down, $keysym, $name, $hint);\n"
"# }\n"
"# }\n"
"#\n"
"#\n"
"# Here comes your stream. The following token will always indicate the\n" "# Here comes your stream. The following token will always indicate the\n"
"# end of this informational text:\n" "# end of this informational text:\n"
"# END_OF_TOP\n" "# END_OF_TOP\n"
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "keyboard.h" #include "keyboard.h"
#include "selection.h" #include "selection.h"
#include "unixpw.h" #include "unixpw.h"
#include "uinput.h"
int send_remote_cmd(char *cmd, int query, int wait); int send_remote_cmd(char *cmd, int query, int wait);
int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync, int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync,
...@@ -3029,6 +3030,21 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -3029,6 +3030,21 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("remote_cmd: setting input_skip %d\n", is); rfbLog("remote_cmd: setting input_skip %d\n", is);
ui_skip = is; ui_skip = is;
} else if (!strcmp(p, "allinput")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, all_input);
goto qry;
}
all_input = 1;
rfbLog("enabled allinput\n");
} else if (!strcmp(p, "noallinput")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !all_input);
goto qry;
}
all_input = 0;
rfbLog("disabled allinput\n");
} else if (strstr(p, "input") == p) { } else if (strstr(p, "input") == p) {
int doit = 1; int doit = 1;
COLON_CHECK("input:") COLON_CHECK("input:")
...@@ -3436,6 +3452,28 @@ char *process_remote_cmd(char *cmd, int stringonly) { ...@@ -3436,6 +3452,28 @@ char *process_remote_cmd(char *cmd, int stringonly) {
do_new_fb(1); do_new_fb(1);
raw_fb_back_to_X = 0; raw_fb_back_to_X = 0;
} else if (strstr(p, "uinput_accel") == p) {
COLON_CHECK("uinput_accel:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%s", p, co,
NONUL(get_uinput_accel()));
goto qry;
}
p += strlen("uinput_accel:");
rfbLog("set_uinput_accel: %s\n", p);
set_uinput_accel(p);
} else if (strstr(p, "uinput_reset") == p) {
COLON_CHECK("uinput_reset:")
p += strlen("uinput_reset:");
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co,
get_uinput_reset());
goto qry;
}
rfbLog("set_uinput_reset: %s\n", p);
set_uinput_reset(atoi(p));
} else if (strstr(p, "progressive") == p) { } else if (strstr(p, "progressive") == p) {
int f; int f;
COLON_CHECK("progressive:") COLON_CHECK("progressive:")
......
...@@ -574,10 +574,12 @@ void set_raw_fb_params(int restore) { ...@@ -574,10 +574,12 @@ void set_raw_fb_params(int restore) {
} }
} else { } else {
/* Normal case: */ /* Normal case: */
if (! view_only) { #if 0
if (! view_only && ! pipeinput_str) {
if (! quiet) rfbLog(" rawfb: setting view_only\n"); if (! quiet) rfbLog(" rawfb: setting view_only\n");
view_only = 1; view_only = 1;
} }
#endif
if (watch_selection) { if (watch_selection) {
if (! quiet) rfbLog(" rawfb: turning off " if (! quiet) rfbLog(" rawfb: turning off "
"watch_selection\n"); "watch_selection\n");
...@@ -609,10 +611,6 @@ void set_raw_fb_params(int restore) { ...@@ -609,10 +611,6 @@ void set_raw_fb_params(int restore) {
} }
multiple_cursors_mode = strdup("arrow"); multiple_cursors_mode = strdup("arrow");
} }
if (0 && use_snapfb) {
if (! quiet) rfbLog(" rawfb: turning off use_snapfb\n");
use_snapfb = 0;
}
if (using_shm) { if (using_shm) {
if (! quiet) rfbLog(" rawfb: turning off using_shm\n"); if (! quiet) rfbLog(" rawfb: turning off using_shm\n");
using_shm = 0; using_shm = 0;
...@@ -963,7 +961,8 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); ...@@ -963,7 +961,8 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
rawfb_dev_video = 1; rawfb_dev_video = 1;
} else if (strstr(str, "dev/video")) { } else if (strstr(str, "dev/video")) {
rawfb_dev_video = 1; rawfb_dev_video = 1;
} else if (strstr(str, "cons") == str || strstr(str, "/dev/fb") == str) { } else if (strstr(str, "cons") == str || strstr(str, "fb") == str ||
strstr(str, "/dev/fb") == str) {
char *str2 = console_guess(str, &raw_fb_fd); char *str2 = console_guess(str, &raw_fb_fd);
if (str2 == NULL) { if (str2 == NULL) {
rfbLog("console_guess failed for: %s\n", str); rfbLog("console_guess failed for: %s\n", str);
......
...@@ -178,6 +178,8 @@ Screen ...@@ -178,6 +178,8 @@ Screen
visual: visual:
rawfb: rawfb:
pipeinput: pipeinput:
uinput_accel:
uinput_reset:
24to32 24to32
=GAL LOFF =GAL LOFF
...@@ -317,6 +319,7 @@ Permissions ...@@ -317,6 +319,7 @@ Permissions
Tuning Tuning
=D-C:0,1,2,3,4 pointer_mode: =D-C:0,1,2,3,4 pointer_mode:
input_skip: input_skip:
allinput
=D nodragging =D nodragging
-- D -- D
speeds: speeds:
......
...@@ -189,6 +189,8 @@ char gui_code[] = ""; ...@@ -189,6 +189,8 @@ char gui_code[] = "";
" visual:\n" " visual:\n"
" rawfb:\n" " rawfb:\n"
" pipeinput:\n" " pipeinput:\n"
" uinput_accel:\n"
" uinput_reset:\n"
" 24to32\n" " 24to32\n"
" =GAL LOFF\n" " =GAL LOFF\n"
"\n" "\n"
...@@ -328,6 +330,7 @@ char gui_code[] = ""; ...@@ -328,6 +330,7 @@ char gui_code[] = "";
"Tuning\n" "Tuning\n"
" =D-C:0,1,2,3,4 pointer_mode:\n" " =D-C:0,1,2,3,4 pointer_mode:\n"
" input_skip:\n" " input_skip:\n"
" allinput\n"
" =D nodragging\n" " =D nodragging\n"
" -- D\n" " -- D\n"
" speeds:\n" " speeds:\n"
......
/* -- uinput.c -- */
#include "x11vnc.h"
#include "cleanup.h"
#include "scan.h"
#include "xinerama.h"
#include "screen.h"
#include "pointer.h"
#include "allowed_input_t.h"
#if LIBVNCSERVER_HAVE_SYS_IOCTL_H
#if LIBVNCSERVER_HAVE_LINUX_INPUT_H
#if LIBVNCSERVER_HAVE_LINUX_UINPUT_H
#define UINPUT_OK
#endif
#endif
#endif
#ifdef UINPUT_OK
#include <sys/ioctl.h>
#include <linux/input.h>
#include <linux/uinput.h>
#endif
int check_uinput(void);
int initialize_uinput(void);
int set_uinput_accel(char *str);
void set_uinput_reset(int ms);
char *get_uinput_accel();
int get_uinput_reset();
void parse_uinput_str(char *str);
void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client);
void uinput_key_command(int down, int keysym, rfbClientPtr client);
static void set_uinput_accel_xy(double fx, double fy);
static void shutdown_uinput(void);
static void ptr_move(int dx, int dy);
static void ptr_rel(int dx, int dy);
static void button_click(int down, int btn);
static int lookup_code(int keysym);
static int fd = -1;
static int db = 1;
static int bmask = 0;
static char *injectable = NULL;
static char *uinput_dev = NULL;
static char *devs[] = {
"/dev/misc/uinput",
"/dev/input/uinput",
"/dev/uinput",
NULL
};
/*
* User may need to do:
modprode uinput
mknod /dev/input/uinput c 10 223
*/
int check_uinput(void) {
int i;
#ifndef UINPUT_OK
return 0;
#else
if (UT.release) {
int maj, min;
/* guard against linux 2.4 */
if (sscanf(UT.release, "%d.%d.", &maj, &min) == 2) {
if (maj < 2) {
return 0;
} else if (maj == 2) {
if (min < 6) {
return 0;
}
}
}
}
fd = -1;
i = 0;
while (devs[i] != NULL) {
if ( (fd = open(devs[i++], O_RDWR)) >= 0) {
break;
}
}
if (fd < 0) {
return 0;
}
close(fd);
fd = -1;
return 1;
#endif
}
static void shutdown_uinput(void) {
#ifdef UINPUT_OK
ioctl(fd, UI_DEV_DESTROY);
#endif
}
int initialize_uinput(void) {
#ifndef UINPUT_OK
return 0;
#else
int i;
struct uinput_user_dev udev;
if (fd >= 0) {
shutdown_uinput();
close(fd);
fd = -1;
}
if (uinput_dev) {
fd = open(uinput_dev, O_RDWR);
rfbLog("initialize_uinput: using: %s %d\n", uinput_dev, fd);
} else {
i = 0;
while (devs[i] != NULL) {
if ( (fd = open(devs[i], O_RDWR)) >= 0) {
rfbLog("initialize_uinput: using: %s %d\n",
devs[i], fd);
break;
}
i++;
}
}
if (fd < 0) {
rfbLog("initialize_uinput: could not open an uinput device.\n");
rfbLogPerror("open");
clean_up_exit(1);
}
memset(&udev, 0, sizeof(udev));
strncpy(udev.name, "x11vnc injector", UINPUT_MAX_NAME_SIZE);
udev.id.bustype = BUS_USB; /* Matters? */
udev.id.version = 4;
ioctl(fd, UI_SET_EVBIT, EV_REL);
ioctl(fd, UI_SET_RELBIT, REL_X);
ioctl(fd, UI_SET_RELBIT, REL_Y);
ioctl(fd, UI_SET_EVBIT, EV_KEY);
for (i=0; i < 256; i++) {
ioctl(fd, UI_SET_KEYBIT, i);
}
ioctl(fd, UI_SET_KEYBIT, BTN_MOUSE);
ioctl(fd, UI_SET_KEYBIT, BTN_LEFT);
ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE);
ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT);
ioctl(fd, UI_SET_KEYBIT, BTN_FORWARD);
ioctl(fd, UI_SET_KEYBIT, BTN_BACK);
write(fd, &udev, sizeof(udev));
if (ioctl(fd, UI_DEV_CREATE) != 0) {
rfbLog("ioctl(fd, UI_DEV_CREATE) failed.\n");
rfbLogPerror("ioctl");
close(fd);
clean_up_exit(1);
}
return 1;
#endif
}
static double fudge_x = 0.5; /* accel=2.0 */
static double fudge_y = 0.5;
static double resid_x = 0.0;
static double resid_y = 0.0;
static double zero_delay = 0.5;
static void set_uinput_accel_xy(double fx, double fy) {
fudge_x = 1.0/fx;
fudge_y = 1.0/fy;
rfbLog("set_uinput_accel: fx=%.5f fy=%.5f\n", fx, fy);
rfbLog("set_uinput_accel: ix=%.5f iy=%.5f\n", fudge_x, fudge_y);
}
static char *uinput_accel_str = NULL;
int set_uinput_accel(char *str) {
double fx, fy;
rfbLog("set_uinput_accel: str=%s\n", str);
if (sscanf(str, "%lf+%lf", &fx, &fy) == 2) {
set_uinput_accel_xy(fx, fy);
} else if (sscanf(str, "%lf", &fx) == 1) {
set_uinput_accel_xy(fx, fx);
} else {
rfbLog("invalid UINPUT accel= option: %s\n", str);
return 0;
}
if (uinput_accel_str) {
free(uinput_accel_str);
}
uinput_accel_str = strdup(str);
return 1;
}
void set_uinput_reset(int ms) {
zero_delay = (double) ms/1000.;
rfbLog("set_uinput_reset: %d\n", ms);
}
char *get_uinput_accel(void) {
return uinput_accel_str;
}
int get_uinput_reset(void) {
return (int) (1000 * zero_delay);
}
void parse_uinput_str(char *in) {
char *p, *q, *str = strdup(in);
if (injectable) {
free(injectable);
injectable = strdup("KMB");
}
p = strtok(str, ",");
while (p) {
if (p[0] == '/') {
if (uinput_dev) {
free(uinput_dev);
}
uinput_dev = strdup(p);
} else if (strstr(p, "accel=") == p) {
double fx, fy;
q = p + strlen("accel=");
if (! set_uinput_accel(q)) {
clean_up_exit(1);
}
} else if (strstr(p, "reset=") == p) {
int n = atoi(p + strlen("reset="));
set_uinput_reset(n);
} else if (strpbrk(p, "KMB") == p) {
if (injectable) {
free(injectable);
}
injectable = strdup(p);
} else {
rfbLog("invalid UINPUT option: %s\n", p);
clean_up_exit(1);
}
p = strtok(NULL, ",");
}
free(str);
}
static void ptr_move(int dx, int dy) {
#ifdef UINPUT_OK
struct input_event ev;
if (injectable && strchr(injectable, 'M') == NULL) {
return;
}
if (0) fprintf(stderr, "ptr_move: %d %d\n", dx, dy);
memset(&ev, 0, sizeof(ev));
gettimeofday(&ev.time, NULL);
ev.type = EV_REL;
ev.code = REL_X;
ev.value = dx;
write(fd, &ev, sizeof(ev));
ev.type = EV_REL;
ev.code = REL_Y;
ev.value = dy;
write(fd, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
#endif
}
static void ptr_rel(int dx, int dy) {
int dxf, dyf;
dxf = (int) (fudge_x * (double) dx);
dyf = (int) (fudge_y * (double) dy);
if (db > 1) fprintf(stderr, "old dx dy: %d %d\n", dx, dy);
if (db > 1) fprintf(stderr, "new dx dy: %d %d\n", dxf, dyf);
ptr_move(dxf, dyf);
resid_x += fudge_x * (double) dx - dxf;
resid_y += fudge_y * (double) dy - dyf;
if (resid_x < -1.0 || resid_x > 1.0 || resid_y < -1.0 || resid_y > 1.0) {
dxf = 0;
dyf = 0;
if (resid_x > 1.0) {
dxf = (int) resid_x;
} else if (resid_x < -1.0) {
dxf = -((int) (-resid_x));
}
resid_x -= dxf;
if (resid_y > 1.0) {
dyf = (int) resid_y;
} else if (resid_y < -1.0) {
dyf = -((int) (-resid_y));
}
resid_y -= dyf;
ptr_move(dxf, dyf);
}
}
static void button_click(int down, int btn) {
#ifdef UINPUT_OK
struct input_event ev;
if (injectable && strchr(injectable, 'B') == NULL) {
return;
}
if (db) fprintf(stderr, "down %d btn %d\n", down, btn);
memset(&ev, 0, sizeof(ev));
gettimeofday(&ev.time, NULL);
ev.type = EV_KEY;
ev.value = down;
if (btn == 1) {
ev.code = BTN_LEFT;
} else if (btn == 2) {
ev.code = BTN_MIDDLE;
} else if (btn == 3) {
ev.code = BTN_RIGHT;
} else if (btn == 4) {
ev.code = BTN_FORWARD;
} else if (btn == 5) {
ev.code = BTN_BACK;
} else {
return;
}
write(fd, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
#endif
}
void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
static int last_x = -1, last_y = -1, last_mask = -1;
static double last_zero = 0.0;
allowed_input_t input;
if (db) fprintf(stderr, "uinput_pointer_command: %d %d - %d\n", x, y, mask);
if (view_only) {
return;
}
get_allowed_input(client, &input);
if (!bmask && dnow() >= last_zero + zero_delay && input.motion) {
static int first = 1;
if (zero_delay > 0.0 || first) {
/* try to push it to 0,0 */
int tx = fudge_x * last_x;
int ty = fudge_y * last_y;
int bigjump = 1;
if (bigjump) {
ptr_move(-tx, -ty);
ptr_move(-tx, -ty);
} else {
int i, step, n = 20;
step = dpy_x / n;
if (step < 100) step = 100;
for (i=0; i < n; i++) {
ptr_move(-step, -step);
}
for (i=0; i < n; i++) {
ptr_move(-1, -1);
}
}
if (db) fprintf(stderr, "uinput_pointer_command: reset\n");
/* rest a bit for system to absorb the change */
usleep(30*1000);
/* now jump back out */
ptr_rel(x, y);
last_x = x;
last_y = y;
resid_x = 0.0;
resid_y = 0.0;
first = 0;
}
last_zero = dnow();
}
if (input.motion) {
if (x != last_x || y != last_y) {
ptr_rel(x - last_x, y - last_y);
last_x = x;
last_y = y;
}
}
if (! input.button) {
return;
}
if (last_mask < 0) {
last_mask = mask;
}
#if 0
fprintf(stderr, "mask: %s\n", bitprint(mask, 16));
fprintf(stderr, "bmask: %s\n", bitprint(bmask, 16));
fprintf(stderr, "last_mask: %s\n", bitprint(last_mask, 16));
fprintf(stderr, "button_mask: %s\n", bitprint(button_mask, 16));
#endif
if (mask != last_mask) {
int i;
for (i=1; i <= MAX_BUTTONS; i++) {
int down, b = 1 << (i-1);
if ( (last_mask & b) == (mask & b)) {
continue;
}
if (mask & b) {
down = 1;
} else {
down = 0;
}
button_click(down, i);
}
last_mask = mask;
}
bmask = mask;
}
void uinput_key_command(int down, int keysym, rfbClientPtr client) {
#ifdef UINPUT_OK
struct input_event ev;
int scancode;
allowed_input_t input;
if (injectable && strchr(injectable, 'K') == NULL) {
return;
}
if (view_only) {
return;
}
get_allowed_input(client, &input);
if (! input.keystroke) {
return;
}
scancode = lookup_code(keysym);
if (scancode < 0) {
return;
}
if (db) fprintf(stderr, "uinput_key_command: %d -> %d\n", keysym, scancode);
memset(&ev, 0, sizeof(ev));
gettimeofday(&ev.time, NULL);
ev.type = EV_KEY;
ev.code = (unsigned char) scancode;
ev.value = down;
write(fd, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
#endif
}
static int lookup_code(int keysym) {
if (keysym == NoSymbol) {
return -1;
}
switch(keysym) {
#ifdef UINPUT_OK
case XK_Escape: return KEY_ESC;
case XK_1: return KEY_1;
case XK_2: return KEY_2;
case XK_3: return KEY_3;
case XK_4: return KEY_4;
case XK_5: return KEY_5;
case XK_6: return KEY_6;
case XK_7: return KEY_7;
case XK_8: return KEY_8;
case XK_9: return KEY_9;
case XK_0: return KEY_0;
case XK_exclam: return KEY_1;
case XK_at: return KEY_2;
case XK_numbersign: return KEY_3;
case XK_dollar: return KEY_4;
case XK_percent: return KEY_5;
case XK_asciicircum: return KEY_6;
case XK_ampersand: return KEY_7;
case XK_asterisk: return KEY_8;
case XK_parenleft: return KEY_9;
case XK_parenright: return KEY_0;
case XK_minus: return KEY_MINUS;
case XK_underscore: return KEY_MINUS;
case XK_equal: return KEY_EQUAL;
case XK_plus: return KEY_EQUAL;
case XK_BackSpace: return KEY_BACKSPACE;
case XK_Tab: return KEY_TAB;
case XK_q: return KEY_Q;
case XK_Q: return KEY_Q;
case XK_w: return KEY_W;
case XK_W: return KEY_W;
case XK_e: return KEY_E;
case XK_E: return KEY_E;
case XK_r: return KEY_R;
case XK_R: return KEY_R;
case XK_t: return KEY_T;
case XK_T: return KEY_T;
case XK_y: return KEY_Y;
case XK_Y: return KEY_Y;
case XK_u: return KEY_U;
case XK_U: return KEY_U;
case XK_i: return KEY_I;
case XK_I: return KEY_I;
case XK_o: return KEY_O;
case XK_O: return KEY_O;
case XK_p: return KEY_P;
case XK_P: return KEY_P;
case XK_braceleft: return KEY_LEFTBRACE;
case XK_braceright: return KEY_RIGHTBRACE;
case XK_bracketleft: return KEY_LEFTBRACE;
case XK_bracketright: return KEY_RIGHTBRACE;
case XK_Return: return KEY_ENTER;
case XK_Control_L: return KEY_LEFTCTRL;
case XK_a: return KEY_A;
case XK_A: return KEY_A;
case XK_s: return KEY_S;
case XK_S: return KEY_S;
case XK_d: return KEY_D;
case XK_D: return KEY_D;
case XK_f: return KEY_F;
case XK_F: return KEY_F;
case XK_g: return KEY_G;
case XK_G: return KEY_G;
case XK_h: return KEY_H;
case XK_H: return KEY_H;
case XK_j: return KEY_J;
case XK_J: return KEY_J;
case XK_k: return KEY_K;
case XK_K: return KEY_K;
case XK_l: return KEY_L;
case XK_L: return KEY_L;
case XK_semicolon: return KEY_SEMICOLON;
case XK_colon: return KEY_SEMICOLON;
case XK_apostrophe: return KEY_APOSTROPHE;
case XK_quotedbl: return KEY_APOSTROPHE;
case XK_grave: return KEY_GRAVE;
case XK_asciitilde: return KEY_GRAVE;
case XK_Shift_L: return KEY_LEFTSHIFT;
case XK_backslash: return KEY_BACKSLASH;
case XK_bar: return KEY_BACKSLASH;
case XK_z: return KEY_Z;
case XK_Z: return KEY_Z;
case XK_x: return KEY_X;
case XK_X: return KEY_X;
case XK_c: return KEY_C;
case XK_C: return KEY_C;
case XK_v: return KEY_V;
case XK_V: return KEY_V;
case XK_b: return KEY_B;
case XK_B: return KEY_B;
case XK_n: return KEY_N;
case XK_N: return KEY_N;
case XK_m: return KEY_M;
case XK_M: return KEY_M;
case XK_comma: return KEY_COMMA;
case XK_less: return KEY_COMMA;
case XK_period: return KEY_DOT;
case XK_greater: return KEY_DOT;
case XK_slash: return KEY_SLASH;
case XK_question: return KEY_SLASH;
case XK_Shift_R: return KEY_RIGHTSHIFT;
case XK_KP_Multiply: return KEY_KPASTERISK;
case XK_Alt_L: return KEY_LEFTALT;
case XK_space: return KEY_SPACE;
case XK_Caps_Lock: return KEY_CAPSLOCK;
case XK_F1: return KEY_F1;
case XK_F2: return KEY_F2;
case XK_F3: return KEY_F3;
case XK_F4: return KEY_F4;
case XK_F5: return KEY_F5;
case XK_F6: return KEY_F6;
case XK_F7: return KEY_F7;
case XK_F8: return KEY_F8;
case XK_F9: return KEY_F9;
case XK_F10: return KEY_F10;
case XK_Num_Lock: return KEY_NUMLOCK;
case XK_Scroll_Lock: return KEY_SCROLLLOCK;
case XK_KP_7: return KEY_KP7;
case XK_KP_8: return KEY_KP8;
case XK_KP_9: return KEY_KP9;
case XK_KP_Subtract: return KEY_KPMINUS;
case XK_KP_4: return KEY_KP4;
case XK_KP_5: return KEY_KP5;
case XK_KP_6: return KEY_KP6;
case XK_KP_Add: return KEY_KPPLUS;
case XK_KP_1: return KEY_KP1;
case XK_KP_2: return KEY_KP2;
case XK_KP_3: return KEY_KP3;
case XK_KP_0: return KEY_KP0;
case XK_KP_Decimal: return KEY_KPDOT;
case XK_F13: return KEY_F13;
case XK_F11: return KEY_F11;
case XK_F12: return KEY_F12;
case XK_F14: return KEY_F14;
case XK_F15: return KEY_F15;
case XK_F16: return KEY_F16;
case XK_F17: return KEY_F17;
case XK_F18: return KEY_F18;
case XK_F19: return KEY_F19;
case XK_F20: return KEY_F20;
case XK_KP_Enter: return KEY_KPENTER;
case XK_Control_R: return KEY_RIGHTCTRL;
case XK_KP_Divide: return KEY_KPSLASH;
case XK_Sys_Req: return KEY_SYSRQ;
case XK_Alt_R: return KEY_RIGHTALT;
case XK_Linefeed: return KEY_LINEFEED;
case XK_Home: return KEY_HOME;
case XK_Up: return KEY_UP;
case XK_Page_Up: return KEY_PAGEUP;
case XK_Left: return KEY_LEFT;
case XK_Right: return KEY_RIGHT;
case XK_End: return KEY_END;
case XK_Down: return KEY_DOWN;
case XK_Page_Down: return KEY_PAGEDOWN;
case XK_Insert: return KEY_INSERT;
case XK_Delete: return KEY_DELETE;
case XK_KP_Equal: return KEY_KPEQUAL;
case XK_Pause: return KEY_PAUSE;
case XK_F21: return KEY_F21;
case XK_F22: return KEY_F22;
case XK_F23: return KEY_F23;
case XK_F24: return KEY_F24;
case XK_KP_Separator: return KEY_KPCOMMA;
case XK_Meta_L: return KEY_LEFTMETA;
case XK_Meta_R: return KEY_RIGHTMETA;
case XK_Multi_key: return KEY_COMPOSE;
#endif
default: return -1;
}
}
#if 0
From /usr/include/linux/input.h
We maintain it here since it is such a painful mess.
Here is a little script to make it easier:
#!/usr/bin/perl
while (<>) {
$_ =~ s/-XK_/XK_/;
next unless /^XK_/;
chomp;
if (/^(\S+)(\s+)(\S+)/) {
$a = $1;
$t = $2;
$b = $3;
print "\tcase $a:${t}return $b;\n";
if ($a =~ /XK_[a-z]$/) {
$a = uc($a);
print "\tcase $a:${t}return $b;\n";
}
}
}
This only handles us kbd, we would need a kbd database in general...
XK_Escape KEY_ESC
XK_1 KEY_1
XK_2 KEY_2
XK_3 KEY_3
XK_4 KEY_4
XK_5 KEY_5
XK_6 KEY_6
XK_7 KEY_7
XK_8 KEY_8
XK_9 KEY_9
XK_0 KEY_0
-XK_exclam KEY_1
-XK_at KEY_2
-XK_numbersign KEY_3
-XK_dollar KEY_4
-XK_percent KEY_5
-XK_asciicircum KEY_6
-XK_ampersand KEY_7
-XK_asterisk KEY_8
-XK_parenleft KEY_9
-XK_parenright KEY_0
XK_minus KEY_MINUS
-XK_underscore KEY_MINUS
XK_equal KEY_EQUAL
-XK_plus KEY_EQUAL
XK_BackSpace KEY_BACKSPACE
XK_Tab KEY_TAB
XK_q KEY_Q
XK_w KEY_W
XK_e KEY_E
XK_r KEY_R
XK_t KEY_T
XK_y KEY_Y
XK_u KEY_U
XK_i KEY_I
XK_o KEY_O
XK_p KEY_P
XK_braceleft KEY_LEFTBRACE
XK_braceright KEY_RIGHTBRACE
-XK_bracketleft KEY_LEFTBRACE
-XK_bracketright KEY_RIGHTBRACE
XK_Return KEY_ENTER
XK_Control_L KEY_LEFTCTRL
XK_a KEY_A
XK_s KEY_S
XK_d KEY_D
XK_f KEY_F
XK_g KEY_G
XK_h KEY_H
XK_j KEY_J
XK_k KEY_K
XK_l KEY_L
XK_semicolon KEY_SEMICOLON
-XK_colon KEY_SEMICOLON
XK_apostrophe KEY_APOSTROPHE
-XK_quotedbl KEY_APOSTROPHE
XK_grave KEY_GRAVE
-XK_asciitilde KEY_GRAVE
XK_Shift_L KEY_LEFTSHIFT
XK_backslash KEY_BACKSLASH
-XK_bar KEY_BACKSLASH
XK_z KEY_Z
XK_x KEY_X
XK_c KEY_C
XK_v KEY_V
XK_b KEY_B
XK_n KEY_N
XK_m KEY_M
XK_comma KEY_COMMA
-XK_less KEY_COMMA
XK_period KEY_DOT
-XK_greater KEY_DOT
XK_slash KEY_SLASH
-XK_question KEY_SLASH
XK_Shift_R KEY_RIGHTSHIFT
XK_KP_Multiply KEY_KPASTERISK
XK_Alt_L KEY_LEFTALT
XK_space KEY_SPACE
XK_Caps_Lock KEY_CAPSLOCK
XK_F1 KEY_F1
XK_F2 KEY_F2
XK_F3 KEY_F3
XK_F4 KEY_F4
XK_F5 KEY_F5
XK_F6 KEY_F6
XK_F7 KEY_F7
XK_F8 KEY_F8
XK_F9 KEY_F9
XK_F10 KEY_F10
XK_Num_Lock KEY_NUMLOCK
XK_Scroll_Lock KEY_SCROLLLOCK
XK_KP_7 KEY_KP7
XK_KP_8 KEY_KP8
XK_KP_9 KEY_KP9
XK_KP_Subtract KEY_KPMINUS
XK_KP_4 KEY_KP4
XK_KP_5 KEY_KP5
XK_KP_6 KEY_KP6
XK_KP_Add KEY_KPPLUS
XK_KP_1 KEY_KP1
XK_KP_2 KEY_KP2
XK_KP_3 KEY_KP3
XK_KP_0 KEY_KP0
XK_KP_Decimal KEY_KPDOT
NoSymbol KEY_103RD
XK_F13 KEY_F13
NoSymbol KEY_102ND
XK_F11 KEY_F11
XK_F12 KEY_F12
XK_F14 KEY_F14
XK_F15 KEY_F15
XK_F16 KEY_F16
XK_F17 KEY_F17
XK_F18 KEY_F18
XK_F19 KEY_F19
XK_F20 KEY_F20
XK_KP_Enter KEY_KPENTER
XK_Control_R KEY_RIGHTCTRL
XK_KP_Divide KEY_KPSLASH
XK_Sys_Req KEY_SYSRQ
XK_Alt_R KEY_RIGHTALT
XK_Linefeed KEY_LINEFEED
XK_Home KEY_HOME
XK_Up KEY_UP
XK_Page_Up KEY_PAGEUP
XK_Left KEY_LEFT
XK_Right KEY_RIGHT
XK_End KEY_END
XK_Down KEY_DOWN
XK_Page_Down KEY_PAGEDOWN
XK_Insert KEY_INSERT
XK_Delete KEY_DELETE
NoSymbol KEY_MACRO
NoSymbol KEY_MUTE
NoSymbol KEY_VOLUMEDOWN
NoSymbol KEY_VOLUMEUP
NoSymbol KEY_POWER
XK_KP_Equal KEY_KPEQUAL
NoSymbol KEY_KPPLUSMINUS
XK_Pause KEY_PAUSE
XK_F21 KEY_F21
XK_F22 KEY_F22
XK_F23 KEY_F23
XK_F24 KEY_F24
XK_KP_Separator KEY_KPCOMMA
XK_Meta_L KEY_LEFTMETA
XK_Meta_R KEY_RIGHTMETA
XK_Multi_key KEY_COMPOSE
NoSymbol KEY_STOP
NoSymbol KEY_AGAIN
NoSymbol KEY_PROPS
NoSymbol KEY_UNDO
NoSymbol KEY_FRONT
NoSymbol KEY_COPY
NoSymbol KEY_OPEN
NoSymbol KEY_PASTE
NoSymbol KEY_FIND
NoSymbol KEY_CUT
NoSymbol KEY_HELP
NoSymbol KEY_MENU
NoSymbol KEY_CALC
NoSymbol KEY_SETUP
NoSymbol KEY_SLEEP
NoSymbol KEY_WAKEUP
NoSymbol KEY_FILE
NoSymbol KEY_SENDFILE
NoSymbol KEY_DELETEFILE
NoSymbol KEY_XFER
NoSymbol KEY_PROG1
NoSymbol KEY_PROG2
NoSymbol KEY_WWW
NoSymbol KEY_MSDOS
NoSymbol KEY_COFFEE
NoSymbol KEY_DIRECTION
NoSymbol KEY_CYCLEWINDOWS
NoSymbol KEY_MAIL
NoSymbol KEY_BOOKMARKS
NoSymbol KEY_COMPUTER
NoSymbol KEY_BACK
NoSymbol KEY_FORWARD
NoSymbol KEY_CLOSECD
NoSymbol KEY_EJECTCD
NoSymbol KEY_EJECTCLOSECD
NoSymbol KEY_NEXTSONG
NoSymbol KEY_PLAYPAUSE
NoSymbol KEY_PREVIOUSSONG
NoSymbol KEY_STOPCD
NoSymbol KEY_RECORD
NoSymbol KEY_REWIND
NoSymbol KEY_PHONE
NoSymbol KEY_ISO
NoSymbol KEY_CONFIG
NoSymbol KEY_HOMEPAGE
NoSymbol KEY_REFRESH
NoSymbol KEY_EXIT
NoSymbol KEY_MOVE
NoSymbol KEY_EDIT
NoSymbol KEY_SCROLLUP
NoSymbol KEY_SCROLLDOWN
NoSymbol KEY_KPLEFTPAREN
NoSymbol KEY_KPRIGHTPAREN
NoSymbol KEY_INTL1
NoSymbol KEY_INTL2
NoSymbol KEY_INTL3
NoSymbol KEY_INTL4
NoSymbol KEY_INTL5
NoSymbol KEY_INTL6
NoSymbol KEY_INTL7
NoSymbol KEY_INTL8
NoSymbol KEY_INTL9
NoSymbol KEY_LANG1
NoSymbol KEY_LANG2
NoSymbol KEY_LANG3
NoSymbol KEY_LANG4
NoSymbol KEY_LANG5
NoSymbol KEY_LANG6
NoSymbol KEY_LANG7
NoSymbol KEY_LANG8
NoSymbol KEY_LANG9
NoSymbol KEY_PLAYCD
NoSymbol KEY_PAUSECD
NoSymbol KEY_PROG3
NoSymbol KEY_PROG4
NoSymbol KEY_SUSPEND
NoSymbol KEY_CLOSE
NoSymbol KEY_PLAY
NoSymbol KEY_FASTFORWARD
NoSymbol KEY_BASSBOOST
NoSymbol KEY_PRINT
NoSymbol KEY_HP
NoSymbol KEY_CAMERA
NoSymbol KEY_SOUND
NoSymbol KEY_QUESTION
NoSymbol KEY_EMAIL
NoSymbol KEY_CHAT
NoSymbol KEY_SEARCH
NoSymbol KEY_CONNECT
NoSymbol KEY_FINANCE
NoSymbol KEY_SPORT
NoSymbol KEY_SHOP
NoSymbol KEY_ALTERASE
NoSymbol KEY_CANCEL
NoSymbol KEY_BRIGHTNESSDOWN
NoSymbol KEY_BRIGHTNESSUP
NoSymbol KEY_MEDIA
NoSymbol KEY_UNKNOWN
NoSymbol
NoSymbol BTN_MISC
NoSymbol BTN_0
NoSymbol BTN_1
NoSymbol BTN_2
NoSymbol BTN_3
NoSymbol BTN_4
NoSymbol BTN_5
NoSymbol BTN_6
NoSymbol BTN_7
NoSymbol BTN_8
NoSymbol BTN_9
NoSymbol
NoSymbol BTN_MOUSE
NoSymbol BTN_LEFT
NoSymbol BTN_RIGHT
NoSymbol BTN_MIDDLE
NoSymbol BTN_SIDE
NoSymbol BTN_EXTRA
NoSymbol BTN_FORWARD
NoSymbol BTN_BACK
NoSymbol BTN_TASK
NoSymbol
NoSymbol BTN_JOYSTICK
NoSymbol BTN_TRIGGER
NoSymbol BTN_THUMB
NoSymbol BTN_THUMB2
NoSymbol BTN_TOP
NoSymbol BTN_TOP2
NoSymbol BTN_PINKIE
NoSymbol BTN_BASE
NoSymbol BTN_BASE2
NoSymbol BTN_BASE3
NoSymbol BTN_BASE4
NoSymbol BTN_BASE5
NoSymbol BTN_BASE6
NoSymbol BTN_DEAD
NoSymbol BTN_GAMEPAD
NoSymbol BTN_A
NoSymbol BTN_B
NoSymbol BTN_C
NoSymbol BTN_X
NoSymbol BTN_Y
NoSymbol BTN_Z
NoSymbol BTN_TL
NoSymbol BTN_TR
NoSymbol BTN_TL2
NoSymbol BTN_TR2
NoSymbol BTN_SELECT
NoSymbol BTN_START
NoSymbol BTN_MODE
NoSymbol BTN_THUMBL
NoSymbol BTN_THUMBR
NoSymbol BTN_DIGI
NoSymbol BTN_TOOL_PEN
NoSymbol BTN_TOOL_RUBBER
NoSymbol BTN_TOOL_BRUSH
NoSymbol BTN_TOOL_PENCIL
NoSymbol BTN_TOOL_AIRBRUSH
NoSymbol BTN_TOOL_FINGER
NoSymbol BTN_TOOL_MOUSE
NoSymbol BTN_TOOL_LENS
NoSymbol BTN_TOUCH
NoSymbol BTN_STYLUS
NoSymbol BTN_STYLUS2
NoSymbol BTN_TOOL_DOUBLETAP
NoSymbol BTN_TOOL_TRIPLETAP
NoSymbol BTN_WHEEL
NoSymbol BTN_GEAR_DOWN
NoSymbol BTN_GEAR_UP
NoSymbol KEY_OK
NoSymbol KEY_SELECT
NoSymbol KEY_GOTO
NoSymbol KEY_CLEAR
NoSymbol KEY_POWER2
NoSymbol KEY_OPTION
NoSymbol KEY_INFO
NoSymbol KEY_TIME
NoSymbol KEY_VENDOR
NoSymbol KEY_ARCHIVE
NoSymbol KEY_PROGRAM
NoSymbol KEY_CHANNEL
NoSymbol KEY_FAVORITES
NoSymbol KEY_EPG
NoSymbol KEY_PVR
NoSymbol KEY_MHP
NoSymbol KEY_LANGUAGE
NoSymbol KEY_TITLE
NoSymbol KEY_SUBTITLE
NoSymbol KEY_ANGLE
NoSymbol KEY_ZOOM
NoSymbol KEY_MODE
NoSymbol KEY_KEYBOARD
NoSymbol KEY_SCREEN
NoSymbol KEY_PC
NoSymbol KEY_TV
NoSymbol KEY_TV2
NoSymbol KEY_VCR
NoSymbol KEY_VCR2
NoSymbol KEY_SAT
NoSymbol KEY_SAT2
NoSymbol KEY_CD
NoSymbol KEY_TAPE
NoSymbol KEY_RADIO
NoSymbol KEY_TUNER
NoSymbol KEY_PLAYER
NoSymbol KEY_TEXT
NoSymbol KEY_DVD
NoSymbol KEY_AUX
NoSymbol KEY_MP3
NoSymbol KEY_AUDIO
NoSymbol KEY_VIDEO
NoSymbol KEY_DIRECTORY
NoSymbol KEY_LIST
NoSymbol KEY_MEMO
NoSymbol KEY_CALENDAR
NoSymbol KEY_RED
NoSymbol KEY_GREEN
NoSymbol KEY_YELLOW
NoSymbol KEY_BLUE
NoSymbol KEY_CHANNELUP
NoSymbol KEY_CHANNELDOWN
NoSymbol KEY_FIRST
NoSymbol KEY_LAST
NoSymbol KEY_AB
NoSymbol KEY_NEXT
NoSymbol KEY_RESTART
NoSymbol KEY_SLOW
NoSymbol KEY_SHUFFLE
NoSymbol KEY_BREAK
NoSymbol KEY_PREVIOUS
NoSymbol KEY_DIGITS
NoSymbol KEY_TEEN
NoSymbol KEY_TWEN
NoSymbol KEY_DEL_EOL
NoSymbol KEY_DEL_EOS
NoSymbol KEY_INS_LINE
NoSymbol KEY_DEL_LINE
NoSymbol KEY_MAX
#endif
#ifndef _X11VNC_UINPUT_H
#define _X11VNC_UINPUT_H
/* -- uinput.h -- */
extern int check_uinput(void);
extern int initialize_uinput(void);
extern int set_uinput_accel(char *str);
extern void set_uinput_reset(int ms);
extern char *get_uinput_accel();
extern int get_uinput_reset();
extern void parse_uinput_str(char *str);
extern void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client);
extern void uinput_key_command(int down, int keysym, rfbClientPtr client);
#endif /* _X11VNC_UINPUT_H */
...@@ -446,7 +446,24 @@ void rfbCFD(long usec) { ...@@ -446,7 +446,24 @@ void rfbCFD(long usec) {
} }
if (! use_threads) { if (! use_threads) {
rfbCheckFds(screen, usec); if (0 && all_input) {
static int cnt = 0;
int f = 1;
while (rfbCheckFds(screen, usec) > 0) {
if (f) {
cnt++;
f = 0;
}
fprintf(stderr, "-%d", cnt);
}
} else {
if (all_input) {
screen->handleEventsEagerly = TRUE;
} else {
screen->handleEventsEagerly = FALSE;
}
rfbCheckFds(screen, usec);
}
} }
if (unixpw && unixpw_in_progress && !uip0) { if (unixpw && unixpw_in_progress && !uip0) {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "xinerama.h" #include "xinerama.h"
#include "screen.h" #include "screen.h"
#include "connections.h" #include "connections.h"
#include "allowed_input_t.h"
#if LIBVNCSERVER_HAVE_LINUX_VIDEODEV_H #if LIBVNCSERVER_HAVE_LINUX_VIDEODEV_H
#if LIBVNCSERVER_HAVE_SYS_IOCTL_H #if LIBVNCSERVER_HAVE_SYS_IOCTL_H
...@@ -556,12 +557,22 @@ static void v4l_fmt(char *fmt) { ...@@ -556,12 +557,22 @@ static void v4l_fmt(char *fmt) {
} }
void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
allowed_input_t input;
if (raw_fb_fd < 0) { if (raw_fb_fd < 0) {
return; return;
} }
if (! down) { if (! down) {
return; return;
} }
if (view_only) {
return;
}
get_allowed_input(client, &input);
if (! input.keystroke) {
return;
}
if (keysym == XK_b) { if (keysym == XK_b) {
v4l_br(-1); v4l_br(-1);
} else if (keysym == XK_B) { } else if (keysym == XK_B) {
...@@ -608,6 +619,7 @@ void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { ...@@ -608,6 +619,7 @@ void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
void v4l_pointer_command(int mask, int x, int y, rfbClientPtr client) { void v4l_pointer_command(int mask, int x, int y, rfbClientPtr client) {
/* do not forget viewonly perms */
if (mask || x || y || client) {} if (mask || x || y || client) {}
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.TH X11VNC "1" "July 2006" "x11vnc " "User Commands" .TH X11VNC "1" "July 2006" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.8.2, lastmod: 2006-07-04 version: 0.8.2, lastmod: 2006-07-08
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
...@@ -2569,6 +2569,11 @@ read n user input events before scanning display. n < 0 ...@@ -2569,6 +2569,11 @@ read n user input events before scanning display. n < 0
means to act as though there is always user input. means to act as though there is always user input.
Default: 10 Default: 10
.PP .PP
\fB-allinput\fR
.IP
Have x11vnc read and process all available client input
before proceeding.
.PP
\fB-speeds\fR \fIrd,bw,lat\fR \fB-speeds\fR \fIrd,bw,lat\fR
.IP .IP
x11vnc tries to estimate some speed parameters that x11vnc tries to estimate some speed parameters that
...@@ -2794,17 +2799,23 @@ memory object specified in \fIstring\fR. ...@@ -2794,17 +2799,23 @@ memory object specified in \fIstring\fR.
For shared memory segments string is of the For shared memory segments string is of the
form: "shm:N@WxHxB" which specifies a shmid form: "shm:N@WxHxB" which specifies a shmid
N and framebuffer Width, Height, and Bits N and framebuffer Width, Height, and Bits
per pixel. To memory map per pixel.
.IP
For file polling to memory map
.IR mmap (2) .IR mmap (2)
a file use: a file use:
"map:/path/to/a/file@WxHxB". If there is trouble "map:/path/to/a/file@WxHxB", with WxHxB as above.
with mmap, use "file:/..." for slower "mmap:..." is the same. If there is trouble with mmap,
use "file:/..." for slower
.IR lseek (2) .IR lseek (2)
based based reading.
reading. Use "snap:..." to imply \fB-snapfb\fR mode and the Use "snap:..." to imply \fB-snapfb\fR mode and the "file:"
"file:" access (this is for devices that only provide access (this is for devices that only provide the fb
the fb all at once). If you do not supply a type "map" all at once).
is assumed if the file exists. .IP
If you do not supply a type "map" is assumed if
the file exists (see the next paragraphs for some
exceptions to this.)
.IP .IP
If string is "setup:cmd", then the command "cmd" If string is "setup:cmd", then the command "cmd"
is run and the first line from it is read and used is run and the first line from it is read and used
...@@ -2812,13 +2823,14 @@ as \fIstring\fR. This allows initializing the device, ...@@ -2812,13 +2823,14 @@ as \fIstring\fR. This allows initializing the device,
determining WxHxB, etc. These are often done as root determining WxHxB, etc. These are often done as root
so take care. so take care.
.IP .IP
If the string begins with "video", see the video4linux If the string begins with "video", see the VIDEO4LINUX
discusion below where the device may be queried for discusion below where the device may be queried for
(and possibly set) the framebuffer parameters. (and possibly set) the framebuffer parameters.
.IP .IP
If the strings begins with "cons", see the linux If the string begins with "cons", "/dev/fb", or
console discussion below where the framebuffer device "fb", see the LINUX CONSOLE discussion below where
is opened and keystrokes are inserted into the console. the framebuffer device is opened and keystrokes (and
possibly mouse events) are inserted into the console.
.IP .IP
Optional suffixes are ":R/G/B" and "+O" to specify Optional suffixes are ":R/G/B" and "+O" to specify
red, green, and blue masks and an offset into the red, green, and blue masks and an offset into the
...@@ -2847,11 +2859,12 @@ and ...@@ -2847,11 +2859,12 @@ and
.IR fbset (1) .IR fbset (1)
for the first two examples) for the first two examples)
.IP .IP
All user input is discarded by default (but see the In general all user input is discarded by default (see
\fB-pipeinput\fR option). Most of the X11 (screen, keyboard, the \fB-pipeinput\fR option for how to use a helper program
mouse) options do not make sense and many will cause to insert). Most of the X11 (screen, keyboard, mouse)
this mode to crash, so please think twice before options do not make sense and many will cause this
setting or changing them in a running x11vnc. mode to crash, so please think twice before setting or
changing them in a running x11vnc.
.IP .IP
If you DO NOT want x11vnc to close the X DISPLAY in If you DO NOT want x11vnc to close the X DISPLAY in
rawfb mode, prepend a "+" e.g. +file:/dev/fb0... rawfb mode, prepend a "+" e.g. +file:/dev/fb0...
...@@ -2870,13 +2883,13 @@ snapfb snapshot, set the environment variable: ...@@ -2870,13 +2883,13 @@ snapfb snapshot, set the environment variable:
SNAPFB_RAWFB_RESET=1 as well. SNAPFB_RAWFB_RESET=1 as well.
.IP .IP
If you want x11vnc to dynamically transform a 24bpp If you want x11vnc to dynamically transform a 24bpp
rawfb to 32bpp (note that this will be slower) use rawfb to 32bpp (note that this will be slower) also
the \fB-24to32\fR option. This would be useful for, say, supply the \fB-24to32\fR option. This would be useful for,
for a video camera that delivers the pixel data as say, a video camera that delivers the pixel data as
24bpp packed RGB. This is the default under "video" 24bpp packed RGB. This is the default under "video"
mode if the bpp is 24. mode if the bpp is 24.
.IP .IP
video4linux: on Linux some attempt is made to handle VIDEO4LINUX: on Linux some attempt is made to handle
video devices (webcams or TV tuners) automatically. video devices (webcams or TV tuners) automatically.
The idea is the WxHxB will be extracted from the The idea is the WxHxB will be extracted from the
device itself. So if you do not supply "@WxHxB... device itself. So if you do not supply "@WxHxB...
...@@ -2956,46 +2969,64 @@ all of the above settings. ...@@ -2956,46 +2969,64 @@ all of the above settings.
.IP .IP
See the \fB-pipeinput\fR VID option below for a way to control See the \fB-pipeinput\fR VID option below for a way to control
the settings through the VNC Viewer via keystrokes. the settings through the VNC Viewer via keystrokes.
As a shortcut, if the string begins "Video.." instead
of "video.." then \fB-pipeinput\fR VID is implied.
.IP .IP
As above, if you specify a "@WxHxB..." after the As above, if you specify a "@WxHxB..." after the
<settings> string they are used verbatim: the device <settings> string they are used verbatim: the device
is not queried for the current values. Otherwise the is not queried for the current values. Otherwise the
device will be queried. device will be queried.
.IP .IP
Linux console: If the libvncserver LinuxVNC command is LINUX CONSOLE: If the libvncserver LinuxVNC program
on your system use that instead of the following method is on your system you may want to use that instead of
because it will be faster and more accurate for Linux the following method because it will be faster and more
text console. accurate for Linux text console.
.IP .IP
If the rawfb string begins with "cons" the framebuffer If the rawfb string begins with "cons" the framebuffer
device /dev/fb0 is opened (this requires the appropriate device /dev/fb0 is opened (this requires the appropriate
kernel modules) and so is /dev/tty0. The latter is kernel modules to be installed) and so is /dev/tty0.
used to inject keystrokes (not all are supported, The latter is used to inject keystrokes (not all are
but the basic ones are). You will need to be root to supported, but the basic ones are). You will need to
inject keystrokes. /dev/tty0 refers to the active VT, be root to inject keystrokes. /dev/tty0 refers to the
to indicate one explicitly, use "cons2", etc. using active VT, to indicate one explicitly, use "cons2",
the VT number. Note you can change VT remotely using etc. using the VT number.
the .IP
If the Linux version seems to be 2.6 or later and the
"uinput" module appears to be present, then the uinput
method will be used instead of /dev/ttyN. uinput allows
insertion of BOTH keystrokes and mouse input and so it
preferred when accessing graphical (e.g. QT-embedded)
linux console apps. See \fB-pipeinput\fR UINPUT below
for more information on this mode (you may want to
also use the \fB-nodragging\fR and \fB-cursor\fR none options).
Use "cons0", etc or \fB-pipeinput\fR CONS to force the
/dev/ttyN method.
.IP
Note you can change VT remotely using the
.IR chvt (1) .IR chvt (1)
command. Sometimes switching out and back command. Sometimes switching out and back corrects
corrects the framebuffer. To skip injecting entirely the framebuffer state.
use "consx". .IP
To skip input injecting entirely use "consx".
.IP .IP
The strings "console", or "/dev/fb0" can be used The strings "console", or "/dev/fb0" can be used
instead of "cons". The latter can be used to specify instead of "cons". The latter can be used to specify
a different framebuffer device, e.g. /dev/fb1. If the a different framebuffer device, e.g. /dev/fb1. As a
name is something nonstandard, use "cons:/dev/foofb" shortcut the "/dev/" can be dropped. If the name is
something nonstandard, use "cons:/dev/foofb"
.IP .IP
If you do not want x11vnc to guess the framebuffer's If you do not want x11vnc to guess the framebuffer's
WxHxB and masks automatically, specify them with a WxHxB and masks automatically (sometimes the kernel
given inaccurate information), specify them with a
@WxHxB at the end of the string. @WxHxB at the end of the string.
.IP .IP
Examples: Examples:
\fB-rawfb\fR cons (same as \fB-rawfb\fR console) \fB-rawfb\fR cons (same as \fB-rawfb\fR console)
\fB-rawfb\fR /dev/fb0 (same) \fB-rawfb\fR /dev/fb0 (same)
\fB-rawfb\fR cons3 (force /dev/tty3) \fB-rawfb\fR cons3 (force /dev/tty3)
\fB-rawfb\fR consx (no keystrokes) \fB-rawfb\fR consx (no keystrokes or mouse)
\fB-rawfb\fR console:/dev/nonstd \fB-rawfb\fR console:/dev/nonstd
\fB-rawfb\fR cons \fB-pipeinput\fR UINPUT:accel=1.5
.PP .PP
\fB-freqtab\fR \fIfile\fR \fB-freqtab\fR \fIfile\fR
.IP .IP
...@@ -3028,6 +3059,8 @@ To facilitate this, if \fB-rawfb\fR is in effect then the ...@@ -3028,6 +3059,8 @@ To facilitate this, if \fB-rawfb\fR is in effect then the
value is stored in X11VNC_RAWFB_STR for the pipe command value is stored in X11VNC_RAWFB_STR for the pipe command
to use if it wants. Do 'env | grep X11VNC' for more. to use if it wants. Do 'env | grep X11VNC' for more.
.IP .IP
Built-in pipeinput modes:
.IP
If cmd is "VID" and you are using the \fB-rawfb\fR for a If cmd is "VID" and you are using the \fB-rawfb\fR for a
video capture device, then an internal list of keyboard video capture device, then an internal list of keyboard
mappings is used to set parameters of the video. mappings is used to set parameters of the video.
...@@ -3046,7 +3079,59 @@ GREY respectively. See \fB-rawfb\fR video for details. ...@@ -3046,7 +3079,59 @@ GREY respectively. See \fB-rawfb\fR video for details.
.IP .IP
If cmd is "CONS" or "CONSn" where n is a Linux If cmd is "CONS" or "CONSn" where n is a Linux
console number, then the linux console keystroke console number, then the linux console keystroke
insertion (see \fB-rawfb\fR cons) is performed. insertion to /dev/ttyN (see \fB-rawfb\fR cons) is performed.
.IP
If cmd begins with "UINPUT" then the Linux uinput
module is used to insert both keystroke and mouse events
to the Linux console (see \fB-rawfb\fR above). This usually
is the /dev/input/uinput device file (you may need to
create it with "mknod /dev/input/uinput c 10 223"
and insert the module with "modprobe uinput".
.IP
The UINPUT mode currently only does US keyboards (a
scan code option may be added), and not all keysyms
are supported.
.IP
You may want to use the options \fB-cursor\fR none and
\fB-nodragging\fR in this mode.
.IP
Additional tuning options may be supplied via:
UINPUT:opt1,opt2,... (a comma separated list). If an
option begins with "/" it is taken as the uinput
device file.
.IP
Which uinput is injected can be controlled by an option
string made of the characters "K", "M", and "B"
(see the \fB-input\fR option), e.g. "KM" allows keystroke
and motion but not button clicks.
.IP
A UINPUT option of the form: accel=f, or accel=fx+fy
sets the mouse motion "acceleration". This is used
to correct raw mouse relative motion into how much the
application cursor moves (x11vnc has no control over
how the application interprets the raw mouse motions).
Typically the acceleration for an X display is 2 (see
xset "m" option). "f" is a floating point number,
e.g. 2.0. Use "fx+fy" if you need to supply different
corrections for x and y.
.IP
Note: the default acceleration is 2.0 since it seems
both X and qt-embedded often use this value.
.IP
Even with a correct accel setting the mouse position
will get out of sync (probably due to a mouse
"threshold" setting where the acceleration doe not
apply, set
.IR xset (1)
). The option reset=N sets the number
of ms (default 500) after which the cursor is attempted
to be reset (by forcing the mouse to (0, 0) via small
increments and then back out to (x, y) in 1 jump), This
correction seems to be needed but can cause jerkiness
or unexpected behavior. Use reset=0 to disable.
.IP
Example:
\fB-pipeinput\fR UINPUT:accel=1.0 \fB-cursor\fR none
.PP .PP
\fB-gui\fR \fI[gui-opts]\fR \fB-gui\fR \fI[gui-opts]\fR
.IP .IP
...@@ -3526,6 +3611,10 @@ pointer_mode:n set \fB-pointer_mode\fR to n. same as "pm" ...@@ -3526,6 +3611,10 @@ pointer_mode:n set \fB-pointer_mode\fR to n. same as "pm"
.IP .IP
input_skip:n set \fB-input_skip\fR to n. input_skip:n set \fB-input_skip\fR to n.
.IP .IP
allinput enable use of \fB-allinput\fR mode.
.IP
noallinput disable use of \fB-allinput\fR mode.
.IP
speeds:str set \fB-speeds\fR to str. speeds:str set \fB-speeds\fR to str.
.IP .IP
wmdt:str set \fB-wmdt\fR to str. wmdt:str set \fB-wmdt\fR to str.
...@@ -3584,6 +3673,10 @@ nosnapfb disable \fB-snapfb\fR mode. ...@@ -3584,6 +3673,10 @@ nosnapfb disable \fB-snapfb\fR mode.
.IP .IP
rawfb:str set \fB-rawfb\fR mode to "str". rawfb:str set \fB-rawfb\fR mode to "str".
.IP .IP
uinput_accel:f set uinput_accel to f.
.IP
uinput_reset:n set uinput_reset to n ms.
.IP
progressive:n set libvncserver \fB-progressive\fR slice progressive:n set libvncserver \fB-progressive\fR slice
height parameter to n. height parameter to n.
.IP .IP
...@@ -3703,7 +3796,6 @@ names that do not correspond to an x11vnc option or ...@@ -3703,7 +3796,6 @@ names that do not correspond to an x11vnc option or
remote command, we hope the name makes it obvious what remote command, we hope the name makes it obvious what
the returned value corresponds to (hint: the ext_* the returned value corresponds to (hint: the ext_*
variables correspond to the presence of X extensions): variables correspond to the presence of X extensions):
.IP
ans= stop quit exit shutdown ping blacken zero ans= stop quit exit shutdown ping blacken zero
refresh reset close disconnect id sid waitmapped refresh reset close disconnect id sid waitmapped
nowaitmapped clip flashcmap noflashcmap shiftcmap nowaitmapped clip flashcmap noflashcmap shiftcmap
...@@ -3734,16 +3826,17 @@ xwarp noxwarppointer noxwarp buttonmap dragging ...@@ -3734,16 +3826,17 @@ xwarp noxwarppointer noxwarp buttonmap dragging
nodragging wireframe_mode wireframe wf nowireframe nodragging wireframe_mode wireframe wf nowireframe
nowf wirecopyrect wcr nowirecopyrect nowcr scr_area nowf wirecopyrect wcr nowirecopyrect nowcr scr_area
scr_skip scr_inc scr_keys scr_term scr_keyrepeat scr_skip scr_inc scr_keys scr_term scr_keyrepeat
scr_parms scrollcopyrect scr noscrollcopyrect noscr scr_parms scrollcopyrect scr noscrollcopyrect
fixscreen noxrecord xrecord reset_record pointer_mode noscr fixscreen noxrecord xrecord reset_record
pm input_skip input grabkbd nograbkbd grabptr pointer_mode pm input_skip allinput noallinput input
nograbptr client_input speeds wmdt debug_pointer dp grabkbd nograbkbd grabptr nograbptr client_input
nodebug_pointer nodp debug_keyboard dk nodebug_keyboard speeds wmdt debug_pointer dp nodebug_pointer nodp
nodk deferupdate defer wait_ui wait_bog nowait_bog debug_keyboard dk nodebug_keyboard nodk deferupdate
slow_fb wait readtimeout nap nonap sb screen_blank defer wait_ui wait_bog nowait_bog slow_fb wait
fbpm nofbpm fs gaps grow fuzz snapfb nosnapfb rawfb readtimeout nap nonap sb screen_blank fbpm nofbpm
progressive rfbport http nohttp httpport httpdir fs gaps grow fuzz snapfb nosnapfb rawfb uinput_accel
enablehttpproxy noenablehttpproxy alwaysshared uinput_reset progressive rfbport http nohttp httpport
httpdir enablehttpproxy noenablehttpproxy alwaysshared
noalwaysshared nevershared noalwaysshared dontdisconnect noalwaysshared nevershared noalwaysshared dontdisconnect
nodontdisconnect desktop debug_xevents nodebug_xevents nodontdisconnect desktop debug_xevents nodebug_xevents
debug_xevents debug_xdamage nodebug_xdamage debug_xevents debug_xdamage nodebug_xdamage
......
...@@ -2073,6 +2073,10 @@ int main(int argc, char* argv[]) { ...@@ -2073,6 +2073,10 @@ int main(int argc, char* argv[]) {
CHECK_ARGC CHECK_ARGC
ui_skip = atoi(argv[++i]); ui_skip = atoi(argv[++i]);
if (! ui_skip) ui_skip = 1; if (! ui_skip) ui_skip = 1;
} else if (!strcmp(arg, "-allinput")) {
all_input = 1;
} else if (!strcmp(arg, "-noallinput")) {
all_input = 0;
} else if (!strcmp(arg, "-speeds")) { } else if (!strcmp(arg, "-speeds")) {
CHECK_ARGC CHECK_ARGC
speeds_str = strdup(argv[++i]); speeds_str = strdup(argv[++i]);
......
...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; ...@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8.2 lastmod: 2006-07-04"; char lastmod[] = "0.8.2 lastmod: 2006-07-08";
/* X display info */ /* X display info */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment