Programs not accepting input?

Robert Watson rwatson at
Sun Mar 26 11:16:40 UTC 2006

On Sun, 26 Mar 2006, Peter Jeremy wrote:

> On Sun, 2006-Mar-26 17:50:09 +1030, Greg 'groggy' Lehey wrote:
>> In the last month or two I've seen increasing occurrences of programs
>> refusing keyboard input after they've been running for a while
>> (between hours and days).  They still respond to the mouse.  At first
>> I thought it was hardware, but it happens on a number of different
>> machines, and only with certain programs, all of them X clients.
>> Here's an overview (system names are simply to show that they're
>> different machines).
> Is the problem that the clients aren't taking focus or have focus but aren't 
> accepting keyboard input?
> My work system runs separate X servers on two heads (rather than ximerama) 
> and I have problems with windows occasionally refusing to accept focus after 
> I move the pointer from screen to screen (though I can get an alternative 
> window to accept focus and then switch back to the window I originally 
> wanted).  This started after an upgrade but I'm not sure which one.

I've noticed that KDE's window manager, especially the version currently in 
ports, seems to occasionally have focus management problems.  If I use 
ctrl-alt-tab to manually switch the focus, keyboard and some mouse input works 
properly, and after a program exits, things start working right.  I think 
what's going on is that the window manager becomes confused as the mouse 
passes over the panel or interacts with the panel, as at that point the focus 
gets "stuck".  Probably because mouse input events have been grabbed and not 
released, which is not an unusual X window manager application bug.  Once the 
grab has happened without a release, the mouse remains grabbed until that 
application exits or releases it, so that would be consistent with my 
triggering a release by the window manager through exiting another program and 
then triggering the bug again by passing over the panel (or whatever).

So I'd almost certainly put this down to an X11 application bug, possibly in 
the window manager.  The "grab" behavior is one of the more unfortunate ones 
in X11, since it allows an application to very trivially interfere with the 
operation of the window server as a whole, and it's an easy bug to implement 
(just like leaking memory -- you have an error path and forget to release all 

Robert N M Watson

More information about the freebsd-hackers mailing list