changeset 3156:44a484b6353b

Fixed screen handling in unmap event
author unexist
date Wed, 14 Dec 2011 22:35:03 +0100
parents 08a7a8fad0d6
children 07d9e41d7b85
files src/subtle/event.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/subtle/event.c	Wed Dec 14 21:53:02 2011 +0100
+++ b/src/subtle/event.c	Wed Dec 14 22:35:03 2011 +0100
@@ -1597,11 +1597,11 @@
   SubClient *c = NULL;
   SubTray *t = NULL;
 
-  int focus = (subtle->windows.focus[0] == ev->window); ///< Save
-
   /* Check if we know this window */
   if((c = CLIENT(subSubtleFind(ev->window, CLIENTID))))
     {
+      int sid = (subtle->windows.focus[0] == c->win ? c->screenid : -1); ///< Save
+
       /* Set withdrawn state (see ICCCM 4.1.4) */
       subEwmhSetWMState(c->win, WithdrawnState);
 
@@ -1623,14 +1623,16 @@
       subScreenRender();
 
       /* Update focus if necessary */
-      if(focus)
+      if(-1 != sid)
         {
-          c = subClientNext(0);
+          c = subClientNext(sid);
           if(c) subClientFocus(c, True);
         }
     }
   else if((t = TRAY(subSubtleFind(ev->window, TRAYID)))) ///< Tray
     {
+      int focus = (subtle->windows.focus[0] == ev->window); ///< Save
+
       /* Set withdrawn state (see ICCCM 4.1.4) */
       subEwmhSetWMState(t->win, WithdrawnState);