[Vm-dev] key-up events missing for some unix machines?

tim Rowledge tim at rowledge.org
Tue Nov 5 01:59:57 UTC 2013

On 04-11-2013, at 5:19 PM, Ian Piumarta <piumarta at speakeasy.net> wrote:

> On Nov 4, 2013, at 16:28 , tim Rowledge wrote:
>> Interesting. I’m puzzled even more now since I see differences between the sqUnixX11.c in the Cog and plain trees, whereas I was until then convinced that they used the same platform code… sigh. 
> The Qwak/Teleplace code is based on an ancient fork of the tree that was closed-source for several years while the trunk diverged.  That's why Cog still uses Makefiles and not CMake, etc…

Hunh. I got the impression from the svn tree that they actually shared that part of things. Now I have to try to think why I misunderstood that…

> I remember fixing an issue with auto-repeating meta keys a few years ago, which might have introduced the issue with n-key rollover and missing up events.  I'll take a look (especially promptly if you can provide a simple reproducible test case/scenario :-).

Trivial test case - fire up the latest Scratch (do the magical apt-get etc scratch) and load ‘asteroids’ - which is like haemorrhoids except more painful - and use left/right cursor to rotate ye anciente space shippe. For me, quite often it will stick with one direction, especially if you hold down the key for a while and then let go. clicking or holding the other direction will usually make no difference but sometimes  sort of force a stand-off and no rotation. *usually* clicking the key for the stuck rotation will seem to release it, but not always.

In my very latest changes I’m trying out a state recorder attached as a HandMorph keyboard listener, but it seems to get flooded and spend a lot of time doing not much. I’m thinking it would make more sense for the keyboard state to be something maintained in the vm and accessed via a prim anyway. We have a lot of code that seems to be doing half the job anyway.

>> However, I get the problem on the Pi with both a plain interp and a stack vm, so I’m going to have to suspect either a systemic problem or the USB.
> I don't know if this is related but I've often had problems with X11 and the client being one event behind what the user is doing on the server.  Even when XSync()s are sprinkled in every conceivable place, some events just don't seem to make it into the dispatch loop when they are the last in the queue.  A typical symptom is a menu not seeing mouse up after you release the button, until you wiggle the cursor to generate some motion event pressure behind it.  One thing to look for is whether your missing up events appear if you wiggle the mouse immediately after releasing the key.
> It's not just Squeak.  I've seen this issue with many X11 programs.  I'd suspect something fishy with NDELAY on the connection, but after so many years one would expect xlib to be getting that right.

X getting it right? Good luck with that one...

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
A computer program does what you tell it to do, not what you want it to do.

More information about the Vm-dev mailing list