Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.95k stars 169 forks source link

Win key is not passed #3742

Closed dukzcry closed 1 year ago

dukzcry commented 1 year ago

Describe the bug Win key (Super_L) hotkeys are not passed correctly, while Alt or Ctrl hotkeys work fine

To Reproduce Steps to reproduce the behavior:

  1. server command xpra shadow :0 --bind-tcp=0.0.0.0:14500 --daemon=no -d keyboard
    
    /nix/store/wpb7bkiq8ckd873dz97v4nyjl514g33h-xmodmap-1.0.10/bin/xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd) mod2 Num_Lock (0x4d) mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf) mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

3. client command `xpra attach tcp://powerhorse:14500 --desktop-fulscreen=true --microphone=on`

/nix/store/wpb7bkiq8ckd873dz97v4nyjl514g33h-xmodmap-1.0.10/bin/xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd) mod2 Num_Lock (0x4d) mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf) mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

5. Send key combo with Win modifier

**System Information (please complete the following information):**
 - Server OS: NixOS 22.11.20221130.596a8e8 (Raccoon)
 - Client OS: NixOS 22.11.20221130.596a8e8 (Raccoon)
 - Xpra Server Version 4.3.3-r0
 - Xpra Client Version 4.3.3-r0

**Additional context**

2023-01-18 19:09:18,169 client 1 @57.015 parse_key_event(<Gdk.EventKey object at 0x7fb9001417b0 (void at 0x1fad6f0)>, True)=<xpra.common.KeyEvent object at 0x7fb900181960> [31/11104] 2023-01-18 19:09:18,169 client 1 @57.015 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), <xpra.common.KeyEvent object at 0x7fb900181960>) wid=1 2023-01-18 19:09:18,169 client 1 @57.016 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), 'Super_L', [], True) shortcuts_enabled=True, shortcuts=None 2023-01-18 19:09:18,169 client 1 @57.016 send_key_action(1, <xpra.common.KeyEvent object at 0x7fb900181960>) 2023-01-18 19:09:18,169 do_get_keycode (133, Super_L)=133 (native keymap)
2023-01-18 19:09:18,169 process_key_action(['key-action', 1, 'Super_L', True, (), 65515, '', 133, 0]) server keycode=133, group=0 2023-01-18 19:09:18,169 set_keyboard_layout_group(0) ignored, value unchanged
2023-01-18 19:09:18,169 filtered_modifiers_set([])=set()
2023-01-18 19:09:18,169 filtered_modifiers_set([])=set()
2023-01-18 19:09:18,169 handle_key((1, True, 'Super_L', 65515, 133, [], True, True))
2023-01-18 19:09:18,169 handle keycode pressing 133: key 'Super_L'
2023-01-18 19:09:18,170 fake_key(133, True)
2023-01-18 19:09:18,249 client 1 @57.100 parse_key_event(<Gdk.EventKey object at 0x7fb90044f290 (void at 0x1fad510)>, True)=<xpra.common.KeyEvent object at 0x7fb9001819c0> 2023-01-18 19:09:18,253 client 1 @57.101 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), <xpra.common.KeyEvent object at 0x7fb9001819c0>) wid=1 2023-01-18 19:09:18,253 client 1 @57.102 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), '1', ['mod4'], True) shortcuts_enabled=True, shortcuts=None 2023-01-18 19:09:18,253 client 1 @57.102 send_key_action(1, <xpra.common.KeyEvent object at 0x7fb9001819c0>)
2023-01-18 19:09:18,253 do_get_keycode (10, 1)=10 (native keymap) 2023-01-18 19:09:18,253 process_key_action(['key-action', 1, '1', True, ('mod4',), 49, '1', 10, 0]) server keycode=10, group=0 2023-01-18 19:09:18,253 set_keyboard_layout_group(0) ignored, value unchanged
2023-01-18 19:09:18,253 filtered_modifiers_set(['mod3'])={'mod3'}
2023-01-18 19:09:18,253 filtered_modifiers_set(['mod4'])={'mod4'}
2023-01-18 19:09:18,253 make_keymask_match(['mod4']) current mask: {'mod3'}, wanted: {'mod4'}, ignoring=10/['1'], keys_pressed={}
2023-01-18 19:09:18,254 Warning: found no keynames for 'mod3'
2023-01-18 19:09:18,254 change_mask({'mod3'}, False, remove) failed=[]
2023-01-18 19:09:18,254 keynames(mod4)={'Hyper_L', 'Super_L', 'Super_R'}, keycodes=[207, 133, 206, 134], nuisance=False, nuisance keys={'lock', 'mod2'} 2023-01-18 19:09:18,254 add mod4 with keycode 207 did not work
2023-01-18 19:09:18,254 trying to unpress it!
2023-01-18 19:09:18,254 change_mask(add) ['mod4'] modifier 'mod4' using keycode 207, success: False 2023-01-18 19:09:18,254 add mod4 with keycode 133 did not work
2023-01-18 19:09:18,254 trying to unpress it!
2023-01-18 19:09:18,255 change_mask(add) ['mod4'] modifier 'mod4' using keycode 133, success: False
2023-01-18 19:09:18,255 add mod4 with keycode 206 did not work
2023-01-18 19:09:18,255 trying to unpress it!
2023-01-18 19:09:18,255 change_mask(add) ['mod4'] modifier 'mod4' using keycode 206, success: False 2023-01-18 19:09:18,255 add mod4 with keycode 134 did not work 2023-01-18 19:09:18,255 trying to unpress it! 2023-01-18 19:09:18,255 change_mask(add) ['mod4'] modifier 'mod4' using keycode 134, success: False 2023-01-18 19:09:18,256 change_mask({'mod4'}, True, add) failed=['mod4'] 2023-01-18 19:09:18,256 is_modifier(10) not found 2023-01-18 19:09:18,256 handle_key((1, True, '1', 49, 10, ['mod4'], False, True)) 2023-01-18 19:09:18,256 handle keycode pressing 10: key '1' 2023-01-18 19:09:18,256 fake_key(10, True) 12023-01-18 19:09:18,256 scheduling key repeat timer with delay 660 for 1 / 10 2023-01-18 19:09:18,377 client 1 @57.217 parse_key_event(<Gdk.EventKey object at 0x7fb9001413a0 (void at 0x204f840)>, False)=<xpra.common.KeyEvent object at 0x7fb9001816c0> 2023-01-18 19:09:18,377 client 1 @57.218 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), <xpra.common.KeyEvent object at 0x7fb9001816c0>) wid=1 2023-01-18 19:09:18,377 client 1 @57.219 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), '1', ['mod4'], False) shortcuts_enabled=True, shortcuts=None 2023-01-18 19:09:18,377 client 1 @57.220 send_key_action(1, <xpra.common.KeyEvent object at 0x7fb9001816c0>) 2023-01-18 19:09:18,378 process_key_action(['key-action', 1, '1', False, ('mod4',), 49, '1', 10, 0]) server keycode=10, group=0 2023-01-18 19:09:18,378 set_keyboard_layout_group(0) ignored, value unchanged 2023-01-18 19:09:18,378 filtered_modifiers_set([])=set() 2023-01-18 19:09:18,378 filtered_modifiers_set(['mod4'])={'mod4'} 2023-01-18 19:09:18,378 make_keymask_match(['mod4']) current mask: set(), wanted: {'mod4'}, ignoring=10/['1'], keys_pressed={} 2023-01-18 19:09:18,378 change_mask(set(), False, remove) failed=[] 2023-01-18 19:09:18,378 keynames(mod4)={'Hyper_L', 'Super_L', 'Super_R'}, keycodes=[207, 133, 206, 134], nuisance=False, nuisance keys={'lock', 'mod2'} 2023-01-18 19:09:18,378 add mod4 with keycode 207 did not work 2023-01-18 19:09:18,378 trying to unpress it! 2023-01-18 19:09:18,379 change_mask(add) ['mod4'] modifier 'mod4' using keycode 207, success: False 2023-01-18 19:09:18,379 add mod4 with keycode 133 did not work 2023-01-18 19:09:18,379 trying to unpress it! 2023-01-18 19:09:18,379 change_mask(add) ['mod4'] modifier 'mod4' using keycode 133, success: False 2023-01-18 19:09:18,379 add mod4 with keycode 206 did not work 2023-01-18 19:09:18,379 trying to unpress it! 2023-01-18 19:09:18,379 change_mask(add) ['mod4'] modifier 'mod4' using keycode 206, success: False 2023-01-18 19:09:18,380 add mod4 with keycode 134 did not work 2023-01-18 19:09:18,380 trying to unpress it! 2023-01-18 19:09:18,380 change_mask(add) ['mod4'] modifier 'mod4' using keycode 134, success: False 2023-01-18 19:09:18,380 change_mask({'mod4'}, True, add) failed=['mod4'] 2023-01-18 19:09:18,380 is_modifier(10) not found 2023-01-18 19:09:18,380 handle_key((1, False, '1', 49, 10, ['mod4'], False, True)) 2023-01-18 19:09:18,380 handle keycode unpressing 10: key '1' 2023-01-18 19:09:18,380 fake_key(10, False) 2023-01-18 19:09:18,404 client 1 @57.254 parse_key_event(<Gdk.EventKey object at 0x7fb900140680 (void at 0x204f980)>, False)=<xpra.common.KeyEvent object at 0x7fb900182140> 2023-01-18 19:09:18,404 client 1 @57.255 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), <xpra.common.KeyEvent object at 0x7fb900182140>) wid=1 2023-01-18 19:09:18,406 client 1 @57.256 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (1912, 2092), YUV420P)), 'Super_L', ['mod4'], False) shortcuts_enabled=True, shortcuts=None 2023-01-18 19:09:18,407 client 1 @57.257 send_key_action(1, <xpra.common.KeyEvent object at 0x7fb900182140>) 2023-01-18 19:09:18,407 process_key_action(['key-action', 1, 'Super_L', False, ('mod4',), 65515, '', 133, 0]) server keycode=133, group=0 2023-01-18 19:09:18,407 set_keyboard_layout_group(0) ignored, value unchanged 2023-01-18 19:09:18,407 filtered_modifiers_set([])=set() 2023-01-18 19:09:18,407 modifier 'mod4' ignored (in ignored keynames={'Hyper_L', 'Super_L', 'Super_R'}) 2023-01-18 19:09:18,407 filtered_modifiers_set(['mod4'])=set() 2023-01-18 19:09:18,407 handle_key((1, False, 'Super_L', 65515, 133, ['mod4'], True, True)) 2023-01-18 19:09:18,407 handle keycode unpressing 133: key 'Super_L' 2023-01-18 19:09:18,407 fake_key(133, False)

