From 725276e644d0b8e9024fc8af134d8e85acffa52a Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Tue, 4 Sep 2012 07:04:57 +0000 Subject: [PATCH] Fix closing windows The win_msg function initializes a union.. Apparently since XEvent is a union the implied .xclient.type = 0 overrode the explicit .type = ClientMessage. Note: setting focus on gtk windows causes key presses to be missed for some reason.. so comment that out for now. --- sys-x11.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys-x11.c b/sys-x11.c index 2079ca5..c4a08ff 100644 --- a/sys-x11.c +++ b/sys-x11.c @@ -325,7 +325,7 @@ static int win_msg(win_t *win, atom_t msg) return 0; XSendEvent(win->sys->dpy, win->sys->xid, False, NoEventMask, &(XEvent){ - .type = ClientMessage, + .xclient.type = ClientMessage, .xclient.window = win->sys->xid, .xclient.message_type = atoms[WM_PROTO], .xclient.format = 32, @@ -554,7 +554,7 @@ void sys_focus(win_t *win) /* Set actual focus */ XSetInputFocus(win->sys->dpy, win->sys->xid, RevertToPointerRoot, CurrentTime); - win_msg(win, WM_FOCUS); + //win_msg(win, WM_FOCUS); /* Set border on focused window */ static win_t *last = NULL; @@ -629,7 +629,6 @@ void sys_show(win_t *win, state_t state) XSetErrorHandler(xerror); XUngrabServer(win->sys->dpy); } - XDestroyWindow(win->sys->dpy, win->sys->xid); break; } win->state = state; -- 2.41.0