]> Pileus Git - wmpus/blobdiff - sys-x11.c
Fix closing windows
[wmpus] / sys-x11.c
index 95672d0ce587477d80cb78caf4873f5d22a6ea12..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,
@@ -463,8 +463,10 @@ static void process_event(int type, XEvent *xe, win_t *root)
                printf("map_req: %lx\n", xe->xmaprequest.window);
                win = win_find(dpy,xe->xmaprequest.window,1);
                // fixme, for hide -> max, etc
-               if (win->state == ST_HIDE)
+               if (win->state == ST_HIDE) {
+                       wm_handle_state(win, win->state, ST_SHOW);
                        win->state = ST_SHOW;
+               }
                sys_show(win, win->state);
        }
        else if (type == ClientMessage) {
@@ -552,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;
@@ -627,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;