See #396, #454, and #42. Maybe also #43. I investigated the differences in the low-level event array sent by the VM to the image for relevant CTRL-key combinations. For key-character events, that array is structured as follows: {
2 "type for keyboard event"
293847 "timestamp"
... "character code ASCII"
0 "key character, not key down or key up"
2 "ctrl key as modifier pressed only"
... "character code as Unicode"
0 "reserved"
1 "host window number 1"
} So, please focus on those character codes. Windows 10 (Version 1909)
Result: Our mouse-wheel hack does not set the Unicode character. Only the ASCII character. Debian 10 (Gnome, X11)
Result: Our mouse-wheel hack raises all modifier keys as pressed. Not just the CTRL key. Also, the ASCII control characters are not considered. See https://en.wikipedia.org/wiki/Control_character. macOS Sierra (10.12.6)
Result: Our mouse-wheel hack raises all modifier keys as pressed. Not just the CTRL key. Implications for the image side: We cannot consistently (or easily or without magic) duplicate or swap or unpack character codes via
— |
Some addition to Debian 10 (Gnome, X11) from above:
So, it seems that only for ctrl + Aa-Zz those ASCII and Unicode codes got duplicated. That's very strange. — |
In reply to this post by David T Lewis
Note: linux behavior is not strange, it is deliberate, see this: It was introduced with 1b837f9 If we want to fix it, we can just enclose this piece of code with Though, on windows, only the I do not see equivalent code on OSX... However, I suggest deeper change, as in this branch: We should have Then the utf32 can eventually be the ASCII control character or not, whatever we want, we have to decide... — |
In reply to this post by David T Lewis
I have fixed ctrl+a to ctrl+z on linux and mousewheels on windows (all meta bits are now set on all OS). Please check and report if we can close. Note 1: If we want, we can also generate mousewheels events on windows (instead of arrow key+meta bits events), I opened a branch for that. But trackpads may generate way too many small deltas that overwhelm the image side event loop, so not sure it is ready. Note 2: for exotic ctrl+key, I'm afraid that it will be difficult to obtain consistent behavior cross-OS cross-keyboard... — |
In reply to this post by David T Lewis
Hi Nicolas, I'm following the discussion on the background. I think you're right on using the keycode and not an ascii code. Using ascii to identify keys is a vestige from old "silly terminals". However, there are no keys in ascii to identify for example keys like ctrl, cmd or alt by themselves (and not as modifiers). Regarding keyboard events (dunno about mousewheel in particular), my take here is that existing windowing/ui frameworks (cocoa/carbon, x11, windows forms..) send two different kind of events:
Now, the complication here to me is that historically morphic (in squeak and pharo, probably cuis still too?) has been using the text event to drive everything, even shortcuts. So the code managing keyup/downs is not used at all in my experience, and the code managing keypresses in morphs is overly complicated. And changing this while changing the VM at the same time can lead easily to a state where we cannot type :). Now, as a single small step in what I believe is the right direction, I've implemented in Pharo mappings of keyboard virtual tables => the VM sends the raw virtual keycode to the image side (which depends on the platform) and on the image side this platform dependent virtual keycode is mapped to a common representation for all of them. Like that a single virtual key code table is used in client code. When I did that a couple of years ago, I've chosen to use "in image" X11's virtual key codes because it looked the broader and it seemed to contain the ones from osx and windows. Check https://github.com/pharo-project/pharo/blob/Pharo8.0/src/System-Platforms/KeyboardKey.class.st. Then the idea is that morphic events are extended to get the correct key object with a double dispatch: KeyboardEvent >> key
^Smalltalk os keyForValue: keyValue
UnixPlatform >> keyForValue: aKeyValue
^KeyboardKey valueForUnixPlatform: aKeyValue. Still missing, some accessors for common keys like MyMorph>>keyDown: anEvent
anEvent key = KeyboardKey alt
ifTrue: [ self openWindowSelector ]
MyMorph>>keyUp: anEvent
anEvent key = KeyboardKey alt
ifTrue: [ self closeWindowSelector ] A similar approach could be implemented vm side to map events. I like however the image one because it can be changed easily :) — |
In reply to this post by David T Lewis
Moreover, as soon as we are outside the "occidental" keyboard mappings, the one key -> one letter mapping becomes false :). For example, the character 腕 is a single character and has a single unicode code point. Thus, it comes as a single keypress/keychar event from the vm point of view. (then there is also integration with the system's IME, but that's another story...) Sorry if I'm a bit offtopic — |
In reply to this post by David T Lewis
Hi Guile, Note that the squeak is using Note that we also have unused slots (reserved1) in keyboard events, and I thought that we could use that to transfer OS dependent keyCode. This way, we could experiment both image side handling, and VM side handling of more complex events (composition etc...). Also, we would preserve a smooth transition without complete locked in syndrome. Note that even for occidental languages, I'm not satisfied with linux handling of dead keys (^ ¨ `) at VM side, I get decomposed unicode while the image rather expect precomposed (we can change the image for simple thing like that, but it's lot more work for more complex cases like you have shown). So IMO, OSVM should provide:
— |
Free forum by Nabble | Edit this page |