To reproduce: -install SDL, with DGA-support compiled in and Mailstrom (Fedora Core versions will do fine) -export export SDL_VIDEODRIVER=dga -run Maelstrom from an xterm, keep the enter key pressed after typing Maelstrom, untill you see the intro screen -release the enter key -exit from Maelstrom -notice how the enter key is stuck, press it to unstuck it. Now most people won't keep the enter key pressed after a command but certain DGA using programs use hotkeys to switch from a normal window to DGA, try for example: -download and compile xmame-0.85 (0.86 has a workaround), include DGA support -run it as root -press alt+home at the same time to switch to DGA mode -exit completly by pressing ESC -notice how alt is stuck (and so is home)
I have the same problem in my application. It has a curses interface, and a key to activate DGA fancy graphic thing, but when I close that window again, the terminal has never received a key release event, so it keeps re-pressing the key that activates my fancy graphic thingy. This bug needs to be solved as it is very annoying, but also a suggesion to how to work around this problem if you have a buggy Xorg server with this bug. Is it possible to forge a key-release event to all X clients from another X client, and in that case, how?
About the workaround, I've already added a workaround to xmame, the trick is not to fake a key release after leaving DGA, but to wait for all keys to be released before entering DGA, this can be done with the following code: int i; /* HACK HACK HACK, keys get stuck when they are pressed when XDGASetMode is called, so wait for all keys to be released */ do { char keys[32]; XQueryKeymap(display, keys); for (i=0; (i<32) && (keys[i]==0); i++) {} } while(i<32);
That should work very nice *merge in after the hollyday-vacation* Thank you!!
Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.
hmm. unless i'm mistaken, focusout should provide an implicit keyrelease. which means you should just wait to initialise dga until you've got the focus, and then you won't have any problems? in any case, this doesn't happen for me with xserver from master and xmame 0.106, so it could've been a problem with the old input code. -> FIXED, please reopen if i'm wrong
(In reply to comment #5) > hmm. unless i'm mistaken, focusout should provide an implicit keyrelease. > which means you should just wait to initialise dga until you've got the focus, > and then you won't have any problems? > > in any case, this doesn't happen for me with xserver from master and xmame > 0.106, so it could've been a problem with the old input code. > Please notice from the original reproduction instructions for xmame: -download and compile xmame-0.85 (0.86 has a workaround), xmame-106 still has this workaround: int i; /* HACK HACK HACK, keys get stuck when they are pressed when XDGASetMode is called, so wait for all keys to be released */ do { char keys[32]; XQueryKeymap(display, keys); for (i=0; (i<32) && (keys[i]==0); i++) {} } while(i<32); Sine I'm no longer active as xmame author / maintainer I even don't have it installed, I did try the Maelstrom reproduction described with the initial bug report too: To reproduce: -install SDL, with DGA-support compiled in and Mailstrom (Fedora Core versions will do fine) -export export SDL_VIDEODRIVER=dga -run Maelstrom from an xterm, keep the enter key pressed after typing Maelstrom, untill you see the intro screen -release the enter key -exit from Maelstrom -notice how the enter key is stuck, press it to unstuck it. With this reproduction method the enter key still gets stuck. Hint, for some reason Maelstrom's display is garbled for me, to exit press a key and then 'q' > -> FIXED, please reopen if i'm wrong > Reopening.
'which means you should just wait to initialise dga until you've got the focus, and then you won't have any problems?' apologies if it seemed like 'kinda works now' was the operative part, but this was the salient part of the message. if you do a dga keyboard redirection before focus change, then i would expect breakage to ensue. is this the case?
(In reply to comment #7) > 'which means you should just wait to initialise dga until you've got the focus, > and then you won't have any problems?' > > apologies if it seemed like 'kinda works now' was the operative part, but this > was the salient part of the message. if you do a dga keyboard redirection > before focus change, then i would expect breakage to ensue. is this the case? > I dunno, i haven't looked at the code for ages and I don't have it available at the moment (can still get to it though) also this used to work back in the XFree 3.x days. Also notice that I've posted reproduction instructions for SDL using apps too, which is code which I didn't even write. I think its the responsibility of the X-server to properly maintain the key state, currently when a DGA app exits the X-server is reporting keys as pressed while they aren't. Least but not last, if I remember correctly neither xmame nor SDL use dga keyboard redirection, instead the grab the keyboard using the root window as grab window, so that they can still use normal XEvent processing for the keyboard independend of wether they are using DGA or a plain X-window.
Closing based on Daniel's comments. Alternatively, don't use DGA. Yuck.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.