xpra icon
Bug tracker and wiki

Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#2702 closed defect (fixed)

Keypad number are translate to letter windows managed by Xpra

Reported by: carlos4313 Owned by: Antoine Martin
Priority: major Milestone: 4.0
Component: keyboard Version: 3.0.x
Keywords: Cc:

Description (last modified by Antoine Martin)

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.

Attachments (3)

Keyboard_Mapping.txt (41.8 KB) - added by carlos4313 7 months ago.
Server_Info.txt (212.9 KB) - added by carlos4313 7 months ago.
System.txt (11.7 KB) - added by carlos4313 7 months ago.

Download all attachments as: .zip

Change History (9)

Changed 7 months ago by carlos4313

Attachment: Keyboard_Mapping.txt added

Changed 7 months ago by carlos4313

Attachment: Server_Info.txt added

Changed 7 months ago by carlos4313

Attachment: System.txt added

comment:1 Changed 7 months ago by Antoine Martin

Description: modified (diff)

From the attachments:

  • server is Ubuntu 19.10
  • version 3.0.8-r25889
  • server command: /usr/bin/xpra start :5
  • client is Microsoft Windows 10
  • version 3.0.8-r25879
  • client command: xpra attach --encoding=rgb --opengl=no --keyboard-sync=no --min-quality=30 ssh:carlan2@vmfpgacarlan:5
  • layout us

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

comment:2 Changed 7 months ago by 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:

  • do_get_keycode(101, 'KP_5', True, ['mod2'], 0)=84 (level=1, shift=False, mode=0)
  • adding 'shift' to modifiers

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.

comment:3 in reply to:  2 ; Changed 7 months ago by 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)

Last edited 7 months ago by stdedos (previous) (diff)

comment:4 Changed 7 months ago by 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

Last edited 7 months ago by Antoine Martin (previous) (diff)

comment:5 Changed 7 months ago by Antoine Martin

Resolution: fixed
Status: newclosed

So there are two parts to this:

  • r25917 fixes the bug which made Fedora work! (I guess the slightly different keymap triggers the bug)
  • r25918 fixes the lookup for keypad keys
  • r25919 fix blooper

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

Last edited 7 months ago by Antoine Martin (previous) (diff)

comment:6 in reply to:  3 Changed 7 months ago by 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

Note: See TracTickets for help on using tickets.