From ae91ee4b0a6238b12d60bfdc8ada38ba326bd1e3 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 30 May 2013 15:57:42 +0100 Subject: [PATCH] Handle Return in switchpanel. Explicitly match a Return keypress in the switchpanel, so that the currently selected window is focused without the keypress event being handled elsewhere. Pressing Return to commit the window selection is intuitive but other shortcuts may bind Return. Any keypress not explicitly handled in the switchpanel code will be passed through to other shortcut processing. If, for example, alt+return were mapped to Select Window and the switchpanel is open, pressing return while holding alt would both commit the window change AND select the window, which is not intuitive. --- src/cycling.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cycling.c b/src/cycling.c index 78449b4e..3414ae21 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -92,6 +92,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl KeyCode shiftLKey = XKeysymToKeycode(dpy, XK_Shift_L); KeyCode shiftRKey = XKeysymToKeycode(dpy, XK_Shift_R); KeyCode escapeKey = XKeysymToKeycode(dpy, XK_Escape); + KeyCode returnKey = XKeysymToKeycode(dpy, XK_Return); Bool esc_cancel = False; Bool somethingElse = False; Bool done = False; @@ -189,6 +190,11 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl esc_cancel = True; done = True; + } else if (ev.xkey.keycode == returnKey) { + + /* Close the switchpanel without eating the keypress */ + done = True; + } else if (ev.xkey.keycode != shiftLKey && ev.xkey.keycode != shiftRKey) { somethingElse = True; @@ -202,6 +208,9 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl if (wPreferences.strict_windoze_cycle) break; + if (ev.xkey.keycode == XK_Return) + break; + for (i = 0; i < 8 * keymap->max_keypermod; i++) { int mask = 1 << (i / keymap->max_keypermod);