totaam commented 1 year ago

Does this still occur with a more current version? Try adding --keyboard-raw=true.

dukzcry commented 1 year ago

@totaam Upgraded to 4.4.3-r1 on both client and server Still the same issue

2023-01-19 10:32:56,211 client   1 @27.026 parse_key_event(<Gdk.EventKey object at 0x7f38941c4c70 (void at 0x1a64b40)>, True)=KeyEvent(modifiers=[], keyname=Super_L, keyval=65515, keycode=133, group=0, string=, pressed=True)
2023-01-19 10:32:56,216 client   1 @27.028 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), KeyEvent(modifiers=[], keyname=Super_L, keyval=65515, keycode=133, group=0, string=, pressed=True)) wid=1
2023-01-19 10:32:56,216 client   1 @27.029 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), 'Super_L', [], True) shortcuts_enabled=True, shortcuts=None
2023-01-19 10:32:56,216 client   1 @27.030 send_key_action(1, KeyEvent(modifiers=[], keyname=Super_L, keyval=65515, keycode=133, group=0, string=, pressed=True))
2023-01-19 10:32:56,216 do_get_keycode (133, Super_L)=133 (native keymap)                                                                                      
2023-01-19 10:32:56,216 process_key_action(['key-action', 1, 'Super_L', True, (), 65515, '', 133, 0]) server keycode=133, group=0
2023-01-19 10:32:56,216 set_keyboard_layout_group(0) ignored, value unchanged                                                                                  
2023-01-19 10:32:56,216 filtered_modifiers_set([])=set()                                                                                                       
2023-01-19 10:32:56,216 filtered_modifiers_set([])=set()                                                                                                       
2023-01-19 10:32:56,217 handle_key((1, True, 'Super_L', 65515, 133, [], True, True))                             
2023-01-19 10:32:56,217 handle keycode pressing   133: key 'Super_L'                                                                                           
2023-01-19 10:32:56,217 fake_key(133, True)                                                                                                                    
2023-01-19 10:32:56,346 client   1 @27.161 parse_key_event(<Gdk.EventKey object at 0x7f38941c6160 (void at 0x1a64a00)>, True)=KeyEvent(modifiers=['mod4'], keyname=1, keyval=49, keycode=10, group=0, string=1, pressed=True)
2023-01-19 10:32:56,349 client   1 @27.163 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), KeyEvent(modifiers=['mod4'], keyname=1, keyval=49, keycode=10, group=0, string=1, pressed=True)) wid=1
2023-01-19 10:32:56,349 client   1 @27.163 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), '1', ['mod4'], True) shortcuts_enabled=True, shortcuts=None
2023-01-19 10:32:56,349 client   1 @27.164 send_key_action(1, KeyEvent(modifiers=['mod4'], keyname=1, keyval=49, keycode=10, group=0, string=1, pressed=True))
2023-01-19 10:32:56,349 do_get_keycode (10, 1)=10 (native keymap)                                                                                              
2023-01-19 10:32:56,349 process_key_action(['key-action', 1, '1', True, ('mod4',), 49, '1', 10, 0]) server keycode=10, group=0       
2023-01-19 10:32:56,350 set_keyboard_layout_group(0) ignored, value unchanged
2023-01-19 10:32:56,350 filtered_modifiers_set(['mod3'])={'mod3'}
2023-01-19 10:32:56,350 filtered_modifiers_set(['mod4'])={'mod4'}
2023-01-19 10:32:56,350 make_keymask_match(['mod4']) current mask: {'mod3'}, wanted: {'mod4'}, ignoring=10/['1'], keys_pressed={}
2023-01-19 10:32:56,350 Warning: found no keynames for 'mod3'
2023-01-19 10:32:56,350 change_mask({'mod3'}, False, remove) failed=[]
2023-01-19 10:32:56,350 keynames(mod4)={'Hyper_L', 'Super_L', 'Super_R'}, keycodes=[207, 133, 206, 134], nuisance=False, nuisance keys={'lock', 'mod2'}
2023-01-19 10:32:56,350 add mod4 with keycode 207 did not work
2023-01-19 10:32:56,350  trying to unpress it!
2023-01-19 10:32:56,350 change_mask(add) ['mod4'] modifier 'mod4' using keycode 207, success: False
2023-01-19 10:32:56,350 add mod4 with keycode 133 did not work
2023-01-19 10:32:56,350  trying to unpress it!    
2023-01-19 10:32:56,350 change_mask(add) ['mod4'] modifier 'mod4' using keycode 133, success: False
2023-01-19 10:32:56,351 add mod4 with keycode 206 did not work                                                                                                 
2023-01-19 10:32:56,351  trying to unpress it!                                                                                                                 
2023-01-19 10:32:56,351 change_mask(add) ['mod4'] modifier 'mod4' using keycode 206, success: False
2023-01-19 10:32:56,351 add mod4 with keycode 134 did not work
2023-01-19 10:32:56,351  trying to unpress it!
2023-01-19 10:32:56,351 change_mask(add) ['mod4'] modifier 'mod4' using keycode 134, success: False
2023-01-19 10:32:56,351 change_mask({'mod4'}, True, add) failed=['mod4']
2023-01-19 10:32:56,351 is_modifier(10) not found
2023-01-19 10:32:56,351 handle_key((1, True, '1', 49, 10, ['mod4'], False, True))
2023-01-19 10:32:56,351 handle keycode pressing    10: key '1'
2023-01-19 10:32:56,351 fake_key(10, True)

