Not happy with it yet but it beats shitting X. This will never be seen
under normal load.
+Bool
+set_win_notify_cb(Display *d, XEvent *e, char *arg)
+{
+ struct ws_win *win = (struct ws_win *)arg;
+
+ if (win && win->id == e->xany.window && e->xany.type == PropertyNotify)
+ return (True);
+ return (False);
+}
+
void
set_win_state(struct ws_win *win, long state)
{
long data[] = {state, None};
void
set_win_state(struct ws_win *win, long state)
{
long data[] = {state, None};
DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", win->id);
XChangeProperty(display, win->id, astate, astate, 32, PropModeReplace,
(unsigned char *)data, 2);
DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", win->id);
XChangeProperty(display, win->id, astate, astate, 32, PropModeReplace,
(unsigned char *)data, 2);
+
+ if (state != WithdrawnState)
+ XIfEvent(display, &ev, set_win_notify_cb, (char *)win);
+Bool
+unmap_window_cb(Display *d, XEvent *e, char *arg)
+{
+ struct ws_win *win = (struct ws_win *)arg;
+
+ if (win && win->id == e->xany.window && e->xany.type == UnmapNotify)
+ return (True);
+ return (False);
+}
+
void
unmap_window(struct ws_win *win)
{
void
unmap_window(struct ws_win *win)
{
if (win == NULL)
return;
set_win_state(win, IconicState);
XUnmapWindow(display, win->id);
if (win == NULL)
return;
set_win_state(win, IconicState);
XUnmapWindow(display, win->id);
+
+ XIfEvent(display, &ev, unmap_window_cb, (char *)win);
for (j = 0; j < SWM_WS_MAX; j++)
TAILQ_FOREACH(win, &screens[i].ws[j].winlist, entry)
unfocus_win(win);
for (j = 0; j < SWM_WS_MAX; j++)
TAILQ_FOREACH(win, &screens[i].ws[j].winlist, entry)
unfocus_win(win);