On Wed 19.Aug'09 at 23:40:32 +0200, Nicolas Bonifas wrote: > > This is a slightly improved version of my patch (in the case when all > windows are minimized). > [...] > - If all windows are minimized, the first one in the list is selected, > instead of the second.
I have used a slightly different approach and in my tests all minimized windows continue to be minimized if I press ESC. The patch below applies against my git repo http://repo.or.cz/w/wmaker-crm.git which contains some other cleanups affecting src/cycling.c, so it won't apply to your source. But here it goes. From: Carlos R. Mafra <[email protected]> Date: Thu, 20 Aug 2009 06:05:04 +0200 Subject: [PATCH] Escape key handling in switchpanel Pressing the escape key (ESC) while the switchpanel is active cancels it and gives the focus back to the window which had it before the switchpanel was invoked. If all windows are minimized before the switchpanel was called, they will continue to be if ESC is pressed. In other words, pressing ESC is like going to the parallel universe where you never entered the switchpanel in the first place. Based on a patch by Nicolas Bonifas from 17.08.2009 --- src/cycling.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/src/cycling.c b/src/cycling.c index f7ddacf..c40c681 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -73,7 +73,9 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next) KeyCode endKey = XKeysymToKeycode(dpy, XK_End); KeyCode shiftLKey = XKeysymToKeycode(dpy, XK_Shift_L); KeyCode shiftRKey = XKeysymToKeycode(dpy, XK_Shift_R); + KeyCode escapeKey = XKeysymToKeycode(dpy, XK_Escape); Bool somethingElse = False; + Bool esc_cancel = False; Bool done = False; Bool hasModifier; int modifiers; @@ -177,6 +179,20 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next) raiseWindow(swpanel, newFocused); } } + } else if (ev.xkey.keycode == escapeKey) { + /* Focus the first window of the swpanel */ + newFocused = wSwitchPanelSelectFirst(swpanel, 0); + if (newFocused) { + wWindowFocus(newFocused, oldFocused); + oldFocused = newFocused; + + if (wPreferences.circ_raise) { + CommitStacking(scr); + raiseWindow(swpanel, newFocused); + } + } + esc_cancel = True; + done = True; } else if (ev.xkey.keycode != shiftLKey && ev.xkey.keycode != shiftRKey) { somethingElse = True; @@ -234,7 +250,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next) if (swpanel) wSwitchPanelDestroy(swpanel); - if (newFocused) { + if (newFocused && !esc_cancel) { wRaiseFrame(newFocused->frame->core); CommitStacking(scr); if (!newFocused->flags.mapped) -- 1.6.4.rc1.13.gec7b -- To unsubscribe, send mail to [email protected].
