Menu

#8 handleFocusGrab never sees FocusOut

open
nobody
None
5
2008-12-19
2008-12-19
Anonymous
No

Hello and thanks for imwheel!

I run debian stable (etch) w/ these relevant packages:

xorg_7.2-5
fvwm_2.5.18-3
imwheel_1.0.0pre12-7

I noticed when running imwheel in x windows zaxis mode that it would work the
first time it encountered a window but then fail after focusing away and then
back...

I think I've found the problem; this pseudo-code illustrates it:

if ( xevent->type == ButtonPress ) {
// do button stuff...
} else {
xevent->type = None;
}
if ( handleFocusGrab && xevent->type == FocusOut ) {
// do handleFocusGrab stuff...
}

Above we see that xevent->type can never be FocusOut... By the time
we are testing for that condition, the previous code has changes the
xevent->type to None.

This patch fixed it for me (just move the FocusOut test up):

----------------------------------

--- imwheel-1.0.0pre12/imwheel.c~ 2008-12-18 17:00:58.000000000 -0800
+++ imwheel-1.0.0pre12/imwheel.c 2008-12-18 17:23:21.000000000 -0800
@@ -327,6 +327,15 @@
}
}
}
+ if(handleFocusGrab && e->type==FocusOut && (!useFifo && !grabbed))
+ {
+ // the focus is leaving the @Exclude´d window,
+ // so we want to grab the buttons again
+ grabButtons(d,0);
+ // we don't need any further events from that window for now
+ // we asked for events during ungrab...below
+ XSelectInput(d, e->xany.window, NoEventMask);
+ }
if(e->type==ButtonPress
&& (isUsedButton(e->xbutton.button) || (!useFifo && grabbed)))
{
@@ -346,15 +355,6 @@
e->xbutton.button=button=0;
e->type=None;
}
- if(handleFocusGrab && e->type==FocusOut && (!useFifo && !grabbed))
- {
- // the focus is leaving the @Exclude´d window,
- // so we want to grab the buttons again
- grabButtons(d,0);
- // we don't need any further events from that window for now
- // we asked for events during ungrab...below
- XSelectInput(d, e->xany.window, NoEventMask);
- }
if(e->type==ButtonPress)
Printf("getInput: Button=%d\n",button);
return(button);

Discussion


Log in to post a comment.

MongoDB Logo MongoDB