1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

swpanel: Fix stacking issue with swpanel escape handling

Daniel Déchelotte reported one problem with the escape handling in
the switchpanel:

   "Start with two windows: a fullscreen one, and a smaller window
    that appears above the fullscreen one. With the mouse, focus the
    bigger window. Start alt-tabbing, then press Escape. The bigger
    window will then be focused (good) *and raised* (small problem)."

Fix this by adding a test for the escape key before calling
raiseWindow().
This commit is contained in:
Carlos R. Mafra
2009-08-22 03:03:14 +02:00
parent 001bc28037
commit f79379c090

View File

@@ -62,7 +62,7 @@ static void raiseWindow(WSwitchPanel * swpanel, WWindow * wwin)
} }
static WWindow *change_focus_and_raise(WWindow *newFocused, WWindow *oldFocused, static WWindow *change_focus_and_raise(WWindow *newFocused, WWindow *oldFocused,
WSwitchPanel *swpanel, WScreen *scr) WSwitchPanel *swpanel, WScreen *scr, Bool esc_cancel)
{ {
if (!newFocused) if (!newFocused)
return oldFocused; return oldFocused;
@@ -72,7 +72,9 @@ static WWindow *change_focus_and_raise(WWindow *newFocused, WWindow *oldFocused,
if (wPreferences.circ_raise) { if (wPreferences.circ_raise) {
CommitStacking(scr); CommitStacking(scr);
raiseWindow(swpanel, newFocused);
if (!esc_cancel)
raiseWindow(swpanel, newFocused);
} }
return oldFocused; return oldFocused;
@@ -125,7 +127,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next)
if (swpanel) { if (swpanel) {
newFocused = wSwitchPanelSelectNext(swpanel, !next); newFocused = wSwitchPanelSelectNext(swpanel, !next);
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
} else { } else {
if (wwin->frame->workspace == scr->current_workspace) if (wwin->frame->workspace == scr->current_workspace)
newFocused = wwin; newFocused = wwin;
@@ -154,25 +156,25 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next)
|| ev.xkey.keycode == rightKey) { || ev.xkey.keycode == rightKey) {
newFocused = wSwitchPanelSelectNext(swpanel, False); newFocused = wSwitchPanelSelectNext(swpanel, False);
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
} else if ((wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode } else if ((wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
&& wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers) && wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers)
|| ev.xkey.keycode == leftKey) { || ev.xkey.keycode == leftKey) {
newFocused = wSwitchPanelSelectNext(swpanel, True); newFocused = wSwitchPanelSelectNext(swpanel, True);
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
} else if (ev.xkey.keycode == homeKey || ev.xkey.keycode == endKey) { } else if (ev.xkey.keycode == homeKey || ev.xkey.keycode == endKey) {
newFocused = wSwitchPanelSelectFirst(swpanel, ev.xkey.keycode != homeKey); newFocused = wSwitchPanelSelectFirst(swpanel, ev.xkey.keycode != homeKey);
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
} else if (ev.xkey.keycode == escapeKey) { } else if (ev.xkey.keycode == escapeKey) {
/* Focus the first window of the swpanel, despite the 'False' */ /* Focus the first window of the swpanel, despite the 'False' */
newFocused = wSwitchPanelSelectFirst(swpanel, False); newFocused = wSwitchPanelSelectFirst(swpanel, False);
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, True);
esc_cancel = True; esc_cancel = True;
done = True; done = True;
@@ -206,7 +208,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next)
case ButtonRelease: case ButtonRelease:
newFocused = wSwitchPanelHandleEvent(swpanel, &ev); newFocused = wSwitchPanelHandleEvent(swpanel, &ev);
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
if (ev.type == ButtonRelease) if (ev.type == ButtonRelease)
done = True; done = True;