Re: Broken enter-exit focus behavior in 1.5.3

On Monday 30 November 2009 03:39:39 sand blarg net wrote:
> The problem is, events related to mouse motion appear to use grabs
> behind the scenes.

Pressing a button causes an implicit pointer grab.  Releasing the button 
releases the grab.  Essentially this means that events from a pointer 
drag are delivered exclusively to the window that the drag started in, 
even if the drag ends outside that window.

> This means that we end up dropping focus events.

EnterNotify events actually.

> I first noticed this with the raise-lower-window-and-transients
> command, which I have bound to Mouse2 in titlebars.  The lowered
> window maintains the focus, when the new top window should get focus.

I cannot reproduce this.  If lowering causes the topmost window under 
the pointer to change, the new window gets focus.  If lowering does not 
cause the pointer to change window, focus remains in the lowered window 
as it should.  Have you bound the command to Button2-Click instead of 
Button2-Off?  Generally only menus should be bound to Click actions.

> Dragged mouse motion (Button1-Move) has the same problem: if I drag a
> window underneath another one and release, to top window does not get
> focus.

No.  It is debatable whether it should because of the general principle 
that pointer drags do not affect other windows than the one where the 
drag started from. 

> I also found by accident that it screws up restoring focus
> after a (select-window) call.

Please elaborate.

> Can anyone explain why the filter was put in?

I did that in commit c10c8c032606b30e704be61837b2a69293f054cf.  Chris 
also seems to have copied my commit log into the file as a comment.

Ignoring grab-related events fixes some errors where focus is directed 
to the window under pointer when it should be directed somewhere else, 
typically to the parent of a transient window that has closed.  It 
causes some errors where focus should be directed to the window under 
pointer but is instead directed elsewhere.  It is difficult to tell the 
two cases apart automatically, but the latter type of errors is easier 
to deal with manually if you use enter-click focus.

	Timo Korvola		<URL:>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]