Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows for xinput mouse w/ pipeinput uinput kb. Closes #194 #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion doc/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -5705,6 +5705,9 @@ program that will inject or otherwise process mouse and keystroke
input.) Some useful -pipeinput schemes, VID, CONSOLE, and UINPUT, have
since been built into x11vnc for convenience.

As of Sept/2022 UINPUTX scheme has been added to -pipeinput for better
scrolling capabilities via xinput while using uinput for keyboard keystrokes.

This non-X mode for x11vnc is somewhat experimental because it is so
removed in scope from the intended usage of the tool. Incomplete
attempt is made to make all of the other options consistent with non-X
Expand Down Expand Up @@ -5926,7 +5929,9 @@ 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 "console0", etc or
-pipeinput CONSOLE to force the /dev/ttyN method.
-pipeinput CONSOLE to force the /dev/ttyN method. Another option
if you only need keystrokes over uinput is to use
-pipeinput INPUTX and it will keep the mouse working over xinput.

Note you can change VT remotely using the chvt(1) command.
Sometimes switching out and back corrects the framebuffer state.
Expand Down
10 changes: 10 additions & 0 deletions src/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -4589,6 +4589,8 @@ void print_help(int mode) {
" You may also want to also use the -nodragging and\n"
" -cursor none options. Use \"console0\", etc or\n"
" -pipeinput CONSOLE to force the /dev/ttyN method.\n"
" If you only want keystrokes over UINPUT, but keep\n"
" your mouse over xinput then use -pipeinput UINPUTX.\n"
"\n"
" Note you can change the Linux VT remotely using the\n"
" chvt(1) command to make the one you want be the active\n"
Expand Down Expand Up @@ -4730,6 +4732,14 @@ void print_help(int mode) {
" create it with \"mknod /dev/input/uinput c 10 223\"\n"
" and insert the module with \"modprobe uinput\".\n"
"\n"
" If cmd begins with \"UINPUTX\" then the Linux uinput\n"
" module is used to insert both keystroke to the \n"
" Linux console (see -rawfb above), but mouse events stay\n"
" with xinput for better scrolling. The keyboard input is\n"
" usually the /dev/input/uinput device file (you may need\n"
" to 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. But it is probably more accurate than\n"
Expand Down
2 changes: 1 addition & 1 deletion src/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -2926,7 +2926,7 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
v4l_key_command(down, keysym, client);
} else if (pipeinput_int == PIPEINPUT_CONSOLE) {
console_key_command(down, keysym, client);
} else if (pipeinput_int == PIPEINPUT_UINPUT) {
} else if (pipeinput_int == PIPEINPUT_UINPUT || pipeinput_int == PIPEINPUT_UINPUTX) {
uinput_key_command(down, keysym, client);
} else if (pipeinput_int == PIPEINPUT_MACOSX) {
macosx_key_command(down, keysym, client);
Expand Down
1 change: 1 addition & 0 deletions src/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ so, delete this exception statement from your version.
#define PIPEINPUT_UINPUT 0x3
#define PIPEINPUT_MACOSX 0x4
#define PIPEINPUT_VNC 0x5
#define PIPEINPUT_UINPUTX 0x6

#define MAX_BUTTONS 7

Expand Down
11 changes: 11 additions & 0 deletions src/pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) {
console_pointer_command(mask, x, y, client);
} else if (pipeinput_int == PIPEINPUT_UINPUT) {
uinput_pointer_command(mask, x, y, client);
} else if (pipeinput_int == PIPEINPUT_UINPUTX) {
update_x11_pointer_position(x, y, client);
update_x11_pointer_mask(mask, client);
} else if (pipeinput_int == PIPEINPUT_MACOSX) {
macosx_pointer_command(mask, x, y, client);
} else if (pipeinput_int == PIPEINPUT_VNC) {
Expand Down Expand Up @@ -1095,6 +1098,14 @@ if (0) fprintf(stderr, "initialize_pipeinput: %s -- %s\n", pipeinput_str, p);
pipeinput_int = PIPEINPUT_UINPUT;
initialize_uinput();
return;
} else if (strstr(p, "UINPUTX") == p) {
char *q = strchr(p, ':');
if (q) {
parse_uinput_str(q+1);
}
pipeinput_int = PIPEINPUT_UINPUTX;
initialize_uinput();
return;
} else if (strstr(p, "MACOSX") == p) {
pipeinput_int = PIPEINPUT_MACOSX;
return;
Expand Down
8 changes: 8 additions & 0 deletions x11vnc.1
Original file line number Diff line number Diff line change
Expand Up @@ -5351,6 +5351,14 @@ 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
If cmd begins with "UINPUTX" then the Linux uinput
module is used to insert both keystroke
to the Linux console (see \fB-rawfb\fR above), but mouse events
stay with xinput for better scrolling. The keyboard input is
usually 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. But it is probably more accurate than
Expand Down