Fix closing windows
authorAndy Spencer <andy753421@gmail.com>
Tue, 4 Sep 2012 07:04:57 +0000 (07:04 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 5 Sep 2012 08:54:49 +0000 (08:54 +0000)
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

index 2079ca5679c20f520284063601d4455dc7cbc727..c4a08ffc554254a3384658ad0c8eab1af2e9fbeb 100644 (file)
--- 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;