On Fri 14.Nov'08 at 9:03:22 -0200, Renato Botelho wrote:
> On Fri, Nov 14, 2008 at 8:58 AM, Carlos R. Mafra <[EMAIL PROTECTED]> wrote:
> >
> > I will probably be ashamed by asking you this stupid question, but
> > let me try...
> >
> >> I'm using a Sun keyboard for a while, and i found a possible bug
> >> on "Focus next window" function, let me try to explain.
> >>
> >> My keyboard have a left Alt (Mod1), right Alt (Mod5) and another
> >> couple of Mod4 keys, on a common keyboard it could be compared
> >> with the Windows key.
> >>
> >> Since this Mod4 key is present on both sides of keyboard, i decided
> >> to change my shortcut to this function from Mod1+Tab to Mod4+Tab.
> >> After changed it on WPrefs, it worked but not fine, when I have some
> >> windows opened and press Mod4+Tab it opens the blue box with
> >> icons in the center of screen and change the window, but, when
> >> I release the keys, the blue box stay there, don't disapear.
> >>
> >> I need to press Mod4 again to make it disapear, now i back to Mod1
> >> and everything back to normal. I believe it's a but, don't you?
> >
> > Did you check with using 'xev' if this Mod4 key generates both
> > KeyPress and KeyRelease events when you press the key only once?
>
> KeyPress event, serial 27, synthetic NO, window 0x5800001,
> root 0x41, subw 0x0, time 670255524, (-165,624), root:(871,640),
> state 0x0, keycode 115 (keysym 0xffeb, Super_L), same_screen YES,
> XLookupString gives 0 bytes:
> XmbLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> KeyRelease event, serial 27, synthetic NO, window 0x5800001,
> root 0x41, subw 0x0, time 670255804, (-165,624), root:(871,640),
> state 0x40, keycode 115 (keysym 0xffeb, Super_L), same_screen YES,
> XLookupString gives 0 bytes:
> XFilterEvent returns: False
After discussing privately with Renato I managed to reproduce his
problem with the Windows key in my keyboard, which also has keycode = 115
and is recognized as Mod4.
After some time I noticed that this piece of code in src/cycling.c is
responsable for dealing with the KeyRelease event:
case KeyRelease:
#ifdef DEBUG
printf("Got key release\n");
#endif
for (i = 0; i < 8 * keymap->max_keypermod; i++) {
if (keymap->modifiermap[i] == ev.xkey.keycode &&
wKeyBindings[WKBD_FOCUSNEXT].modifier
& 1<<(i/keymap->max_keypermod)) {
done = True;
break;
}
}
break;
The problem happens because no keymap->modifiermap[i] among all
24 possibilities (max_keypermod = 3 here) is equal to 115.
By using a few printfs I discovered that wKeyBindings[WKBD_FOCUSNEXT].modifier
== 64
for the Mod4 key so if I set keymap->modifiermap[18] = 115 then I get the
correct behaviour when i = 18 in the above 'for' loop.
I don't know how to fix this properly, but as a workaround this patch works
for me here.
Renato, can you test it too?
diff --git a/src/cycling.c b/src/cycling.c
index 86bdb39..daab237 100644
--- a/src/cycling.c
+++ b/src/cycling.c
@@ -195,6 +195,7 @@ StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
}
break;
case KeyRelease:
+ keymap->modifiermap[18] = 115;
#ifdef DEBUG
printf("Got key release\n");
#endif
--
To unsubscribe, send mail to [EMAIL PROTECTED]