diff options
-rw-r--r-- | x11vnc/ChangeLog | 3 | ||||
-rw-r--r-- | x11vnc/README | 140 | ||||
-rw-r--r-- | x11vnc/help.c | 60 | ||||
-rw-r--r-- | x11vnc/linuxfb.c | 38 | ||||
-rw-r--r-- | x11vnc/uinput.c | 134 | ||||
-rw-r--r-- | x11vnc/uinput.h | 4 | ||||
-rw-r--r-- | x11vnc/x11vnc.1 | 62 | ||||
-rw-r--r-- | x11vnc/x11vnc.c | 8 | ||||
-rw-r--r-- | x11vnc/x11vnc.h | 1 | ||||
-rw-r--r-- | x11vnc/x11vnc_defs.c | 5 |
10 files changed, 330 insertions, 125 deletions
diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 151657e..0c2133b 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,6 @@ +2006-08-10 Karl Runge <runge@karlrunge.com> + * x11vnc: first pass at touchscreens via uinput. + 2006-08-02 Karl Runge <runge@karlrunge.com> * x11vnc: add -ssltimeout option; tweak ssl timeouts. diff --git a/x11vnc/README b/x11vnc/README index d17f3ab..5f93a76 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Wed Aug 2 12:13:27 EDT 2006 +x11vnc README file Date: Thu Aug 10 17:31:16 EDT 2006 The following information is taken from these URLs: @@ -2708,7 +2708,7 @@ fi client = yes options = ALL [myvncssl] -accept = 5902 +accept = localhost:5902 connect = far-away.east:5901 then double click on the stunnel.exe icon to launch it (followed by @@ -5504,6 +5504,10 @@ ied) cannot do both the Linux console framebuffer and VNC at the same time, which is often what is desired from VNC. + Update: We are finding some setups like Qtopia the IPAQ do not allow + mouse input via uinput. Please help us debug this problem by trying + x11vnc on your device and letting us know what does and does not work. + Q-95: Now that non-X11 devices can be exported via VNC using x11vnc, can I build it with no dependencies on X11 header files and libraries? @@ -7478,12 +7482,13 @@ http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html: Enhanced TightVNC Viewer - The Enhanced TightVNC Viewer package is an attempt to add some patches - to the long neglected Unix Tight VNC Viewer. It also adds a simple GUI - for Windows that automatically starts up a STUNNEL SSL tunnel for SSL - connections to [1]x11vnc (or any other VNC Server also running STUNNEL - at their end), and then launches the Windows Tight VNC Viewer. A - wrapper and gui for SSH connections is also provided. + The Enhanced TightVNC Viewer package is a project to add some patches + to the long neglected Unix TightVNC Viewer. It also adds a GUI for + Windows and Unix that automatically starts up a STUNNEL SSL tunnel for + SSL connections to [1]x11vnc (or any other VNC Server also running an + SSL tunnel, such as STUNNEL, at their end), and then launches the + TightVNC Viewer. The program can also be used set up SSH tunnelled + connections instead. Patches were created for the TightVNC 1.3dev7 vnc_unixsrc tree to add these features: @@ -7497,9 +7502,9 @@ Enhanced TightVNC Viewer The Viewer SSL support is done via a wrapper script (bin/ssl_tightvncviewer) that starts up the STUNNEL tunnel first and - then starts the Tight VNC viewer pointed at that tunnel. The - bin/ssl_vnc_gui program is a simple gui front-end to that script. See - [2]this FAQ for more details on SSL tunnelling. + then starts the TightVNC viewer pointed at that tunnel. The + bin/ssl_vnc_gui program is a GUI front-end to that script. See [2]this + FAQ for more details on SSL tunnelling. The rfbNewFBSize support allows the enhanced TightVNC Unix viewer to resize when the server does (e.g. "x11vnc -R scale=3/4" remote control @@ -7507,21 +7512,22 @@ Enhanced TightVNC Viewer The cursor alphablending is [3]described here. - For Windows SSL Viewer support is provided by a simple program + For Windows, SSL Viewer support is provided by a GUI Windows/ssl_tightvncviewer.exe that prompts for the VNC display and then starts up STUNNEL followed by the Stock TightVNC Windows Viewer. - When the connection is finished, you may need to manually stop the - STUNNEL program by clicking on the icon in the System Tray. If it can - track the STUNNEL processes it will ask you if you want to terminate - it. + The GUI has other useful features. When the connection is finished, + you will be asked if you want to terminate the STUNNEL program. For + SSH connections from Windows the GUI will use PLINK instead of + STUNNEL. Hopefully these binaries will make it convenient for people to help test and use the [4]built-in SSL support in x11vnc. Extra testing of - this feature is much appreciated! Thanks. + this feature is much appreciated!! Thanks. - For the heck of it, some wrapper scripts and gui interfaces where also - added to automatically set up a SSH tunnel instead of STUNNEL SSL. - This works on Unix and Windows (and more smoothly on Unix of course). + For the heck of it, the wrapper scripts and GUI interface were also + modified to be able to automatically set up an SSH tunnel instead of + STUNNEL SSL. This works on Unix and Windows (and more smoothly on Unix + of course). This package can be downloaded here: [5]enhanced_tightvnc_viewer-1.0.zip All Unix and Windows bi @@ -7554,9 +7560,10 @@ es. (~3MB) or the included binary does not run properly on your system. Let me know how that goes. - IMPORTANT: there may be restrictions for you do download the above - because of cryptographic software they contain. Please check out your - situation and information at the following and related sites: + IMPORTANT: there may be restrictions for you to download, use, or + redistribute the above because of cryptographic software they contain. + Please check out your situation and information at the following and + related sites: [10]http://www.tightvnc.com [11]http://www.realvnc.com [12]http://www.stunnel.org @@ -7568,7 +7575,8 @@ es. (~3MB) cryptographic software (again, if your situation warrants, you will need to check). This "no_windows" tarball only contains software (from the above URL's and elsewhere) that will use cryptographic software - (libraries) already installed on your system. + (libraries) already installed on your system. See the section on this + in the README below. Here is the toplevel README from the package: @@ -7655,7 +7663,7 @@ If you need to Build: -------------------- If your OS/arch is not included, the script "build.unix" may be able to -successfully build on for you and desposit the binaries down in ./bin/... +successfully build on for you and deposit the binaries down in ./bin/... using the included source code. You must run the build.unix script from this directory (that this toplevel @@ -7677,22 +7685,27 @@ combination and if binaries are present for it automatically use them. (if not found try the running the build.unix script). If you prefer a GUI to prompt for parameters and then start ssl_tightvncviewer -run this script: +you can run this instead: ./bin/ssl_vnc_gui -this is basically the same GUI that is run on Windows. +this is essentially the same GUI that is run on Windows (the +ssl_tightvncviewer.exe). + +Using the GUI is it impossible to initiate a VNC connection that is not +encrypted with either SSL or SSH. Unencrypted VNC connections can only +be started by manually running the ./bin/tightvncviewer script. For convenience, you can make symlinks from a directory in your PATH to -any of the 3 programs above you want to run. That is all you usually +any of the 3 programs above you wish to run. That is all you usually need to do for it to pick up all of the binaries, utils, etc. E.g. assuming $HOME/bin is in your $PATH: cd $HOME/bin ln -s /path/to/enhanced_tightvnc_viewer/bin/{s,t}* . -(note the "." at the end). That is basically the way to "install" this -package on Unix. +(note the "." at the end). The above commands is basically the way to +"install" this package on Unix. Examples: @@ -7704,7 +7717,7 @@ Use enhanced TightVNC unix viewer to connect to x11vnc via SSL: ./bin/tightvncviewer -ssl far-away.east:0 (same) - ./bin/ssl_vnc_gui (start gui launcher) + ./bin/ssl_vnc_gui (start GUI launcher) Use enhanced TightVNC unix viewer without SSL: @@ -7812,7 +7825,7 @@ x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: % x11vnc -opts (see below for -help long descriptions) -x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-02 +x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-10 x11vnc options: -display disp -auth file -id windowid @@ -7911,7 +7924,7 @@ libvncserver-tight-extension options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-02 +x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-08-10 (type "x11vnc -opts" to just list the options.) @@ -8508,35 +8521,38 @@ Options: above command is run as the user who just authenticated via the login and password prompt. - Also in the case of -unixpw, the user logging in - can place a colon at the end of his username and - supply a few options: scale=, scale_cursor= (or sc=), - solid (or so), id=, clear_mods (or cm), clear_keys - (or ck), repeat, speeds= (or sp=), readtimeout= - (or rd=), or rotate= (or ro=) separated by commas if the -re is more than one. - After the user logs in successfully, these options will - be applied to the VNC screen. For example, + Also in the case of -unixpw, the user logging in can + place a colon at the end of his username and supply + a few options: scale=, scale_cursor= (or sc=), solid + (or so), id=, clear_mods (or cm), clear_keys (or ck), + repeat, speeds= (or sp=), readtimeout= (or rd=), or + rotate= (or ro=) separated by commas if there is more + than one. After the user logs in successfully, these + options will be applied to the VNC screen. For example, login: fred:scale=3/4,sc=1,repeat Password: ... - login: runge:sp=modem,rd=120,solid=root: + login: runge:sp=modem,rd=120,solid - for convenience m/n implies scale= e.g. fred:3/4 - To disable this set the environment variable - X11VNC_NO_UNIXPW_OPTS=1. To set any other options, - the user can use the gui (x11vnc -gui connect) or the - remote control method (x11vnc -R opt:val) during his - VNC session. + for convenience m/n implies scale= e.g. fred:3/4 If you + type and enter your password incorrectly, to retrieve + your long "login:" line press the Up arrow once + (before typing anything else). - So the combination of -display WAIT:cmd=... and - -unixpw allows automatic pairing of an unix - authenticated VNC user with his desktop. This could - be very useful on SunRays and also any system where - multiple users share a given machine. The user does - not need to remember special ports or passwords set up - for his desktop and VNC. + To disable the option setting set the environment + variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc. + To set any other options, the user can use the gui + (x11vnc -gui connect) or the remote control method + (x11vnc -R opt:val) during his VNC session. + + The combination of -display WAIT:cmd=... and -unixpw + allows automatic pairing of an unix authenticated VNC + user with his desktop. This could be very useful on + SunRays and also any system where multiple users share + a given machine. The user does not need to remember + special ports or passwords set up for his desktop + and VNC. A nice way to use WAIT:cmd=... is out of inetd(8) (it automatically forks a new x11vnc for each user). @@ -9067,7 +9083,7 @@ re is more than one. unreliable (especially if the user takes much time to ponder the Certificate dialogs in his browser, Java VM, or VNC Viewer applet. That's right 3 separate "Are - you sure you want to connect" dialogs!) + you sure you want to connect?" dialogs!) So use the -https option to provide a separate, more reliable HTTPS port that x11vnc will listen on. If @@ -10591,6 +10607,16 @@ re is more than one. cause jerkiness or unexpected behavior with menus, etc. Use reset=0 to disable. + If the uinput device has an absolute pointer (as opposed + to a normal mouse that is a relative pointer) you can + specify the option "abs". Note that a touchpad + on a laptop is an absolute device t some degree. + This (usually) avoids all the problems with mouse + acceleration. If x11vnc has trouble deducing the size + of the device, use "abs=WxH". Furthermore, if the + device is a touchscreen (assumed to have an absolute + pointer) use "touch" or "touch=WxH". + If you set the env. var X11VNC_UINPUT_THRESHOLDS then the thresh=n mode will be enabled. It it currently not working well. If |dx| <= thresh and |dy| < thresh diff --git a/x11vnc/help.c b/x11vnc/help.c index ae00940..9c4134b 100644 --- a/x11vnc/help.c +++ b/x11vnc/help.c @@ -620,34 +620,38 @@ void print_help(int mode) { " above command is run as the user who just authenticated\n" " via the login and password prompt.\n" "\n" -" Also in the case of -unixpw, the user logging in\n" -" can place a colon at the end of his username and\n" -" supply a few options: scale=, scale_cursor= (or sc=),\n" -" solid (or so), id=, clear_mods (or cm), clear_keys\n" -" (or ck), repeat, speeds= (or sp=), readtimeout=\n" -" (or rd=), or rotate= (or ro=) separated by commas if there is more than one.\n" -" After the user logs in successfully, these options will\n" -" be applied to the VNC screen. For example,\n" +" Also in the case of -unixpw, the user logging in can\n" +" place a colon at the end of his username and supply\n" +" a few options: scale=, scale_cursor= (or sc=), solid\n" +" (or so), id=, clear_mods (or cm), clear_keys (or ck),\n" +" repeat, speeds= (or sp=), readtimeout= (or rd=), or\n" +" rotate= (or ro=) separated by commas if there is more\n" +" than one. After the user logs in successfully, these\n" +" options will be applied to the VNC screen. For example,\n" "\n" " login: fred:scale=3/4,sc=1,repeat\n" " Password: ...\n" "\n" -" login: runge:sp=modem,rd=120,solid=root:\n" +" login: runge:sp=modem,rd=120,solid\n" "\n" -" for convenience m/n implies scale= e.g. fred:3/4\n" -" To disable this set the environment variable\n" -" X11VNC_NO_UNIXPW_OPTS=1. To set any other options,\n" -" the user can use the gui (x11vnc -gui connect) or the\n" -" remote control method (x11vnc -R opt:val) during his\n" -" VNC session.\n" +" for convenience m/n implies scale= e.g. fred:3/4 If you\n" +" type and enter your password incorrectly, to retrieve\n" +" your long \"login:\" line press the Up arrow once\n" +" (before typing anything else).\n" "\n" -" So the combination of -display WAIT:cmd=... and\n" -" -unixpw allows automatic pairing of an unix\n" -" authenticated VNC user with his desktop. This could\n" -" be very useful on SunRays and also any system where\n" -" multiple users share a given machine. The user does\n" -" not need to remember special ports or passwords set up\n" -" for his desktop and VNC.\n" +" To disable the option setting set the environment\n" +" variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.\n" +" To set any other options, the user can use the gui\n" +" (x11vnc -gui connect) or the remote control method\n" +" (x11vnc -R opt:val) during his VNC session.\n" +"\n" +" The combination of -display WAIT:cmd=... and -unixpw\n" +" allows automatic pairing of an unix authenticated VNC\n" +" user with his desktop. This could be very useful on\n" +" SunRays and also any system where multiple users share\n" +" a given machine. The user does not need to remember\n" +" special ports or passwords set up for his desktop\n" +" and VNC.\n" "\n" " A nice way to use WAIT:cmd=... is out of inetd(8)\n" " (it automatically forks a new x11vnc for each user).\n" @@ -1181,7 +1185,7 @@ void print_help(int mode) { " unreliable (especially if the user takes much time to\n" " ponder the Certificate dialogs in his browser, Java VM,\n" " or VNC Viewer applet. That's right 3 separate \"Are\n" -" you sure you want to connect\" dialogs!)\n" +" you sure you want to connect?\" dialogs!)\n" "\n" " So use the -https option to provide a separate, more\n" " reliable HTTPS port that x11vnc will listen on. If\n" @@ -2714,6 +2718,16 @@ void print_help(int mode) { " cause jerkiness or unexpected behavior with menus, etc.\n" " Use reset=0 to disable.\n" "\n" +" If the uinput device has an absolute pointer (as opposed\n" +" to a normal mouse that is a relative pointer) you can\n" +" specify the option \"abs\". Note that a touchpad\n" +" on a laptop is an absolute device t some degree.\n" +" This (usually) avoids all the problems with mouse\n" +" acceleration. If x11vnc has trouble deducing the size\n" +" of the device, use \"abs=WxH\". Furthermore, if the\n" +" device is a touchscreen (assumed to have an absolute\n" +" pointer) use \"touch\" or \"touch=WxH\".\n" +"\n" " If you set the env. var X11VNC_UINPUT_THRESHOLDS then\n" " the thresh=n mode will be enabled. It it currently\n" " not working well. If |dx| <= thresh and |dy| < thresh\n" diff --git a/x11vnc/linuxfb.c b/x11vnc/linuxfb.c index 3649cd4..878d87f 100644 --- a/x11vnc/linuxfb.c +++ b/x11vnc/linuxfb.c @@ -94,20 +94,6 @@ char *console_guess(char *str, int *fd) { } } - if (do_input) { - if (tty >=0 && tty < 64) { - pipeinput_str = (char *) malloc(10); - sprintf(pipeinput_str, "CONSOLE%d", tty); - 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(); - } - } if (! atparms) { #if LIBVNCSERVER_HAVE_LINUX_FB_H #if LIBVNCSERVER_HAVE_SYS_IOCTL_H @@ -153,6 +139,30 @@ char *console_guess(char *str, int *fd) { #endif } + if (atparms) { + int gw, gh, gb; + if (sscanf(atparms, "%dx%dx%d", &gw, &gh, &gb) == 3) { + fb_x = gw; + fb_y = gh; + fb_b = gb; + } + } + + if (do_input) { + if (tty >=0 && tty < 64) { + pipeinput_str = (char *) malloc(10); + sprintf(pipeinput_str, "CONSOLE%d", tty); + 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(); + } + } + if (! atparms) { rfbLog("console_guess: could not get @ parameters.\n"); return NULL; diff --git a/x11vnc/uinput.c b/x11vnc/uinput.c index 656d7c5..758419a 100644 --- a/x11vnc/uinput.c +++ b/x11vnc/uinput.c @@ -28,9 +28,15 @@ int initialize_uinput(void); int set_uinput_accel(char *str); int set_uinput_thresh(char *str); void set_uinput_reset(int ms); +void set_uinput_always(int); +void set_uinput_touchscreen(int); +void set_uinput_abs(int); char *get_uinput_accel(); char *get_uinput_thresh(); int get_uinput_reset(); +int get_uinput_always(); +int get_uinput_touchscreen(); +int get_uinput_abs(); 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); @@ -51,6 +57,9 @@ static int bmask = 0; static char *injectable = NULL; static char *uinput_dev = NULL; +static int uinput_touchscreen = 0; +static int uinput_abs = 0; +static int abs_x = 0, abs_y = 0; static char *devs[] = { "/dev/misc/uinput", @@ -78,9 +87,12 @@ int check_uinput(void) { if (maj < 2) { return 0; } else if (maj == 2) { + /* hmmm IPAQ 2.4.19-rmk6-pxa1-hh37 works... */ +#if 0 if (min < 6) { return 0; } +#endif } } } @@ -210,6 +222,35 @@ int initialize_uinput(void) { ioctl(fd, UI_SET_KEYBIT, BTN_FORWARD); ioctl(fd, UI_SET_KEYBIT, BTN_BACK); + if (uinput_touchscreen) { + ioctl(fd, UI_SET_KEYBIT, BTN_TOUCH); + rfbLog("uinput: touchscreen enabled.\n"); + } + if (uinput_touchscreen || uinput_abs) { + int gw = abs_x, gh = abs_y; + if (! gw || ! gh) { + gw = fb_x; gh = fb_y; + } + if (! gw || ! gh) { + gw = dpy_x; gh = dpy_y; + } + abs_x = gw; + abs_y = gh; + ioctl(fd, UI_SET_EVBIT, EV_ABS); + ioctl(fd, UI_SET_ABSBIT, ABS_X); + ioctl(fd, UI_SET_ABSBIT, ABS_Y); + udev.absmin[ABS_X] = 0; + udev.absmax[ABS_X] = gw; + udev.absfuzz[ABS_X] = 0; + udev.absflat[ABS_X] = 0; + udev.absmin[ABS_Y] = 0; + udev.absmax[ABS_Y] = gh; + udev.absfuzz[ABS_Y] = 0; + udev.absflat[ABS_Y] = 0; + rfbLog("uinput: absolute pointer enabled at %dx%d.\n", abs_x, abs_y); + set_uinput_accel_xy(1.0, 1.0); + } + write(fd, &udev, sizeof(udev)); if (ioctl(fd, UI_DEV_CREATE) != 0) { @@ -287,6 +328,14 @@ void set_uinput_always(int a) { uinput_always = a; } +void set_uinput_touchscreen(int b) { + uinput_touchscreen = b; +} + +void set_uinput_abs(int b) { + uinput_abs = b; +} + char *get_uinput_accel(void) { return uinput_accel_str; } @@ -301,6 +350,14 @@ int get_uinput_always(void) { return uinput_always; } +int get_uinput_touchscreen(void) { + return uinput_touchscreen; +} + +int get_uinput_abs(void) { + return uinput_abs; +} + void parse_uinput_str(char *in) { char *p, *q, *str = strdup(in); @@ -309,6 +366,10 @@ void parse_uinput_str(char *in) { injectable = strdup("KMB"); } + uinput_touchscreen = 0; + uinput_abs = 0; + abs_x = abs_y = 0; + p = strtok(str, ","); while (p) { if (p[0] == '/') { @@ -336,6 +397,24 @@ void parse_uinput_str(char *in) { free(injectable); } injectable = strdup(p); + } else if (strstr(p, "touch") == p) { + int gw, gh; + q = strchr(p, '='); + set_uinput_touchscreen(1); + set_uinput_abs(1); + if (q && sscanf(q+1, "%dx%d", &gw, &gh) == 2) { + abs_x = gw; + abs_y = gh; + } + } else if (strstr(p, "abs") == p) { + int gw, gh; + q = strchr(p, '='); + set_uinput_abs(1); + if (q && sscanf(q+1, "%dx%d", &gw, &gh) == 2) { + abs_x = gw; + abs_y = gh; + } + } else { rfbLog("invalid UINPUT option: %s\n", p); clean_up_exit(1); @@ -373,6 +452,36 @@ static void ptr_move(int dx, int dy) { #endif } +static void ptr_abs(int x, int y) { +#ifdef UINPUT_OK + struct input_event ev; + + if (injectable && strchr(injectable, 'M') == NULL) { + return; + } + + memset(&ev, 0, sizeof(ev)); + + if (db) fprintf(stderr, "ptr_abs(%d, %d)\n", x, y); + + gettimeofday(&ev.time, NULL); + ev.type = EV_ABS; + ev.code = ABS_Y; + ev.value = y; + write(fd, &ev, sizeof(ev)); + + ev.type = EV_ABS; + ev.code = ABS_X; + ev.value = x; + write(fd, &ev, sizeof(ev)); + + ev.type = EV_SYN; + ev.code = SYN_REPORT; + ev.value = 0; + write(fd, &ev, sizeof(ev)); +#endif +} + static int inside_thresh(int dx, int dy, int thr) { if (thresh_or) { /* this is peeking at qt-embedded qmouse_qws.cpp */ @@ -528,7 +637,10 @@ static void button_click(int down, int btn) { ev.type = EV_KEY; ev.value = down; - if (btn == 1) { + if (uinput_touchscreen) { + ev.code = BTN_TOUCH; + if (db) fprintf(stderr, "set code to BTN_TOUCH\n"); + } else if (btn == 1) { ev.code = BTN_LEFT; } else if (btn == 2) { ev.code = BTN_MIDDLE; @@ -583,7 +695,7 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) { do_reset = 1; if (mask || bmask) { - do_reset = 0; /* do not do reset if moust button down */ + do_reset = 0; /* do not do reset if mouse button down */ } else if (! input.motion) { do_reset = 0; } else if (now < last_zero + zero_delay) { @@ -600,6 +712,18 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) { if (uinput_always && !mask && !bmask && input.motion) { do_reset = 1; } + if (uinput_abs) { +#if 0 + /* this is a bad idea... need to do something else */ + if (do_reset) { + ptr_abs(dpy_x, dpy_y); + usleep(10*1000); + ptr_abs(x, y); + usleep(10*1000); + } +#endif + do_reset = 0; + } if (do_reset) { static int first = 1; @@ -696,7 +820,11 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) { if (input.motion) { if (x != last_x || y != last_y) { - ptr_rel(x - last_x, y - last_y); + if (uinput_abs) { + ptr_abs(x, y); + } else { + ptr_rel(x - last_x, y - last_y); + } last_x = x; last_y = y; } diff --git a/x11vnc/uinput.h b/x11vnc/uinput.h index 0a18de8..41a522a 100644 --- a/x11vnc/uinput.h +++ b/x11vnc/uinput.h @@ -9,10 +9,14 @@ extern int set_uinput_accel(char *str); extern int set_uinput_thresh(char *str); extern void set_uinput_reset(int ms); extern void set_uinput_always(int); +extern void set_uinput_touchscreen(int); +extern void set_uinput_abs(int); extern char *get_uinput_accel(); extern char *get_uinput_thresh(); extern int get_uinput_reset(); extern int get_uinput_always(); +extern int get_uinput_touchscreen(); +extern int get_uinput_abs(); 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); diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index 39a5977..811a330 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "August 2006" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.8.3, lastmod: 2006-08-02 + version: 0.8.3, lastmod: 2006-08-10 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -740,34 +740,38 @@ In the case of \fB-unixpw\fR (but not \fB-unixpw_nis),\fR then the above command is run as the user who just authenticated via the login and password prompt. .IP -Also in the case of \fB-unixpw,\fR the user logging in -can place a colon at the end of his username and -supply a few options: scale=, scale_cursor= (or sc=), -solid (or so), id=, clear_mods (or cm), clear_keys -(or ck), repeat, speeds= (or sp=), readtimeout= -(or rd=), or rotate= (or ro=) separated by commas if there is more than one. -After the user logs in successfully, these options will -be applied to the VNC screen. For example, +Also in the case of \fB-unixpw,\fR the user logging in can +place a colon at the end of his username and supply +a few options: scale=, scale_cursor= (or sc=), solid +(or so), id=, clear_mods (or cm), clear_keys (or ck), +repeat, speeds= (or sp=), readtimeout= (or rd=), or +rotate= (or ro=) separated by commas if there is more +than one. After the user logs in successfully, these +options will be applied to the VNC screen. For example, .IP login: fred:scale=3/4,sc=1,repeat Password: ... .IP -login: runge:sp=modem,rd=120,solid=root: +login: runge:sp=modem,rd=120,solid .IP -for convenience m/n implies scale= e.g. fred:3/4 -To disable this set the environment variable -X11VNC_NO_UNIXPW_OPTS=1. To set any other options, -the user can use the gui (x11vnc \fB-gui\fR connect) or the -remote control method (x11vnc \fB-R\fR opt:val) during his -VNC session. +for convenience m/n implies scale= e.g. fred:3/4 If you +type and enter your password incorrectly, to retrieve +your long "login:" line press the Up arrow once +(before typing anything else). .IP -So the combination of \fB-display\fR WAIT:cmd=... and -\fB-unixpw\fR allows automatic pairing of an unix -authenticated VNC user with his desktop. This could -be very useful on SunRays and also any system where -multiple users share a given machine. The user does -not need to remember special ports or passwords set up -for his desktop and VNC. +To disable the option setting set the environment +variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc. +To set any other options, the user can use the gui +(x11vnc \fB-gui\fR connect) or the remote control method +(x11vnc \fB-R\fR opt:val) during his VNC session. +.IP +The combination of \fB-display\fR WAIT:cmd=... and \fB-unixpw\fR +allows automatic pairing of an unix authenticated VNC +user with his desktop. This could be very useful on +SunRays and also any system where multiple users share +a given machine. The user does not need to remember +special ports or passwords set up for his desktop +and VNC. .IP A nice way to use WAIT:cmd=... is out of .IR inetd (8) @@ -1340,7 +1344,7 @@ adds a few seconds delay to each connection and can be unreliable (especially if the user takes much time to ponder the Certificate dialogs in his browser, Java VM, or VNC Viewer applet. That's right 3 separate "Are -you sure you want to connect" dialogs!) +you sure you want to connect?" dialogs!) .IP So use the \fB-https\fR option to provide a separate, more reliable HTTPS port that x11vnc will listen on. If @@ -3182,6 +3186,16 @@ in 1 jump), This correction seems to be needed but can cause jerkiness or unexpected behavior with menus, etc. Use reset=0 to disable. .IP +If the uinput device has an absolute pointer (as opposed +to a normal mouse that is a relative pointer) you can +specify the option "abs". Note that a touchpad +on a laptop is an absolute device t some degree. +This (usually) avoids all the problems with mouse +acceleration. If x11vnc has trouble deducing the size +of the device, use "abs=WxH". Furthermore, if the +device is a touchscreen (assumed to have an absolute +pointer) use "touch" or "touch=WxH". +.IP If you set the env. var X11VNC_UINPUT_THRESHOLDS then the thresh=n mode will be enabled. It it currently not working well. If |dx| <= thresh and |dy| < thresh diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index b31f585..ce8b352 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -3234,8 +3234,6 @@ int main(int argc, char* argv[]) { rfb_desktop_name = strdup(argv_vnc[argc_vnc-1]); } - initialize_pipeinput(); - /* * Create the XImage corresponding to the display framebuffer. */ @@ -3243,6 +3241,12 @@ int main(int argc, char* argv[]) { fb0 = initialize_xdisplay_fb(); /* + * In some cases (UINPUT touchscreens) we need the dpy_x dpy_y + * to initialize pipeinput. So we do it after fb is created. + */ + initialize_pipeinput(); + + /* * n.b. we do not have to X_LOCK any X11 calls until watch_loop() * is called since we are single-threaded until then. */ diff --git a/x11vnc/x11vnc.h b/x11vnc/x11vnc.h index de10880..fb2c6d1 100644 --- a/x11vnc/x11vnc.h +++ b/x11vnc/x11vnc.h @@ -345,6 +345,7 @@ extern Visual *default_visual; /* the default visual (unless -visual) */ extern int bpp, depth; extern int indexed_color; extern int dpy_x, dpy_y; /* size of display */ +extern int fb_x, fb_y, fb_b; /* fb size and bpp guesses at display */ extern int off_x, off_y; /* offsets for -sid */ extern int wdpy_x, wdpy_y; /* for actual sizes in case of -clip */ extern int cdpy_x, cdpy_y, coff_x, coff_y; /* the -clip params */ diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index 6398d25..bc23e2c 100644 --- a/x11vnc/x11vnc_defs.c +++ b/x11vnc/x11vnc_defs.c @@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; int xdamage_base_event_type = 0; /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.8.3 lastmod: 2006-08-02"; +char lastmod[] = "0.8.3 lastmod: 2006-08-10"; /* X display info */ @@ -27,7 +27,8 @@ Window window = None, rootwin = None; /* polled window, root window (usu. same) Visual *default_visual = NULL; /* the default visual (unless -visual) */ int bpp = 0, depth = 0; int indexed_color = 0; -int dpy_x, dpy_y; /* size of display */ +int dpy_x = 0, dpy_y = 0; /* size of display */ +int fb_x = 0, fb_y = 0, fb_b = 0; /* fb size and bpp guesses at display */ int off_x, off_y; /* offsets for -sid */ int wdpy_x, wdpy_y; /* for actual sizes in case of -clip */ int cdpy_x, cdpy_y, coff_x, coff_y; /* the -clip params */ |