I did some research. I totally mis-diagnosed the problem earlier; seems like it's a problem with key translation (or how is it called properly?).

First of all, I've confirmed that this is indeed a problem with upstream x11vnc. It's present in Linux Mint 18 Cinnamon, it doesn't matter which VNC viewer do I use (the problem persists even with x11vnc's "Java viewer"), and it's not present with other VNC servers. (Do I have to go upstream in this case? Where?)

I've read the manpage carefully and tried all kinds of keyboard-related options, and some of them had some effect, but I couldn't get the "correct" behaviour, so I"m trying to find out what the problem is by looking at the "x11vnc -dk" output. And I can't figure it out on my own, as I know very little about how keyboards work and how the keys are supposed to be transferred... (But I see that other VNC servers got it perfectly right, so it should be possible; I just really like x11vnc and don't want to go with the other ones!)


The problem is:
- I have two layouts on my local machine: "us" and "ru"
- Everything works fine when the only layout on the remote machine is "us"; my local layout is honored and all keys work properly. - When I add the "ru" layout on the remote machine, the problems start: everything is fine as long as my local layout is "us", but if I switch it to "ru", then most keys are mangled in a way hard to describe in a brief way.

I believe the correct behaviour would be similar to what vino has: the remote layout is completely ignored, and only the local layout is honored.


The only thing that helped me partially was disabling modtweak; it only mangled my keys even further. So I'm looking at the debug output without modtweak. (And I'm omitting all the "Shift" presses and all the releases for uncluttered view.)


Case #1:
- "ru" is NOT added on the remote machine
- the local layout is "ru"

I press й (located on "q") - I get й :
09/08/2016 05:46:23 # keyboard(down, 0x6ca "Cyrillic_shorti") uip=0 2058.5674 09/08/2016 05:46:23 keyboard(): KeySym 0x6ca "Cyrillic_shorti" -> KeyCode 0x5d 09/08/2016 05:46:23 XTestFakeKeyEvent(dpy, keycode=0x5d "Cyrillic_shorti", down)
09/08/2016 05:46:23 calling XTestFakeKeyEvent(93, 1)  2058.5685

I press " (located on Shift+2) - I get " :
09/08/2016 05:48:26 # keyboard(down, 0x22 "quotedbl") uip=0  2182.3190
09/08/2016 05:48:26 keyboard(): KeySym 0x22 "quotedbl" -> KeyCode 0x30
09/08/2016 05:48:26 XTestFakeKeyEvent(dpy, keycode=0x30 "apostrophe", down)
09/08/2016 05:48:26 calling XTestFakeKeyEvent(48, 1)  2182.3194

I press № (located on Shift+3) - I get № :
09/08/2016 05:50:22 # keyboard(down, 0x6b0 "numerosign") uip=0  2297.9047
09/08/2016 05:50:22 keyboard(): KeySym 0x6b0 "numerosign" -> KeyCode 0x78
09/08/2016 05:50:22 XTestFakeKeyEvent(dpy, keycode=0x78 "numerosign", down)
09/08/2016 05:50:22 calling XTestFakeKeyEvent(120, 1)  2297.9071


Case #2:
- adding "ru" to the remote machine, but not enabling it
- the local layout is "ru"

I press й (located on "q") - but for some reason I get q :
09/08/2016 05:52:17 # keyboard(down, 0x6ca "Cyrillic_shorti") uip=0 2413.0940 09/08/2016 05:52:17 keyboard(): KeySym 0x6ca "Cyrillic_shorti" -> KeyCode 0x18
09/08/2016 05:52:17 XTestFakeKeyEvent(dpy, keycode=0x18 "q", down)
09/08/2016 05:52:17 calling XTestFakeKeyEvent(24, 1)  2413.0950
(Why is it being translated back into English?! Who's doing it and how to disable it?!)

I press " (located on Shift+2) - I get " :
09/08/2016 05:53:27 # keyboard(down, 0x22 "quotedbl") uip=0  2483.1056
09/08/2016 05:53:27 keyboard(): KeySym 0x22 "quotedbl" -> KeyCode 0x30
09/08/2016 05:53:27 XTestFakeKeyEvent(dpy, keycode=0x30 "apostrophe", down)
09/08/2016 05:53:27 calling XTestFakeKeyEvent(48, 1)  2483.1066
(Why is this NOT translated into English, then?!)

I press ; (located on Shift+3) - I get : :
09/08/2016 05:57:24 # keyboard(down, 0x3b "semicolon") uip=0  2720.3259
09/08/2016 05:57:24 keyboard(): KeySym 0x3b "semicolon" -> KeyCode 0x2f
09/08/2016 05:57:24 XTestFakeKeyEvent(dpy, keycode=0x2f "semicolon", down)
09/08/2016 05:57:24 calling XTestFakeKeyEvent(47, 1)  2720.3265
(It is a SEMI-colon in both "us" and "ru" - why does it turn into a COLON?!)


Case #3:
- the remote layout is "ru"
- the local layout is "ru"

I press й (located on "q") - I get й:
09/08/2016 06:01:12 # keyboard(down, 0x6ca "Cyrillic_shorti") uip=0 2948.2130 09/08/2016 06:01:12 keyboard(): KeySym 0x6ca "Cyrillic_shorti" -> KeyCode 0x18
09/08/2016 06:01:12 XTestFakeKeyEvent(dpy, keycode=0x18 "q", down)
09/08/2016 06:01:12 calling XTestFakeKeyEvent(24, 1)  2948.2142

I press " (located on Shift+2) - I get Э (located on the ' and " key ):
09/08/2016 06:02:28 # keyboard(down, 0x22 "quotedbl") uip=0  3023.8559
09/08/2016 06:02:28 keyboard(): KeySym 0x22 "quotedbl" -> KeyCode 0x30
09/08/2016 06:02:28 XTestFakeKeyEvent(dpy, keycode=0x30 "apostrophe", down)
09/08/2016 06:02:28 calling XTestFakeKeyEvent(48, 1)  3023.8568

I press № (located on Shift+3) - I get № :
09/08/2016 06:09:09 # keyboard(down, 0x6b0 "numerosign") uip=0  3424.7345
09/08/2016 06:09:09 keyboard(): KeySym 0x6b0 "numerosign" -> KeyCode 0xc
09/08/2016 06:09:09 XTestFakeKeyEvent(dpy, keycode=0xc "3", down)
09/08/2016 06:09:09 calling XTestFakeKeyEvent(12, 1)  3424.7351

I press ; (located on Shift+4) - I get Ж (located on the : and ; key):
09/08/2016 06:10:12 # keyboard(down, 0x3b "semicolon") uip=0  3487.7910
09/08/2016 06:10:12 keyboard(): KeySym 0x3b "semicolon" -> KeyCode 0x2f
09/08/2016 06:10:12 XTestFakeKeyEvent(dpy, keycode=0x2f "semicolon", down)
09/08/2016 06:10:12 calling XTestFakeKeyEvent(47, 1)  3487.7920


I don't understand what am I supposed to do to get it to work properly, I can't even figure out what's wrong, I couldn't find a solution in the Internet or in the manpage, and the other VNC servers don't have this problem, so I believe it's a bug. If it is not, then please direct me towards what should I do to get it to work!

I can also post some debug with modtweak enabled, but I think this is enough of a mess; modtweak is applied on top of this, so it's hardly worth getting into at this stage.

I've also tried to mess with other options (this output was from x11vnc -repeat -nomodtweak -dk); I can try various combinations of options again, but I have no idea which ones...


--
darkpenguin

Reply via email to