On Sun, 29 Sep 2013, Rodolfo kix Garcia escribió:
> Hi,
>
> sources are different from version 0.8 to now, but I found this patch in the
> Debian BTS and the problem probably exists yet.
>
> See this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256792
>
> I tryied it here, and something odd happends following the steps that
> "Fernando M. Maresca" (8/Jul/2004) points.
>
> I check with this behaviour:
>
> 1. Create a new user and set the options like Fernando says (really, default
> config).
> 2. Open the two windows.
> 3. Hold Alt+Tab -> switchpanel is painted
> 4. Press any key -> switchpanel is closed
> 5. Hold Alt+Tab again
> 6. Move the mouse over the Clip. Press left button and try to move the Clip.
> -> Nothing happends
> 7. Press a key -> switchpanel is closed AND the Clip is attached to the mouse
> pointer (move a bit the mouse).
>
> Cheers,
> kix
Hi,
I check the code again, I think is the same idea, but with different lines. The
new code doesn't process the modifiers in the first lines of the function,
does't it later.
I attached the patch updated.
While Alt+Tab, if the key press is not a WKBD_FOCUSNEXT|WKBD_FOCUSPREV|...
breaks. The code is more clear, and with less lines.
---------------8<-----------
case KeyRelease:
if (ev.xkey.keycode == shiftLKey || ev.xkey.keycode ==
shiftRKey)
if (wPreferences.strict_windoze_cycle)
break;
if (ev.xkey.keycode == XK_Return)
break;
if (ev.xkey.keycode != binding.keycode)
done = True;
break;
---------------8<-----------
I tested it here, and seems to be fine. Please, test it and if all is ok,
Carlos, feel free to include a description. Please, don't remember the patch
was written by "David Butts", is not mine (I only updated it).
This is the idea of the patch:
1. First, save the binding, do not process it yet:
---------------8<-----------
if (next) {
if (class_only)
- hasModifier = (wKeyBindings[WKBD_GROUPNEXT].modifier !=
0);
+ binding = wKeyBindings[WKBD_GROUPNEXT];
else
- hasModifier = (wKeyBindings[WKBD_FOCUSNEXT].modifier !=
0);
+ binding = wKeyBindings[WKBD_FOCUSNEXT];
} else {
if (class_only)
- hasModifier = (wKeyBindings[WKBD_GROUPPREV].modifier !=
0);
+ binding = wKeyBindings[WKBD_GROUPPREV];
else
- hasModifier = (wKeyBindings[WKBD_FOCUSPREV].modifier !=
0);
+ binding = wKeyBindings[WKBD_FOCUSPREV];
}
---------------8<-----------
2. We don't need the keymap variable below, so we can delete this line (I
removed the curly brackets too).
---------------8<-----------
- if (hasModifier) {
- keymap = XGetModifierMapping(dpy);
+ hasModifier = (binding.modifier != 0);
+ if (hasModifier)
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync,
GrabModeAsync, CurrentTime);
- }
---------------8<-----------
3. This is the new idea, if the key is not valid, work is done.
---------------8<-----------
- for (i = 0; i < 8 * keymap->max_keypermod; i++) {
-
- int mask = 1 << (i / keymap->max_keypermod);
+ if (ev.xkey.keycode != binding.keycode)
+ done = True;
- if (keymap->modifiermap[i] == ev.xkey.keycode &&
- ((wKeyBindings[WKBD_FOCUSNEXT].modifier &
mask)
- || (wKeyBindings[WKBD_FOCUSPREV].modifier
& mask)
- || (wKeyBindings[WKBD_GROUPNEXT].modifier
& mask)
- || (wKeyBindings[WKBD_GROUPPREV].modifier
& mask))) {
- done = True;
- break;
- }
- }
---------------8<-----------
Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From b81c13dac8152755720132ecf440e80a63778e54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?=
<[email protected]>
Date: Sun, 29 Sep 2013 13:59:38 +0200
Subject: [PATCH] Test cycling.
---
src/cycling.c | 36 ++++++++++--------------------------
1 file changed, 10 insertions(+), 26 deletions(-)
diff --git a/src/cycling.c b/src/cycling.c
index 291a28a..bc5f347 100644
--- a/src/cycling.c
+++ b/src/cycling.c
@@ -82,7 +82,7 @@ static WWindow *change_focus_and_raise(WWindow *newFocused, WWindow *oldFocused,
void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_only)
{
- XModifierKeymap *keymap = NULL;
+ WShortKey binding;
WSwitchPanel *swpanel = NULL;
WScreen *scr = wScreenForRootWindow(event->xkey.root);
KeyCode leftKey = XKeysymToKeycode(dpy, XK_Left);
@@ -108,20 +108,19 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
if (next) {
if (class_only)
- hasModifier = (wKeyBindings[WKBD_GROUPNEXT].modifier != 0);
+ binding = wKeyBindings[WKBD_GROUPNEXT];
else
- hasModifier = (wKeyBindings[WKBD_FOCUSNEXT].modifier != 0);
+ binding = wKeyBindings[WKBD_FOCUSNEXT];
} else {
if (class_only)
- hasModifier = (wKeyBindings[WKBD_GROUPPREV].modifier != 0);
+ binding = wKeyBindings[WKBD_GROUPPREV];
else
- hasModifier = (wKeyBindings[WKBD_FOCUSPREV].modifier != 0);
+ binding = wKeyBindings[WKBD_FOCUSPREV];
}
- if (hasModifier) {
- keymap = XGetModifierMapping(dpy);
+ hasModifier = (binding.modifier != 0);
+ if (hasModifier)
XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
- }
scr->flags.doing_alt_tab = 1;
@@ -144,7 +143,6 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
}
while (hasModifier && !done) {
- int i;
WMMaskEvent(dpy, KeyPressMask | KeyReleaseMask | ExposureMask
| PointerMotionMask | ButtonReleaseMask | EnterWindowMask, &ev);
@@ -211,19 +209,9 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
if (ev.xkey.keycode == XK_Return)
break;
- for (i = 0; i < 8 * keymap->max_keypermod; i++) {
-
- int mask = 1 << (i / keymap->max_keypermod);
+ if (ev.xkey.keycode != binding.keycode)
+ done = True;
- if (keymap->modifiermap[i] == ev.xkey.keycode &&
- ((wKeyBindings[WKBD_FOCUSNEXT].modifier & mask)
- || (wKeyBindings[WKBD_FOCUSPREV].modifier & mask)
- || (wKeyBindings[WKBD_GROUPNEXT].modifier & mask)
- || (wKeyBindings[WKBD_GROUPPREV].modifier & mask))) {
- done = True;
- break;
- }
- }
break;
case EnterNotify:
@@ -253,13 +241,9 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
break;
}
}
- if (keymap)
- XFreeModifiermap(keymap);
-
- if (hasModifier) {
+ if (hasModifier)
XUngrabKeyboard(dpy, CurrentTime);
- }
if (swpanel)
wSwitchPanelDestroy(swpanel);
--
1.8.4.rc3