From 4628d948a1806e89cdacfae7e59e229e3b758187 Mon Sep 17 00:00:00 2001 From: Michael Cardell Widerkrantz Date: Fri, 4 Mar 2011 14:22:00 +0100 Subject: In some cases focuswin isn't NULL but is on another workspace. A bug, but needs to be handled. --- mcwm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mcwm.c b/mcwm.c index 56f6416..f5c03c0 100644 --- a/mcwm.c +++ b/mcwm.c @@ -520,13 +520,13 @@ void changeworkspace(uint32_t ws) PDEBUG("Changing from workspace #%d to #%d\n", curws, ws); /* - * We lose our focus temporarily if the window we focus isn't - * fixed. An EnterNotify event will get our focus back later. + * We lose our focus if the window we focus isn't fixed. An + * EnterNotify event will set focus later. */ if (NULL != focuswin && !focuswin->fixed) { setunfocus(focuswin->id); - focuswin = NULL; + focuswin = NULL; } /* Go through list of current ws. Unmap everything that isn't fixed. */ @@ -1260,15 +1260,19 @@ void focusnext(void) } /* If we currently have no focus focus first in list. */ - if (NULL == focuswin) + if (NULL == focuswin || NULL == focuswin->wsitem[curws]) { PDEBUG("Focusing first in list: %p\n", wslist[curws]); client = wslist[curws]->data; + + if (NULL != focuswin && NULL == focuswin->wsitem[curws]) + { + PDEBUG("XXX Our focused window %d isn't on this workspace!\n", + focuswin->id); + } } else { - assert(NULL != focuswin->wsitem[curws]); - if (NULL == focuswin->wsitem[curws]->next) { /* -- cgit v1.2.3