-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux Squeak VM X11 keyboard changes breaks 32b VM #396
Comments
Thanks for all the work you've done on this. |
Thanks Tim, The following lines in sqUnixX11.c doesn't seem right. When Ctrl and p are pressed at the same time, sq2KeyPlain should return ctrl-p (16r10). This code returns p instead (16r70). I don't understand why this change was made.
Could you try a build with this section removed and see if it fixes your problem? |
Relevant commit: 1b837f9 |
Tim, I used gdb to nop out above code in the text segment as this was quicker and easier than trying to rebuild a 32b binary. Then the image worked like charm. The comment in recode() is confusing and I need time to understand its rationale. Shift is keyboard specific and decides charCode and should be handled in the VM while Ctrl is a modifier and should be passed to the image. So I don't understand why a key event should be generated when Shift alone is pressed or released. I also found a thread from 2012 where Guillermo Polito fixed a similar problem in Windows code HTH .. Subbu |
Hi Subbu, |
So, if I understand the issue, the problem is that we always get |
The https://linux.die.net/man/3/xlookupstring sounds clear to me: it should honour the shift for the
Does it work like advertised? We'd better activate |
Actually, the problem is that charCode in sq2KeyPlain has already translated ctrl and XK_a as ctrl-a (16r1), but the errant code returns 'a' instead of ctrl-a. |
Hi Subbu, you made very good job at tracking the changes causing the problem, but I'm not sure that reverting is the right solution, this change was made for some reason. If we want to disentangle the code and remove some cruft we need better understanding. So let's focus on symptoms: CTRL+d is performing So clearly, the CTRL/CMD or whatever modifier is taken into account, and transformation of keyValue to Ctrl-d code (0x4) is not necessary. It is not only not necessary, it also create various problems of interpretation of keyboard event, because 0x4 is also the encoding of END key, see implementors/senders of The problem we observe in Squeak images is that the A good candidate for suspiscion is in
Ahah: I don't know if this is a MacOS-centric piece of code or what, but if we generate CTRL modifier instead of CMD modifier, maybe the image code ain't gonna perform the cmdActions, but rather the shiftCmdActions as we observe. Since you seem to identify a change in modifier state between old and new VM, this is maybe where we start inquiring instead. The keyboard event is composed of several parts:
But only one code is retained in the Note that Ctrl-d has some mapping in shiftCmdActions, "thanks" to this super hack in
which implies that shift-command But I do not see any thing like that in cmdActions, You see that this would/could conflict with END key special actions (same for other special keys encoding), which is a bad thing. The Ctlr-d (0x4) value & co are a bad thing coming from the past (like console mode compatibility) that we do not need, neither at low level keyboard handling (KeyUp KeyDown), nor at higher level synthetic event handling (KeyStroke/KeyChar). I think we'd better keep the change you legitimately incriminated, and I would rather try to understand all the implications of |
Hi Nicolas, I need to ask, though: why then is this only a problem on 32-bit Linux VMs but not 64-bit Linux VMs? Thanks, |
Paraphrasing feenkcom/gtoolkit#9 found by @akgrant43 ...
|
Paraphasing http://forum.world.st/Linux-Squeak-VM-X11-keyboard-changes-td5099584.html
|
Paraphasing http://forum.world.st/Windows-cog-vm-Keyboard-events-related-about-keycode-mapping-td4330359.html
And other keys are the same, image-side having the same keycode with different keys. case WM_CHAR:
case WM_SYSCHAR:
/* Note: VK_RETURN is recorded as virtual key ONLY */
if(keyCode == 13) return 1;
+ charCode = keyCode;
pressCode = EventKeyChar;
break
...
- evt->charCode = keymap[keyCode & 0xff];
+ evt->charCode = charCode? charCode : keymap[keyCode & 0xff];
What was the conclusion of looking at that @guillep? |
Side comment 1 from http://forum.world.st/Windows-cog-vm-Keyboard-events-related-about-keycode-mapping-td4330359.html
|
Side comment 2 from http://forum.world.st/Windows-cog-vm-Keyboard-events-related-about-keycode-mapping-td4330359.html
|
Thank you, Nicolas, for your detailed analysis of the code path for handling keystrokes in the editor. Initially, I too traced this path and noticed that EventSensor>>processEvent: maps keystrokes using KeyDecodeTable before calling processKeyboardEvent. Key alt-d correctly invoked cmdActions in both 32b and 64b images but ctrl-d invoked shiftCmdActions in 32b image instead of cmdActions. The KeyDecodeTable is different in these two images. I agree that the sqUnixX11.c file is very messy and confusing. It mixes X11 terms (raw keycode and mapped keysym) with Squeak specific terms (keycode, charcode). JB's patch broke 32b image but not 64b. I proposed a partial rollback of this patch to get TimJ going while we sort out the mess. |
The change was made for this reason:
When running with the old vm and pressing/releasing Ctrl-a, I get this printed to the transcript:
When running with the new vm I get:
The new vm generates the correct codes, but Ctrl-a isn't selecting the whole text. Watching the events using |
Are you sure that it is working in a 64-bit image? I wasn't able to use Ctrl-a in my 64-bit vm using a Squeak 5.2 image with the new vm. |
I haven't tested it. I am just taking others' word that they tested a 64-bit VM and could not reproduce the problem I was reporting on my 32-bit VM. |
I wonder if some of what we're uncovering here is also related to why, on a Mac OS VM, the Alt/Option key will often be "stuck" after I Cmd-Tab to switch to a different task and then return. I often find that I have to hit Alt/Option once to "unstick" it after Cmd-Tab switching back to Squeak. |
Thanks Subbu! |
On 2019-06-12, at 1:10 PM, Nicolas Cellier ***@***.***> wrote:
Thanks Subbu! KeyDecodeTable was the piece that I missed. I searched where the hell in the VM this CTRL->CMD modifier dance was performed, but failed to find it. It was in the image of course! It certainly IS the key of the problem.
This is part of a problem I've seen too many times over the years; something needs a 'tweak' for platform A - change is made in the platform code. That leads to problems for platforms B & C, and changes are made in the image. We end up with a curious and impenetrable mix of image and platform code doing weird things... and years later no one can remember anything about it.
tim
--
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: LD: Lose Device
|
So why does CTRL+d work? If you have
will replace Ctrl-d code (0x4) + CTRL modifier (2) by $d + CMD modifier (8). If you have a VM outputting $d + CTRL, then this translation does NOT happen, and we encounter the strange code in
They don't. Only the preferences may differ or not... So some squeakers will reproduce the problem some not, it's just random. If other preferences is selected, like It may also depends on the We see that fixing the VM to make Brick/Bloc/GT/Whatever work, may break Morphic/MVC because they already have crooked workarounds that now fail. We arrived at a point where we cannot change a single feature without breaking another. Unpalatable! It does not mean we do not have to change things. We want to be able to evolve. We want a VM doing what it says and saying what it does (specs and docs please!), if possible not too complex things: that is transform OS specific events into platform agnostic events (preferably union of possible events rather than intersection IMO, or we'll never be on tablets and phones). While increasing VM consistency, we can start to disentangle image code and remove some hacks. But for this to happen, we have to put all expectations on the table and make some choice. CTRL = SHIFT+CMD is highly questionable for example, I'd like to know where it comes from to begin with? This is not the place to debate that, it's Squeak specific. I would rather close the issue and fix Squeak. Thoughts? |
On 12.06.2019, at 23:20, Nicolas Cellier ***@***.***> wrote:
(preferably union of possible events rather than intersection IMO, or we'll never be on tablets and phones)
The SDL Events are pretty good, I recon…
|
I like the SDL events, and I already have them working on the Minheadless VM since 1-2 years ago: We can use this for fixing the Keyboard and MOUSE inconsistency in Morphic for both Squeak, and Pharo. Mouse button numbers are also not assigned the same way in all the platforms. The VM events are pushed into queue (implemented with a circular buffer) that are fetched by the InputEventSensor >> #nextEvent method in Pharo. The SDL2 based display support in the Minheadless VM also allows the VM to handle SDL2 events that are not directed to the main VM window by exposing the following three primitives:
The support for using these primitives is already implemented and integrated in the standard Pharo 7 image. Using this VM fixes OSWindow event handling in Mac and Windows (in Linux it have been always working perfectly). |
This issue occurs for me in our 5.3beta builds. I can only use alt+c/v/x/p... to trigger the usual actions, not ctrl+c/v/x/p... as it used to be. I tried reverting the mentioned commit on the Cog branch, which I can confirm re-enables using the key combos as expected for me (1b837f9) |
I have fixed (patched?) ctrl+a to ctrl+z on linux VM. |
… [ isEnumerableObjectNoAssert: ]
…[ isEnumerableObjectNoAssert: ] KILLED by 1/1 test cases.
…: ] on method [ addToFreeTree:bytes: ]
… ] on method [ addToFreeTree:bytes: ] KILLED by 28/234 test cases.
… [ headerForSlots:format:classIndex: ] 86 test cases.
…[ headerForSlots:format:classIndex: ] 27/86 Test Cases are NOT EQUIVALENT
Tim Johnson reported a problem with 32b Linux builds:
http://forum.world.st/Linux-Squeak-VM-X11-keyboard-changes-td5099584.html
Pressing ctrl-d now acts like debugIt instead of doIt like in the 64b. Ctrl-p also stopping working.
I did a bisection of all versions in https://bintray.com/opensmalltalk/vm/cog/ and narrowed down the problem to
good squeak.cog.spur_linux32x86_201811272342.tar.gz
bad squeak.cog.spur_linux32x86_201812301551.tar.gz
The error is consistent on both 18231 and the oldest 18221 released image for 32b VM but does not appear with 64b VMs.
The text was updated successfully, but these errors were encountered: