aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authorokan2013-11-12 21:25:00 +0000
committerokan2013-11-12 21:25:00 +0000
commit54971953b77791cb50aca61726b4e01f0c951c45 (patch)
tree489bc38c67e04b4b87f1154be8a9a577d9354af5 /xevents.c
parent288d3e0f5f00d896f730b8d7108ed32395ec36af (diff)
downloadcwm-54971953b77791cb50aca61726b4e01f0c951c45.tar.gz
Alter the r1.35 of event.c race fix. Remove the forward looking event
queue check (removing the need for a server grab/ungrab) - if the client is going away, let it fall all the way through to a DestroyNotify event. There's no longer a need for us to manually destroy a client ourselves (removing yet another server grab/ungrab). Instead, when the UnmapNotify event is synthetic, simply set the state to Withdrawn (as per ICCCM), else Iconic (in our case 'hidden'). Verified with test case from the 2009 race which was the original reason for r1.35 of event.c.
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/xevents.c b/xevents.c
index d92386b..854df0c 100644
--- a/xevents.c
+++ b/xevents.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xevents.c,v 1.91 2013/10/25 19:46:16 okan Exp $
+ * $OpenBSD: xevents.c,v 1.92 2013/11/12 21:25:00 okan Exp $
*/
/*
@@ -97,27 +97,15 @@ static void
xev_handle_unmapnotify(XEvent *ee)
{
XUnmapEvent *e = &ee->xunmap;
- XEvent ev;
struct client_ctx *cc;
- /* XXX, we need a recursive locking wrapper around grab server */
- XGrabServer(X_Dpy);
if ((cc = client_find(e->window)) != NULL) {
- /*
- * If it's going to die anyway, nuke it.
- *
- * Else, if it's a synthetic event delete state, since they
- * want it to be withdrawn. ICCM recommends you withdraw on
- * this even if we haven't alredy been told to iconify, to
- * deal with legacy clients.
- */
- if (XCheckTypedWindowEvent(X_Dpy, cc->win,
- DestroyNotify, &ev) || e->send_event != 0) {
- client_delete(cc, 1);
+ if (e->send_event) {
+ cc->state = WithdrawnState;
+ xu_set_wm_state(cc->win, cc->state);
} else
client_hide(cc);
}
- XUngrabServer(X_Dpy);
}
static void
@@ -127,7 +115,7 @@ xev_handle_destroynotify(XEvent *ee)
struct client_ctx *cc;
if ((cc = client_find(e->window)) != NULL)
- client_delete(cc, 0);
+ client_delete(cc);
}
static void