xpra icon
Bug tracker and wiki

Opened 6 years ago

Closed 6 years ago

#453 closed defect (fixed)

keyboard numpad doesn't work with osx client

Reported by: alas Owned by: alas
Priority: minor Milestone: 0.11
Component: client Version:
Keywords: osx Cc:

Description

With osx clients, xpra 0.11.0 (and probably all before) the numpad is not recognized in an xpra session (numpad keys are interpreted like arrow keys).

I'm attaching xpra session keyboard tool output and osx local keyboard tool output.

Attachments (8)

numPad-osx-0-10-8-r4595-keyboardTest (869 bytes) - added by alas 6 years ago.
Xpra session numpad output
osx_local_numpad_keyboard_output.txt (793 bytes) - added by alas 6 years ago.
osx local numpad output
NumLock-xpra-session-output_xpra_0-11r4707-client_4625-server_ (973 bytes) - added by alas 6 years ago.
Improved Xpra session numpad output
KeyCode.data.txt (10.9 KB) - added by Antoine Martin 6 years ago.
found as part of KeyRemap4MacBook on github
xpra_win_numpad_output (724 bytes) - added by alas 6 years ago.
xpra numpad output from win keyboard (same as mac keyboard...)
xpra_keyboard_output_control-v-command (2.4 KB) - added by alas 6 years ago.
xpra osx keyboard output - command key insight
osx_local_numpad_testings.txt (5.0 KB) - added by alas 6 years ago.
osx local environment numpad key mappings
osx-numlock.patch (879 bytes) - added by Antoine Martin 6 years ago.
always set numlock as being on

Download all attachments as: .zip

Change History (18)

Changed 6 years ago by alas

Xpra session numpad output

Changed 6 years ago by alas

osx local numpad output

comment:1 Changed 6 years ago by Antoine Martin

Keywords: osx added
Milestone: 0.11
Owner: changed from Antoine Martin to alas

In the local output, I can see that you pressed: 1,2,3,...

What about the xpra session output, what did you press there?
(seems completely random, Alt, Escape, KP_Begin, KP_5, Alt, Shift, Numlock, ...)

Can you give me matching outputs instead?

And if possible, without any pressed modifiers.
A separate single keypad keypress would help too.

Changed 6 years ago by alas

Improved Xpra session numpad output

Changed 6 years ago by Antoine Martin

Attachment: KeyCode.data.txt added

found as part of KeyRemap4MacBook on github

comment:2 Changed 6 years ago by Antoine Martin

Please read Apple KB PH3986.

From this page and many others on the subject, it appears that many different things can get in the way of using the numpad - and we want to ensure whatever solution we come up with will work in most cases:

  • try collecting keyboard data with the "Clear" key - it may need to be combined with "Shift" and/or "Control" to do anything..
  • same with "F6"
  • as per the link, try the settings ("mouse keys")
  • maybe different OSX versions behave differently too (we should not care about anything older than Lion)
  • if googling, try not to get frustrated at the moronic mac fanbois shouting "mac it's easy" whist claiming that using "control" + "shift" + "f6" for "numlock" makes any sense - I failed at this last one.

etc

Changed 6 years ago by alas

Attachment: xpra_win_numpad_output added

xpra numpad output from win keyboard (same as mac keyboard...)

Changed 6 years ago by alas

xpra osx keyboard output - command key insight

comment:3 Changed 6 years ago by alas

Attached file of numpad output with windows keyboard - looks essentially the same as that from a mac keyboard.

Interestingly, the command key tests for another ticket about to be filed revealed that xpra considers the command key to be a numlock key for one keystroke. I attached that as well, and will also attach it to the command v. control ticket to be made, as it seems relevant for both.

comment:4 Changed 6 years ago by Antoine Martin

Please see comment:2, I need to know what those keys do, if anything.

Also, the latest attachment seems to imply the keyboard tool was used from inside xpra? I need raw data, without xpra interfering.

Changed 6 years ago by alas

osx local environment numpad key mappings

comment:5 Changed 6 years ago by alas

Attached a file of local numpad key mappings.

  • osx 10.6.8 laptop keys - the F6 function did create a numpad, but converted m j k l u i o 7 8 9 into a numpad... when converted back was just part of keyboard (included a full mapping in each case).
  • osx 10.6.8 and 10.9 with external mac and external windows keyboards. Both behaved the same.
  • I had no success with clear, shift, ctrl, command &/or F6... in any combination... causing the numpads of the external keyboards to behave as if the numlock was off. Keystrokes for various experiments are included in the doc, and I did test each combination with both osx 10.6.8 and 10.9 - behaved exactly the same in every case.

Changed 6 years ago by Antoine Martin

Attachment: osx-numlock.patch added

always set numlock as being on

comment:6 Changed 6 years ago by Antoine Martin

OK, so there does not seem to be any difference between "num-locked" state and "non-num-locked" state. At least none that I can see.

Moreover, even with a keyboard that has a numlock key ("windows keyboard"), pressing the key shows up as:

down/up Escape                  65307   71      0 0 []

Is this the same value that you get when you press the actual "Escape" key?
It would be nice if we could emulate the numlock switching (even if we end up doing the reverse of what the client machine has set 50% of the time...)

The osx-numlock.patch may help, if it does then the fix can be backported to v0.10.x safely. If possible, please try the integrated patch from #456 - if that works then this is what will get used.

Works-for-me(tm)

Last edited 6 years ago by Antoine Martin (previous) (diff)

comment:7 Changed 6 years ago by Antoine Martin

In my VM, I find that escape comes up as:

down/up Escape                  65307   53      0 0 []

And numlock is as above (71), please confirm what you are seeing on a real keyboard/mac. It looks like the two keys do send a different keycode (53 vs 71) and so we could implement a software toggle if needed (not sure how we can find the 71 value without hardcoding it though..).

Ideally, we would just get the correct modifier mask from gtk... which should be possible: cocoa HandlingKeyEvents refers to NSNumericPadKeyMask and I can see in AppKit:

AppKit.NSNumericPadKeyMask = 0x200000

This may require a patch to gtk2.

comment:8 Changed 6 years ago by alas

I can confirm - on laptop built-in keyboard, external mac keyboard, and external microsoft keyboard - one and all - I get the same escape key mapping that you got with your VM.

I'll see about a build to test the patch in #456... though without Smo I'm not sure if we have patch building skills enough.

comment:9 Changed 6 years ago by alas

Testing with 0.11r4748 - the numpad works and the clear button allows the numlock to be "toggled" off/on as well. Nice work.

Version 0, edited 6 years ago by alas (next)

comment:10 Changed 6 years ago by Antoine Martin

Resolution: fixed
Status: newclosed

Applied numlock change only to v0.10.x branch in r4750.

r4751 adds a menu entry for toggling numlock state - this allows us to get in sync with the actual numlock state if we guess wrong (since we have no way of detecting the correct startup state)

If needed, we could improve on this in the future by:

  • fixing gtk builds to give us the correct numlock state
  • detecting numlock state ourselves
Note: See TracTickets for help on using tickets.