xpra icon
Bug tracker and wiki

Opened 6 months ago

Closed 3 months ago

Last modified 2 months ago

#1870 closed defect (fixed)

Key Mapping Problem

Reported by: Dweller Owned by: Antoine Martin
Priority: critical Milestone: 2.4
Component: keyboard Version: 2.3.x
Keywords: Cc:

Description

Overview

I'm using a GB keyboard, on a Canadian system, running Win 10, accessing Ubuntu via Xpra.

Windows client 2.3.1 r19531 64bit
Server 2.2.6-r18968 (from package 2.2.6-r18969-1 (latest from winswitch repo))

With a gb keyboard selected in xpra, I see the following in Ubuntu.
key-> result.

 [ -> 8
 ] -> 9
 < -> Z
 & -> K
 ^ -> C
 ` -> 
 ' -> ´ (after 2 presses!)
 ~ ->

With us mapping selected, I see

 # -> 3

(but it's clearly still using a uk keymap, because shift-2 is sending " rather than @ etc, all other keys are sending their gb keycap value, except for £ that sends |. £ would normally be # on a us layout)

Xpra worked fine for many years, but started with this behavior after a version upgrade near the start of this year.. updated to latest version to see if the problem went away, but no luck.

Given the number of keys involved, I'm going to capture info for the # and & keys when on us and gb keymaps. Hopefully the cause behind '#' sending a '3' when on us keymap, and '&' sending a 'K' is the same as why all the other keys above are misbehaving on gb keymap.

Shout if additional info is needed.. I can append as required.

Keyboard Type

  • Microsoft Comfort Curve 3000 UK Layout

GTK Keyboard Test results.

GTK_Keyboard_Text.exe

pressing my # key
 - down/up numbersign # 35 222 0 0 []
pressing shift-7 (ampersand)
 - down/up ampersand & 38 55 0 0 ['S']

Setxkbmap ouput

setxkbmap output : (for us keymap selected)

$ setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us

setkbmap output : (for gb keymap selected)

$ setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+gb+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};
$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     gb

xmodmap output

Requested for 'both' but not available on windows, supplied from host.

gb layout

$ xmodmap -pm
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_L (0xcc),  Meta_L (0xcd),  Meta_R (0xfe)
mod2        Num_Lock (0x4d)
mod3        Super_L (0x85),  Super_R (0x86),  Super_L (0xce)
mod4        Hyper_L (0xcf),  Hyper_R (0xfd)
mod5        ISO_Level3_Shift (0x5c),  ISO_Level3_Shift (0x6c),  Mode_switch (0xcb)

Server keycode 16,45,51 from xmodmap -pke

keycode  16 = 7 ampersand 7 ampersand
keycode  45 = k K k K kra ampersand kra
keycode  51 = numbersign asciitilde numbersign asciitilde dead_grave dead_breve dead_grave

us layout

$ xmodmap -pm
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),  Alt_L (0xcc),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        Super_L (0x85),  Super_R (0x86),  Super_L (0xce)
mod4        Hyper_L (0xcf),  Hyper_R (0xfe)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

Server keycode 12,16 from xmodmap -pke

keycode  12 = 3 numbersign 3 numbersign
keycode  16 = 7 ampersand 7 ampersand

xbkprint

$ xkbprint -label name $DISPLAY

(No Output)

xev output for keys

# key being pressed with us keymap active

KeyPress event, serial 36, synthetic NO, window 0x2e00001,
    root 0x25c, subw 0x0, time 92934654, (236,102), root:(447,853),
    state 0x10, keycode 12 (keysym 0x33, 3), same_screen YES,
    XLookupString gives 1 bytes: (33) "3"
    XmbLookupString gives 1 bytes: (33) "3"
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2e00001,
    root 0x25c, subw 0x0, time 92934830, (236,102), root:(447,853),
    state 0x10, keycode 12 (keysym 0x33, 3), same_screen YES,
    XLookupString gives 1 bytes: (33) "3"
    XFilterEvent returns: False

# key being pressed with gb keymap active

KeyPress event, serial 36, synthetic NO, window 0x2e00001,
    root 0x25c, subw 0x0, time 92991528, (186,-23), root:(423,754),
    state 0x10, keycode 51 (keysym 0x23, numbersign), same_screen YES,
    XLookupString gives 1 bytes: (23) "#"
    XmbLookupString gives 1 bytes: (23) "#"
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2e00001,
    root 0x25c, subw 0x0, time 92991644, (186,-23), root:(423,754),
    state 0x10, keycode 51 (keysym 0x23, numbersign), same_screen YES,
    XLookupString gives 1 bytes: (23) "#"
    XFilterEvent returns: False

& key being pressed with gb keymap active

KeyPress event, serial 36, synthetic NO, window 0x1000001,
    root 0x25c, subw 0x0, time 95078279, (-16,102), root:(325,983),
    state 0x11, keycode 45 (keysym 0x4b, K), same_screen YES,
    XLookupString gives 1 bytes: (4b) "K"
    XmbLookupString gives 1 bytes: (4b) "K"
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001,
    root 0x25c, subw 0x0, time 95078383, (-16,102), root:(325,983),
    state 0x11, keycode 45 (keysym 0x4b, K), same_screen YES,
    XLookupString gives 1 bytes: (4b) "K"
    XFilterEvent returns: False

& key being pressed with us keymap active

KeyPress event, serial 36, synthetic NO, window 0x1200001,
    root 0x25c, subw 0x0, time 95144998, (398,367), root:(505,1014),
    state 0x11, keycode 16 (keysym 0x26, ampersand), same_screen YES,
    XLookupString gives 1 bytes: (26) "&"
    XmbLookupString gives 1 bytes: (26) "&"
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1200001,
    root 0x25c, subw 0x0, time 95145104, (398,367), root:(505,1014),
    state 0x11, keycode 16 (keysym 0x26, ampersand), same_screen YES,
    XLookupString gives 1 bytes: (26) "&"
    XFilterEvent returns: False

Xpra debug keyboard

Press of # key with GB Keymap

2018-06-09 08:14:53,879 set_keyboard_layout_group(0) current keyboard group=None
2018-06-09 08:14:53,879 setting XKB layout group 0
2018-06-09 08:14:53,879 get_keycode(222, numbersign, ('mod2',)) keyname+keycode lookup: 51
2018-06-09 08:14:53,879 process_key_action(['key-action', 2, 'numbersign', True, ('mod2',), 35, '#', 222, 0]) server keycode=51
2018-06-09 08:14:53,880 filtered_modifiers_set(['mod2'])=set(['mod2'])
2018-06-09 08:14:53,880 filtered_modifiers_set(('mod2',))=set(['mod2'])
2018-06-09 08:14:53,880 handle_key(2,True,numbersign,35,51,('mod2',)) keyboard_sync=True
2018-06-09 08:14:53,880 is_modifier(51) not found
2018-06-09 08:14:53,880 handle keycode pressing    51: key 'numbersign'
2018-06-09 08:14:53,880 fake_key(51, True)
2018-06-09 08:14:53,881 scheduling key repeat timer with delay 500 for numbersign / 51
2018-06-09 08:14:54,030 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:14:54,030 get_keycode(222, numbersign, ('mod2',)) keyname+keycode lookup: 51
2018-06-09 08:14:54,030 process_key_action(['key-action', 2, 'numbersign', False, ('mod2',), 35, '#', 222, 0]) server keycode=51
2018-06-09 08:14:54,030 filtered_modifiers_set(['mod2'])=set(['mod2'])
2018-06-09 08:14:54,030 filtered_modifiers_set(('mod2',))=set(['mod2'])
2018-06-09 08:14:54,031 handle_key(2,False,numbersign,35,51,('mod2',)) keyboard_sync=True
2018-06-09 08:14:54,031 is_modifier(51) not found
2018-06-09 08:14:54,031 handle keycode unpressing  51: key 'numbersign'
2018-06-09 08:14:54,031 fake_key(51, False)

Press of & with GB Keymap

2018-06-09 08:22:05,496 handle keycode pressing    45: key 'ampersand'
2018-06-09 08:22:05,496 fake_key(45, True)
2018-06-09 08:22:05,496 scheduling key repeat timer with delay 500 for ampersand / 45
2018-06-09 08:22:05,598 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:22:05,598 get_keycode(55, ampersand, ('shift', 'mod2')) keyname+keycode lookup: 45
2018-06-09 08:22:05,598 process_key_action(['key-action', 4, 'ampersand', False, ('shift', 'mod2'), 38, '&', 55, 0]) server keycode=45
2018-06-09 08:22:05,598 filtered_modifiers_set(['mod2', 'shift'])=set(['shift', 'mod2'])
2018-06-09 08:22:05,599 filtered_modifiers_set(('shift', 'mod2'))=set(['shift', 'mod2'])
2018-06-09 08:22:05,599 handle_key(4,False,ampersand,38,45,('shift', 'mod2')) keyboard_sync=True
2018-06-09 08:22:05,599 is_modifier(45) not found
2018-06-09 08:22:05,599 handle keycode unpressing  45: key 'ampersand'
2018-06-09 08:22:05,599 fake_key(45, False)
2018-06-09 08:22:06,158 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:22:06,158 get_keycode(16, Shift_L, ('mod2',)) keyname+keycode lookup: 50
2018-06-09 08:22:06,158 process_key_action(['key-action', 4, 'Shift_L', False, ('mod2',), 65505, '', 16, 0]) server keycode=50
2018-06-09 08:22:06,158 modifier 'shift' ignored (in ignored keynames=set(['Shift_L', 'Shift_R']))
2018-06-09 08:22:06,158 filtered_modifiers_set(['mod2', 'shift'])=set(['mod2'])
2018-06-09 08:22:06,159 filtered_modifiers_set(('mod2',))=set(['mod2'])
2018-06-09 08:22:06,159 handle_key(4,False,Shift_L,65505,50,('mod2',)) keyboard_sync=True
2018-06-09 08:22:06,159 handle keycode unpressing  50: key 'Shift_L'
2018-06-09 08:22:06,159 fake_key(50, False)

Press of # Key with US Keymap

2018-06-09 08:15:38,257 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:15:38,257 get_keycode(222, numbersign, ('mod2',)) keyname+keycode lookup: 12
2018-06-09 08:15:38,257 process_key_action(['key-action', 2, 'numbersign', True, ('mod2',), 35, '#', 222, 0]) server keycode=12
2018-06-09 08:15:38,257 filtered_modifiers_set(['mod2'])=set(['mod2'])
2018-06-09 08:15:38,257 filtered_modifiers_set(('mod2',))=set(['mod2'])
2018-06-09 08:15:38,258 handle_key(2,True,numbersign,35,12,('mod2',)) keyboard_sync=True
2018-06-09 08:15:38,258 is_modifier(12) not found
2018-06-09 08:15:38,258 handle keycode pressing    12: key 'numbersign'
2018-06-09 08:15:38,258 fake_key(12, True)
2018-06-09 08:15:38,258 scheduling key repeat timer with delay 500 for numbersign / 12
2018-06-09 08:15:38,360 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:15:38,361 get_keycode(222, numbersign, ('mod2',)) keyname+keycode lookup: 12
2018-06-09 08:15:38,361 process_key_action(['key-action', 2, 'numbersign', False, ('mod2',), 35, '#', 222, 0]) server keycode=12
2018-06-09 08:15:38,361 filtered_modifiers_set(['mod2'])=set(['mod2'])
2018-06-09 08:15:38,361 filtered_modifiers_set(('mod2',))=set(['mod2'])
2018-06-09 08:15:38,361 handle_key(2,False,numbersign,35,12,('mod2',)) keyboard_sync=True
2018-06-09 08:15:38,361 is_modifier(12) not found
2018-06-09 08:15:38,362 handle keycode unpressing  12: key 'numbersign'
2018-06-09 08:15:38,362 fake_key(12, False)

Press of & Key with US Keymap

2018-06-09 08:27:08,823 handle keycode pressing    16: key 'ampersand'
2018-06-09 08:27:08,824 fake_key(16, True)
2018-06-09 08:27:08,824 scheduling key repeat timer with delay 500 for ampersand / 16
2018-06-09 08:27:08,918 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:27:08,918 get_keycode(55, ampersand, ('shift', 'mod2')) keyname+keycode lookup: 16
2018-06-09 08:27:08,918 process_key_action(['key-action', 4, 'ampersand', False, ('shift', 'mod2'), 38, '&', 55, 0]) server keycode=16
2018-06-09 08:27:08,919 filtered_modifiers_set(['mod2', 'shift'])=set(['shift', 'mod2'])
2018-06-09 08:27:08,919 filtered_modifiers_set(('shift', 'mod2'))=set(['shift', 'mod2'])
2018-06-09 08:27:08,919 handle_key(4,False,ampersand,38,16,('shift', 'mod2')) keyboard_sync=True
2018-06-09 08:27:08,919 is_modifier(16) not found
2018-06-09 08:27:08,919 handle keycode unpressing  16: key 'ampersand'
2018-06-09 08:27:08,919 fake_key(16, False)
2018-06-09 08:27:09,958 set_keyboard_layout_group(0) current keyboard group=0
2018-06-09 08:27:09,958 get_keycode(16, Shift_L, ('mod2',)) keyname+keycode lookup: 50
2018-06-09 08:27:09,958 process_key_action(['key-action', 4, 'Shift_L', False, ('mod2',), 65505, '', 16, 0]) server keycode=50
2018-06-09 08:27:09,958 modifier 'shift' ignored (in ignored keynames=set(['Shift_L', 'Shift_R']))
2018-06-09 08:27:09,959 filtered_modifiers_set(['mod2', 'shift'])=set(['mod2'])
2018-06-09 08:27:09,959 filtered_modifiers_set(('mod2',))=set(['mod2'])
2018-06-09 08:27:09,959 handle_key(4,False,Shift_L,65505,50,('mod2',)) keyboard_sync=True
2018-06-09 08:27:09,959 handle keycode unpressing  50: key 'Shift_L'
2018-06-09 08:27:09,959 fake_key(50, False)

Attachments (4)

usinfo.txt (143.8 KB) - added by Dweller 6 months ago.
Xpra Info for US Layout
gbinfo.txt (146.3 KB) - added by Dweller 6 months ago.
Xpra Info for GB Layout
xpra.log (625.1 KB) - added by Dweller 6 months ago.
Xpra log with -d keyboard
keymap_info.txt (193.6 KB) - added by Dweller 6 months ago.
Results of Keymap_info.exe on client

Download all attachments as: .zip

Change History (14)

comment:1 Changed 6 months ago by Antoine Martin

Owner: changed from Antoine Martin to Dweller

Please add "xpra info" for both layouts.
Having the server log wouldn't hurt either.

Changed 6 months ago by Dweller

Attachment: usinfo.txt added

Xpra Info for US Layout

Changed 6 months ago by Dweller

Attachment: gbinfo.txt added

Xpra Info for GB Layout

comment:2 Changed 6 months ago by Dweller

Owner: changed from Dweller to Antoine Martin

Ubuntu Version:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

Changed 6 months ago by Dweller

Attachment: xpra.log added

Xpra log with -d keyboard

Changed 6 months ago by Dweller

Attachment: keymap_info.txt added

Results of Keymap_info.exe on client

comment:3 Changed 3 months ago by Antoine Martin

Milestone: 2.4
Owner: changed from Antoine Martin to Antoine Martin
Priority: majorcritical
Status: newassigned

Will fix, I can reproduce this.

This really looks like something that #1902 should have fixed already.

comment:4 Changed 3 months ago by Antoine Martin

I believe r20530 is the correct fix for this.
(more and more we use the new dynamic key lookup code for non-native clients, instead of relying on the pre-calculated translation map because this can take into account the level of the key)

This fix will be backported after more testing.

@Dweller: you should be able to apply it by hand.

comment:5 Changed 3 months ago by Dweller

I'll have a try later this evening =)

comment:6 Changed 3 months ago by Antoine Martin

I'll have a try later this evening =)

Thanks. There are updated beta builds with this fix for Ubuntu here: https://xpra.org/beta.
(the fix is server-side only but you would also need r20420 so the 2.4 beta builds are your best bet)

comment:7 Changed 3 months ago by Dweller

Installed

  • xpra_2.4-20180926r20530-1_amd64.deb
  • Xpra-x86_64_Setup_2.4-r20529.exe

Keyboard now works as expected =) woohoo! =)

Although I've had to remove --sync-vfb=15 from my xpra launch args.

Otherwise the mouse doesn't seem to be able to interact with any windows, I can move, resize etc (all window manager type stuff), but clicking on buttons does nothing, and mouse-overs are not triggering, so I guess the apps are unaware of the pointer location. Since I'm running a beta build now, I'm just mentioning this here.. once a non-beta build with the keyboard fixes in is available, I'll move to it and let you know if the same behavior is still present.

FWIW, my launch args are...

xpra start :100 --start=/usr/bin/wbar \
   --xvfb='Xvfb +extension Composite -screen 0 7360x2560x24+32 -dpi 96 -nolisten tcp -noreset -auth $XAUTHORITY' --sync-xvfb=15 \
   --html=off --file-transfer=yes --encoding=jpeg \
   --speaker=disabled --microphone=disabled --no-pulseaudio --desktop-scaling=off
Last edited 3 months ago by Antoine Martin (previous) (diff)

comment:8 Changed 3 months ago by Antoine Martin

Resolution: fixed
Status: assignedclosed

Keyboard now works as expected =) woohoo! =)

Closing.

I've had to remove --sync-vfb=15 from my xpra launch args.

Moving this to #1968

FWIW, my launch args are...

That's a strange launch args:

  • why the xvfb line? doesn't the default one work?
  • encoding=jpeg is rarely a good option, it is best to tune (min)quality and (min)speed instead

comment:9 Changed 3 months ago by Dweller

If I recall correctly, the xvfb arg was to add the screen size, because the normal default didn't allow for a client that large, preventing windows being moved to the full extents of the client desktop.

The jpeg was because mpeg based encoding lead to regular interval resolution drops, where it would go soft focus at what felt like key frame intervals. I suspect the large desktop size was having a bad impact on the codec. Jpeg was reliable, and I'm on a private wired gigabit LAN so bandwidth between the two isn't an issue.

comment:10 Changed 2 months ago by Antoine Martin

The sync-xvfb bug is fixed, see ticket:1968#comment:1.

Note: See TracTickets for help on using tickets.