GNOME Bugzilla – Bug 489200
Keyboard stops working
Last modified: 2012-06-08 10:28:10 UTC
Please describe the problem: After a random amount of time, GTK+ apps stop accepting keyboard input. I built a debug version of GTK+ 2.10.14 and enabled GDK_DEBUG=events, and GDK is seeing the keyboard events coming in from X, but somewhere after that they're getting lost. The mouse continues to work fine. I'm not sure where to look now other than attempting gdb. Steps to reproduce: 1. Start GTK+ based app 2. Use as normal 3. Some time later it stops taking keyboard input Actual results: The app stops getting keyboard input Expected results: The app should normally continue to process keyboard events Does this happen every time? Yes Other information: This started after I upgraded from Ubuntu Feisty to Ubuntu Gutsy. I don't know what the GTK version was for Feisty but something changed.
I've seen this too, and it's very, very annoying. I think it's like all input gets locked to going to a single widget for a while... I typically bring up Run... dialog using Alt+F2 and run xterm, then kill metacity and it sometimes fixes it...
Well, I've switched to using RXVT since it doesn't depend on it. If no one else has any ideas, can someone at least point me toward the code path in GTK that handles this? One thing I forgot to mention, sometimes if I switch windows and then switch back to the unresponsive app, its like the key queue unloads and I get 5-10 characters that I had typed.
Oh, one more thing. It sounds like when this happens to you it's infrequent. For me, I have yet to go more than 40 minutes without it happening. I have restarted Thunderbird 7 times today, Pidgin 3 times (haven't used it as often) and gnome-terminal twice before I installed and switched to RXVT.
I got a response in a forum that indicates that this might be this bug: https://bugs.launchpad.net/fedora/+bug/66104 I'm going to try modifying my SCIM config as specified since I don't use deadkeys and see if that fixes it.
Well, that seems to have increased the amount of time before it loses keyboard, but I just got the problem again. Is there some developer documentation that could help me narrow down where the problem is occuring? I'm going to start reading through the source code to see if I can find it, but I'm not sure if there's a central "pipe" that key events go through other than GDK (which is getting the events). Thanks, Derek
A quick update. I've added some debug statements and tried some debugging through GDB and at this point I'm still a little lost. When the problem happens I can see the key event percolate up from GDK all the way to gtk_widget_event_internal. It gets passed to MozContainer, which I'm assuming is some subclassed container that Thunderbird uses. I don't yet have a debug build of glib, so I can't tell what happens after the g_signal_emit in MozContainer, but somewhere after that point it stops being handled. I'm going to post to the mailing list and see if I get anywhere, but if anyone has any ideas I'd really appreciate them.
OK, I'm slowly tracking it down. I have noticed a difference in event handling when the app stops working. I'm attaching a trace of when it works and when it doesn't. In the trace where it works, for some reason when I type "s", GDK says an Alt_L keypress follows it. In the trace where it doesn't work this doesn't happen.
Created attachment 97873 [details] Trace from when the app works.
Created attachment 97874 [details] Trace when the app doesn't work
Derek: Does this problem still happen in a recent GTK+ version (such as 3.2 or 2.24)? If yes, which version, and which distribution do you use? Note to myself: Bug 536886 is a bit similar.
NEEDINFO as per last comment. Anybody can still reproduce this in 2.24 or newer?
Please feel free to reopen the bug if the problem still occurs with a newer version of GNOME 3.2.2 or 3.4.1 or later, thanks.