On 12/28/2009 04:42 PM, Julien Danjou wrote:
At 1262014207 time_t, Uli Schlachter wrote:
I verified the attached patch with a quick-and-dirty Xlib app which
XMapWindow()'d and then XWithdrawWindow()'d immediately afterward.
Without this patch, the bug described in FS#699 happened, with it
the bug didn't appear.

Pushed master&  3.4.

/me hides ashamed in a corner

(My patch caused awesome to lose windows on tag switch)
From ad9703f7438cd58d7eb506255130857d7245333c Mon Sep 17 00:00:00 2001
From: Uli Schlachter <[email protected]>
Date: Mon, 28 Dec 2009 19:14:46 +0100
Subject: [PATCH 1/2] Revert "Handle synthetic UnmapNotify events"

This reverts commit 8e672897cb3321dbd245c9ed4e114ee0cdfbf425.
---
 event.c |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/event.c b/event.c
index 38e61a1..370d9ae 100644
--- a/event.c
+++ b/event.c
@@ -665,23 +665,10 @@ event_handle_unmapnotify(void *data __attribute__ 
((unused)),
 
     if((c = client_getbywin(ev->window)))
     {
-        if(ev->event == xutil_screen_get(connection, c->phys_screen)->root)
-        {
-            if(!XCB_EVENT_SENT(ev))
-            {
-                /* A regular UnmapNotify, remove that client from our lists */
-                client_unmanage(c);
-            }
-            else
-            {
-                /* According to ICCCM 4.1.4 a client sends a synthetic
-                 * UnmapNotify when it wants to switch to Widthdrawn state.
-                 * We handle these by unmapping the client and waiting for the
-                 * "real" UnmapNotify.
-                 */
-                xcb_unmap_window(connection, ev->window);
-            }
-        }
+        if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
+           && XCB_EVENT_SENT(ev)
+           && xwindow_get_state_reply(xwindow_get_state_unchecked(c->window)) 
== XCB_WM_STATE_NORMAL)
+            client_unmanage(c);
     }
     else
         for(int i = 0; i < globalconf.embedded.len; i++)
-- 
1.6.5.7

From c8bd7f8a866392198f9fdabba32157a5bf4f2d5d Mon Sep 17 00:00:00 2001
From: Uli Schlachter <[email protected]>
Date: Mon, 28 Dec 2009 19:26:00 +0100
Subject: [PATCH 2/2] Handle synthetic UnmapNotify events *correctly*

Second try:

Turns out I messed up with XCB_EVENT_SENT() and had a "!" too much. The old code
already tried to cope with this, but forgot to actually unmap the window which
it just set to withdrawn state.

This time I tested the patch *again* and now I found even less bugs than on my
last try.

P.S.: I suck.

Signed-off-by: Uli Schlachter <[email protected]>
---
 event.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/event.c b/event.c
index 370d9ae..baaa92b 100644
--- a/event.c
+++ b/event.c
@@ -666,9 +666,11 @@ event_handle_unmapnotify(void *data __attribute__ 
((unused)),
     if((c = client_getbywin(ev->window)))
     {
         if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
-           && XCB_EVENT_SENT(ev)
-           && xwindow_get_state_reply(xwindow_get_state_unchecked(c->window)) 
== XCB_WM_STATE_NORMAL)
+           && XCB_EVENT_SENT(ev))
+        {
             client_unmanage(c);
+            xcb_unmap_window(connection, ev->window);
+        }
     }
     else
         for(int i = 0; i < globalconf.embedded.len; i++)
-- 
1.6.5.7

Reply via email to