From 6dc4316f6940d863dc72286870fe91d41efc8306 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 25 Jul 2007 20:49:50 -0400 Subject: [PATCH] change the root event mask to add SubstructureNotifyMask, so we can hear about Override-redirect windows --- openbox/event.c | 11 +++++++---- openbox/frame.c | 6 +++++- openbox/screen.c | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index d2febd7e..b84dd63f 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1180,14 +1180,17 @@ static void event_handle_client(ObClient *client, XEvent *e) break; } case UnmapNotify: - if (client->ignore_unmaps) { - client->ignore_unmaps--; - break; - } + /* Don't care about the frame window unmapping */ + if (e->xunmap.window != client->window) break; + ob_debug("UnmapNotify for window 0x%x eventwin 0x%x sendevent %d " "ignores left %d\n", client->window, e->xunmap.event, e->xunmap.from_configure, client->ignore_unmaps); + if (client->ignore_unmaps) { + client->ignore_unmaps--; + break; + } client_unmanage(client); break; case DestroyNotify: diff --git a/openbox/frame.c b/openbox/frame.c index 9fb7b2b8..f1201f5a 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -936,9 +936,13 @@ void frame_grab_client(ObFrame *self) this occurs from a MapRequest. However, in the case where Openbox is starting up, the window is already mapped, so we'll see an unmap event for it. + + We also have to ignore a second UnmapNotify because we have + selected for SubstructureNotify on root. For whatever good reason, this + means we get 2 UnmapNotify events. */ if (ob_state() == OB_STATE_STARTING) - ++self->client->ignore_unmaps; + self->client->ignore_unmaps += 2; /* select the event mask on the client's parent (to receive config/map req's) the ButtonPress is to catch clicks on the client border */ diff --git a/openbox/screen.c b/openbox/screen.c index 8be41a47..cb704ac9 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -49,7 +49,8 @@ #define ROOT_EVENTMASK (StructureNotifyMask | PropertyChangeMask | \ EnterWindowMask | LeaveWindowMask | \ SubstructureRedirectMask | FocusChangeMask | \ - ButtonPressMask | ButtonReleaseMask) + ButtonPressMask | ButtonReleaseMask | \ + SubstructureNotifyMask) static gboolean screen_validate_layout(ObDesktopLayout *l); static gboolean replace_wm(); -- 2.34.1