Xpra: Ticket #2702: Keypad number are translate to letter windows managed by Xpra

When using the keypad with NumLock on the number from the keypad do not display the good information on the terminal managed by Xpra. I.e pressing 5 display E.



Wed, 01 Apr 2020 17:33:06 GMT - carlos4313: attachment set


Wed, 01 Apr 2020 17:33:22 GMT - carlos4313: attachment set


Wed, 01 Apr 2020 17:33:35 GMT - carlos4313: attachment set


Thu, 02 Apr 2020 04:29:15 GMT - Antoine Martin: description changed

From the attachments:

I can reproduce the problem with Ubuntu 19.10, not with Fedora. Also, as I suggested on the mailing list: Keypads number output wrong value: fix things by starting your server with:

XPRA_SIMULATE_MODIFIERS=0 xpra start ...

This regression is caused by #2301


Thu, 02 Apr 2020 04:54:09 GMT - Antoine Martin:

786 client   1 @21.296 mask_to_names(<flags 0 of type Gdk.ModifierType>) GetKeyState(VK_NUMLOCK)=1, names=['mod2']
787 client   1 @21.297 parse_key_event(<Gdk.EventKey object at 0x000000001cabc9f0 (void at 0x0000000007f5f2a0)>, True)=<GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'keyname': 'KP_5', 'keyval': 65461, 'keycode': 101, 'group': 0, 'string': '5', 'pressed': True}>
804 client   1 @21.297 handle_key_action(ClientWindow(1), <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'keyname': 'KP_5', 'keyval': 65461, 'keycode': 101, 'group': 0, 'string': '5', 'pressed': True}>) wid=1
804 client   1 @21.297 key_handled_as_shortcut: shortcut(KP_5)=None
804 client   1 @21.298 send_delayed_key() delayed_event=None
804 client   1 @21.298 send_key_action(1, <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'keyname': 'KP_5', 'keyval': 65461, 'keycode': 101, 'group': 0, 'string': '5', 'pressed': True}>)
805 will try levels: [0, 4, 1, 5, 2, 6, 3, 7]
805 do_get_keycode(101, 'KP_5', True, ['mod2'], 0)=84 (level=1, shift=False, mode=0)
805 adding 'shift' to modifiers
805 process_key_action(['key-action', 1, b'KP_5', True, (b'mod2',), 65461, b'5', 101, 0]) server keycode=84, group=0
805 set_keyboard_layout_group(0) config=KeyboardConfig(gb /  / None), current keyboard group=0
805 filtered_modifiers_set(['mod2'])={'mod2'}
805 filtered_modifiers_set(['mod2', 'shift'])={'mod2', 'shift'}
805 make_keymask_match(['mod2', 'shift']) current mask: {'mod2'}, wanted: {'mod2', 'shift'}, ignoring=84/['KP_5'], keys_pressed={}
806 change_mask(set(), False, remove) failed=[]
806 keynames(shift)={'Shift_R', 'Shift_L'}, keycodes=[62, 50], nuisance=False, nuisance keys={'mod2', 'lock'}
806 change_mask(add) ['mod2', 'shift'] modifier 'shift' using keycode 62
806 change_mask({'shift'}, True, add) failed=[]
806 is_modifier(84) not found
806 handle_key((1, True, 'KP_5', 65461, 84, ['mod2', 'shift'], False, True))
807 handle keycode pressing    84: key 'KP_5'
807 fake_key(84, True)
807 scheduling key repeat timer with delay 500 for KP_5 / 84
873 client   1 @21.385 mask_to_names(<flags 0 of type Gdk.ModifierType>) GetKeyState(VK_NUMLOCK)=1, names=['mod2']
874 client   1 @21.385 parse_key_event(<Gdk.EventKey object at 0x000000001cabca90 (void at 0x0000000007f5f2a0)>, False)=<GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'keyname': 'KP_5', 'keyval': 65461, 'keycode': 101, 'group': 0, 'string': '5', 'pressed': False}>
883 client   1 @21.385 handle_key_action(ClientWindow(1), <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'keyname': 'KP_5', 'keyval': 65461, 'keycode': 101, 'group': 0, 'string': '5', 'pressed': False}>) wid=1
884 client   1 @21.385 key_handled_as_shortcut: shortcut(KP_5)=None
890 client   1 @21.386 send_delayed_key() delayed_event=None
891 client   1 @21.386 send_key_action(1, <GTKKeyEvent object, contents: {'modifiers': ['mod2'], 'keyname': 'KP_5', 'keyval': 65461, 'keycode': 101, 'group': 0, 'string': '5', 'pressed': False}>)
891 process_key_action(['key-action', 1, b'KP_5', False, (b'mod2',), 65461, b'5', 101, 0]) server keycode=84, group=0
892 set_keyboard_layout_group(0) config=KeyboardConfig(gb /  / None), current keyboard group=0
893 filtered_modifiers_set(['shift', 'mod2'])={'mod2', 'shift'}
893 filtered_modifiers_set(['mod2'])={'mod2'}
893 make_keymask_match(['mod2']) current mask: {'mod2', 'shift'}, wanted: {'mod2'}, ignoring=84/['KP_5'], keys_pressed={84: 'KP_5'}
893 keynames(shift)={'Shift_R', 'Shift_L'}, keycodes=[62, 50], nuisance=False, nuisance keys={'mod2', 'lock'}
894 change_mask(remove) ['mod2'] modifier 'shift' using keycode 62
894 change_mask({'shift'}, False, remove) failed=[]
894 change_mask(set(), True, add) failed=[]
894 is_modifier(84) not found
894 handle_key((1, False, 'KP_5', 65461, 84, ['mod2'], False, True))
894 handle keycode unpressing  84: key 'KP_5'
894 fake_key(84, False)

TIL:

So we're trying to match level=1 and adding shift to get there.

It works for X11 clients because we use a native keymap mode, without translating keycodes.

It works with Fedora servers:

do_get_keycode(101, 'KP_5', True, ['mod2'], 0)=84 (level=0, shift=False, mode=0)

But I don't understand why, as keycode 84 looks like this:

keycode  84 = KP_Begin KP_5 KP_Begin KP_5

It should also match level=1!

In any case, the quick and dirty fix I am likely to apply is to ignore level for the keypad keys since we don't synchronize NumLock.


Thu, 02 Apr 2020 07:06:58 GMT - stdedos:

In any case, the quick and dirty fix I am likely to apply is to ignore level for the keypad keys since we don't synchronize NumLock.

Are you sure you don't sync NumLock?

In my WindowsLaptopClient/XenialServer case, Numlock is always synced, ending up being disabled on the Server (the laptop has its state off by default, because it has no Numpad)


Thu, 02 Apr 2020 17:49:11 GMT - carlos4313:

I can confirm that using XPRA_SIMULATE_MODIFIERS=0 is a valid workaround.. not sure what is the impact but it work for now Thanks


Fri, 03 Apr 2020 07:44:19 GMT - Antoine Martin: status changed; resolution set

So there are two parts to this:

Closing, feel free to re-open if I've missed something.


Mon, 06 Apr 2020 06:45:01 GMT - stdedos:

Replying to stdedos:

In any case, the quick and dirty fix I am likely to apply is to ignore level for the keypad keys since we don't synchronize NumLock.

Are you sure you don't sync NumLock?

In my WindowsLaptopClient/XenialServer case, Numlock is always synced, ending up being disabled on the Server (the laptop has its state off by default, because it has no Numpad)

I probably know what's happening:

You don't sync Numlock changes in seamless server, but you do sync them on shadow


Sat, 23 Jan 2021 05:58:29 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2702