-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Uli Schlachter wrote:
> On 12/28/2009 07:30 PM, Uli Schlachter wrote:
>> 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)
> 
> Please don't merge this for now.
> 
> Thinking in progress....
> (jeopardy music playing)

New version of this patch. I've been using this for a couple of days already so
it definitely shouldn't cause you to lose windows. ;)

Compares to the last version, this one ignores "real" UnmapNotifies (just like
current master does). On a synthetic one, the window is unmanaged internally and
unmapped to make sure it's really gone from the screen.

If the window was already unmapped, the new unmap shouldn't really cause
anything and we can't run into races since new maps would cause a MapRequest so
that everything is synchronised.

Also, this one also accepts windows which are in different state than Normal.
Iconic windows are minimized and there shouldn't really be a reason why those
can't be switched to withdrawn (= not visible to the user in any way, not on any
off-screen tag, not nothing). For withdrawn ones this shouldn't have any effect
and there aren't any more defined values for WM_STATE.

Uli

P.S.: Let's hope nothing breaks.
- --
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBCAAGBQJLQ7koAAoJECLkKOvLj8sG1ssIAIouAyBCyh/kWNEpvHP93iOY
hvjKyzjjJiEWJ1eHw4LQPiQMYEgNy2XnYi4xJZ5xZ8Yqk2k/DifoL3RcDbqrqGf2
fzY8jyqmTO8I+OxJEA3q412ujti1sHgbqRQZ62j7JxEO5tLC0J1O9xGTYiCrRHCI
ymB09Rkz3i/dsSdv/DUEyTbhqLv647k7O4qcoWuu0QZY2F1s2lfF3IWsyYcU2I8E
bg6PgYAuuLRiB9NmblJEdwY3ng3TjLEHvAE5aBjJed3bL6NwkAS2y3HOP04vsLF4
VbC5sLaR4mqppEtbEpjhhxBYa6JbbUJyw6eVIT2YJmeU7cTYxlon16gKK5p7m2k=
=s3F/
-----END PGP SIGNATURE-----
>From 69da55ae70fe2077ca9cdb32ba3d86089a770f7c Mon Sep 17 00:00:00 2001
From: Uli Schlachter <[email protected]>
Date: Mon, 28 Dec 2009 19:26:00 +0100
Subject: [PATCH] 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

Attachment: 0001-Handle-synthetic-UnmapNotify-events-correctly.patch.sig
Description: Binary data

Reply via email to