Also with --keyboard-raw=true

2023-01-19 10:39:19,066 client   1 @24.700 parse_key_event(<Gdk.EventKey object at 0x7fa7101c7010 (void at 0x20db960)>, True)=KeyEvent(modifiers=[], keyname=Super_L, keyval=65515, keycode=133, group=0, string=, pressed=True)
2023-01-19 10:39:19,067 client   1 @24.703 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), KeyEvent(modifiers=[], keyname=Super_L, keyval=65515, keycode=133, group=0, string=, pressed=True)) wid=1
2023-01-19 10:39:19,067 client   1 @24.703 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), 'Super_L', [], True) shortcuts_enabled=True, shortcuts=None
2023-01-19 10:39:19,067 client   1 @24.704 send_key_action(1, KeyEvent(modifiers=[], keyname=Super_L, keyval=65515, keycode=133, group=0, string=, pressed=True))
2023-01-19 10:39:19,078 process_key_action(['key-action', 1, 'Super_L', True, (), 65515, '', 133, 0]) server keycode=133, group=0
2023-01-19 10:39:19,078 set_keyboard_layout_group(0) ignored, value unchanged
2023-01-19 10:39:19,078 filtered_modifiers_set([])=set()
2023-01-19 10:39:19,078 filtered_modifiers_set([])=set()  
2023-01-19 10:39:19,078 handle_key((1, True, 'Super_L', 65515, 133, [], True, True))  
2023-01-19 10:39:19,078 handle keycode pressing   133: key 'Super_L'                                                                                           
2023-01-19 10:39:19,078 fake_key(133, True)                                                                                                                    
2023-01-19 10:39:19,152 client   1 @24.787 parse_key_event(<Gdk.EventKey object at 0x7fa7101c7470 (void at 0x20dba00)>, True)=KeyEvent(modifiers=['mod4'], keyname=2, keyval=50, keycode=11, group=0, string=2, pressed=True)
2023-01-19 10:39:19,153 client   1 @24.788 handle_key_action(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), KeyEvent(modifiers=['mod4'], keyname=2, keyval=50, keycode=11, group=0, string=2, pressed=True)) wid=1
2023-01-19 10:39:19,153 client   1 @24.791 key_handled_as_shortcut(GLClientWindow(1 : GLDrawingArea(1, (3840, 2160), YUV420P)), '2', ['mod4'], True) shortcuts_enabled=True, shortcuts=None
2023-01-19 10:39:19,155 client   1 @24.792 send_key_action(1, KeyEvent(modifiers=['mod4'], keyname=2, keyval=50, keycode=11, group=0, string=2, pressed=True))
2023-01-19 10:39:19,162 process_key_action(['key-action', 1, '2', True, ('mod4',), 50, '2', 11, 0]) server keycode=11, group=0
2023-01-19 10:39:19,162 set_keyboard_layout_group(0) ignored, value unchanged
2023-01-19 10:39:19,162 filtered_modifiers_set(['mod3'])={'mod3'}
2023-01-19 10:39:19,163 filtered_modifiers_set(['mod4'])={'mod4'}
2023-01-19 10:39:19,163 make_keymask_match(['mod4']) current mask: {'mod3'}, wanted: {'mod4'}, ignoring=11/['2'], keys_pressed={}
2023-01-19 10:39:19,163 Warning: found no keynames for 'mod3'
2023-01-19 10:39:19,163 change_mask({'mod3'}, False, remove) failed=[]
2023-01-19 10:39:19,163 keynames(mod4)={'Super_L', 'Super_R', 'Hyper_L'}, keycodes=[133, 206, 134, 207], nuisance=False, nuisance keys={'lock', 'mod2'}
2023-01-19 10:39:19,163 add mod4 with keycode 133 did not work
2023-01-19 10:39:19,163  trying to unpress it!
2023-01-19 10:39:19,163 change_mask(add) ['mod4'] modifier 'mod4' using keycode 133, success: False
2023-01-19 10:39:19,163 add mod4 with keycode 206 did not work
2023-01-19 10:39:19,163  trying to unpress it!
2023-01-19 10:39:19,163 change_mask(add) ['mod4'] modifier 'mod4' using keycode 206, success: False
2023-01-19 10:39:19,163 add mod4 with keycode 134 did not work
2023-01-19 10:39:19,164  trying to unpress it!
2023-01-19 10:39:19,164 change_mask(add) ['mod4'] modifier 'mod4' using keycode 134, success: False
2023-01-19 10:39:19,164 add mod4 with keycode 207 did not work
2023-01-19 10:39:19,164  trying to unpress it!
2023-01-19 10:39:19,164 change_mask(add) ['mod4'] modifier 'mod4' using keycode 207, success: False
2023-01-19 10:39:19,164 change_mask({'mod4'}, True, add) failed=['mod4']
2023-01-19 10:39:19,164 is_modifier(11) not found
2023-01-19 10:39:19,164 handle_key((1, True, '2', 50, 11, ['mod4'], False, True))
2023-01-19 10:39:19,164 handle keycode pressing    11: key '2'
2023-01-19 10:39:19,164 fake_key(11, True)
totaam commented 1 year ago

Two more things worth trying:

dukzcry commented 1 year ago

@totaam Awesome, thanks! Running the server with --keyboard-layout=client makes it work correctly The only downside is that in this mode xpra completely intercepts all key combos, I should try the autograb functional then

totaam commented 1 year ago

Perhaps we can make it easier to switch: #3779.