From 26d2f4a4ce47c1096a169785279c671616c3390e Mon Sep 17 00:00:00 2001
From: David Maciejak <david.maciejak@gmail.com>
Date: Fri, 26 Sep 2014 11:23:33 +0700
Subject: [PATCH] wmaker: use default close keybinding in switch panel

This patch is setting the default close keybinding
in switch panel if any instead of the hardcoded esc key.
---
 src/cycling.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/cycling.c b/src/cycling.c
index cdd4377..a2c88b3 100644
--- a/src/cycling.c
+++ b/src/cycling.c
@@ -87,8 +87,8 @@ void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only)
 	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);
 	KeyCode         returnKey      = XKeysymToKeycode(dpy, XK_Return);
+	KeyCode         closeKey       = wKeyBindings[WKBD_CLOSE].keycode;
 	Bool            esc_cancel     = False;
 	Bool            somethingElse  = False;
 	Bool            done           = False;
@@ -102,6 +102,9 @@ void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only)
 	if (!wwin)
 		return;
 
+	if (closeKey == 0)
+		closeKey = XKeysymToKeycode(dpy, XK_Escape);
+
 	if (next) {
 		if (class_only)
 			binding = wKeyBindings[WKBD_GROUPNEXT];
@@ -172,7 +175,7 @@ void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only)
 				newFocused = wSwitchPanelSelectFirst(swpanel, ev.xkey.keycode != homeKey);
 				oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
 
-			} else if (ev.xkey.keycode == escapeKey) {
+			} else if (ev.xkey.keycode == closeKey) {
 
 				/* Focus the first window of the swpanel, despite the 'False' */
 				newFocused = wSwitchPanelSelectFirst(swpanel, False);
-- 
2.1.0

