From 12b6be768e0fd8b976f1ae823c803a8f6af84302 Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Sat, 19 Sep 2009 14:16:05 +0200 Subject: [PATCH] swpanel: Fix focus issue when alt-tabbing The problem was the following. While alt-tabbing from one window to a xterm, wait for the xterm to be raised but keep the alt key pressed. Now move the mouse cursor over the xterm and release the alt key. The result is a xterm in a zoombie focused state; its titlebar has the focused color but xterm itself is not focused and does not accept any input. Fix this by reinstating the check for a NULL pointer from wSwitchPanelHandleEvent() before changing focus. That function detects if the mouse cursor moved over to the same window which is currently being pointed out by the switchpanel, and returns NULL in this case (the check for panel->current != focus fails). Thanks to Paul Harris for reporting it! --- src/cycling.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cycling.c b/src/cycling.c index c064f1dc..63866803 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -221,12 +221,17 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl case MotionNotify: case ButtonRelease: - - newFocused = wSwitchPanelHandleEvent(swpanel, &ev); - oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False); - - if (ev.type == ButtonRelease) - done = True; + { + WWindow *tmp; + tmp = wSwitchPanelHandleEvent(swpanel, &ev); + if (tmp) { + newFocused = tmp; + oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False); + + if (ev.type == ButtonRelease) + done = True; + } + } break; default: -- 2.11.4.GIT