]> Pileus Git - wmpus/blobdiff - sys-x11.c
Add TYPE_TOOLBAR instead of hiding them in sys
[wmpus] / sys-x11.c
index c55e5372892daaf1e62e6a1df56d44a1a25d3ead..1a7c7e016f45c12f47d6b8d19b972ed1449a2dd5 100644 (file)
--- a/sys-x11.c
+++ b/sys-x11.c
@@ -32,6 +32,7 @@
 /* Configuration */
 static int border     = 2;
 static int no_capture = 0;
+static int stack      = 25;
 
 /* Internal structures */
 struct win_sys {
@@ -403,10 +404,8 @@ static void process_event(int type, XEvent *xe, win_t *root)
        else if (type == UnmapNotify) {
                if ((win = win_find(dpy,xe->xunmap.window,0)) &&
                     win->state != ST_HIDE) {
-                       if (!strut_del(root, win))
-                               wm_remove(win);
-                       else
-                               wm_update();
+                       strut_del(root, win);
+                       wm_remove(win);
                        win->state = ST_HIDE;
                }
        }
@@ -443,10 +442,9 @@ static void process_event(int type, XEvent *xe, win_t *root)
                        if (win_prop(win, NET_STATE) == atoms[NET_FULL])
                                win->state = ST_FULL;
                        XSelectInput(win->sys->dpy, win->sys->xid, PropertyChangeMask);
-                       if (!strut_add(root, win))
-                               wm_insert(win);
-                       else
-                               wm_update();
+                       if (strut_add(root, win))
+                               win->type = TYPE_TOOLBAR;
+                       wm_insert(win);
                }
                sys_show(win, win->state);
        }
@@ -584,6 +582,8 @@ void sys_show(win_t *win, state_t state)
                break;
        case ST_SHADE:
                printf("sys_show: shade %p\n", win);
+               XConfigureWindow(win->sys->dpy, win->sys->xid, CWHeight,
+                               &(XWindowChanges){ .height = stack });
                XMapWindow(win->sys->dpy, win->sys->xid);
                break;
        case ST_ICON:
@@ -667,6 +667,7 @@ win_t *sys_init(void)
        Window   xid;
 
        /* Load configuration */
+       stack      = conf_get_int("main.stack",      stack);
        border     = conf_get_int("main.border",     border);
        no_capture = conf_get_int("main.no-capture", no_capture);
 
@@ -708,12 +709,14 @@ void sys_run(win_t *root)
                                        &par, &xid, &kids, &nkids)) {
                        for(int i = 0; i < nkids; i++) {
                                win_t *win = win_find(root->sys->dpy, kids[i], 1);
-                               if (win && win_viewable(win) && !strut_add(root,win))
+                               if (win && win_viewable(win)) {
+                                       if (strut_add(root,win))
+                                               win->type = TYPE_TOOLBAR;
                                        wm_insert(win);
+                               }
                        }
                        XFree(kids);
                }
-               wm_update(); // For struts
        }
 
        /* Main loop */