Skip to content

Commit

Permalink
when unmapping do not destroy client
Browse files Browse the repository at this point in the history
  • Loading branch information
c00kiemon5ter committed Oct 5, 2012
1 parent 344d3d0 commit ddaa6fc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions monsterwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
#define BUTTONMASK ButtonPressMask|ButtonReleaseMask
#define ISFFT(c) (c->isfull || c->isfloat || c->istrans)
#define ROOTMASK SubstructureRedirectMask|ButtonPressMask|SubstructureNotifyMask|PropertyChangeMask

enum { RESIZE, MOVE };
enum { TILE, MONOCLE, BSTACK, GRID, FLOAT, MODES };
Expand Down Expand Up @@ -261,8 +262,10 @@ void change_desktop(const Arg *arg) {
Desktop *d = &desktops[currdeskidx], *n = &desktops[(currdeskidx = arg->i)];
if (n->curr) XMapWindow(dis, n->curr->win);
for (Client *c = n->head; c; c = c->next) XMapWindow(dis, c->win);
XChangeWindowAttributes(dis, root, CWEventMask, &(XSetWindowAttributes){.do_not_propagate_mask = SubstructureNotifyMask});
for (Client *c = d->head; c; c = c->next) if (c != d->curr) XUnmapWindow(dis, c->win);
if (d->curr) XUnmapWindow(dis, d->curr->win);
XChangeWindowAttributes(dis, root, CWEventMask, &(XSetWindowAttributes){.event_mask = ROOTMASK});
if (n->head) { tile(n); focus(n->curr, n); }
desktopinfo();
}
Expand Down Expand Up @@ -295,7 +298,9 @@ void client_to_desktop(const Arg *arg) {
/* unlink current client from current desktop */
if (d->head == c || !p) d->head = c->next; else p->next = c->next;
c->next = NULL;
XChangeWindowAttributes(dis, root, CWEventMask, &(XSetWindowAttributes){.do_not_propagate_mask = SubstructureNotifyMask});
if (XUnmapWindow(dis, c->win)) focus(d->prev, d);
XChangeWindowAttributes(dis, root, CWEventMask, &(XSetWindowAttributes){.event_mask = ROOTMASK});
if (!(c->isfloat || c->istrans) || (d->head && !d->head->next)) tile(d);

/* link client to new desktop and make it the current */
Expand Down Expand Up @@ -981,8 +986,7 @@ void setup(void) {
* if all is good set the generic error handler */
XSetErrorHandler(xerrorstart);
/* set masks for reporting events handled by the wm */
XSelectInput(dis, DefaultRootWindow(dis), SubstructureRedirectMask|ButtonPressMask|
SubstructureNotifyMask|PropertyChangeMask);
XSelectInput(dis, root, ROOTMASK);
XSync(dis, False);
XSetErrorHandler(xerror);
XSync(dis, False);
Expand Down

0 comments on commit ddaa6fc

Please sign in to comment.