diff --git a/src/client.c b/src/client.c index caa118c..3dfeccb 100644 --- a/src/client.c +++ b/src/client.c @@ -56,6 +56,28 @@ client_attach(Client *c) return; } +void +client_configure(Client *c) +{ + XConfigureEvent ev; + + ev.type = ConfigureNotify; + ev.event = c->win; + ev.window = c->win; + ev.x = c->geo.x; + ev.y = c->geo.y; + ev.width = c->geo.width; + ev.height = c->geo.height; + ev.above = None; + ev.border_width = 0; + ev.override_redirect = 0; + + XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ev); + + return; +} + + void client_detach(Client *c) { diff --git a/src/event.c b/src/event.c index 47a150a..ea3fa76 100644 --- a/src/event.c +++ b/src/event.c @@ -131,23 +131,36 @@ configurerequest(XConfigureRequestEvent *ev) { CHECK(!c->tile); CHECK(!c->lmax); + + if(ev->value_mask & CWX) + geo.x = ev->x; + if(ev->value_mask & CWY) + geo.y = ev->y; + if(ev->value_mask & CWWidth) + geo.width = ev->width; + if(ev->value_mask & CWHeight) + geo.height = ev->height; + + if(geo.x != c->geo.x || geo.y != c->geo.y + || geo.width != c->geo.width || geo.height != c->geo.height) + { + geo.x += BORDH; + geo.y += TBARH; + client_moveresize(c, geo, True); + } + else + client_configure(c); } - geo.x = wc.x = ev->x; - geo.y = wc.y = ev->y; - geo.width = wc.width = ev->width; - geo.height = wc.height = ev->height; - wc.border_width = ev->border_width; - wc.sibling = ev->above; - wc.stack_mode = ev->detail; - - XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); - - if((c = client_gb_win(ev->window))) + else { - client_moveresize(c, geo, True); - XReparentWindow(dpy, c->win, c->frame, - conf.client.borderheight, - conf.titlebar.height + conf.client.borderheight); + wc.x = ev->x; + wc.y = ev->y; + wc.width = ev->width; + wc.height = ev->height; + wc.border_width = ev->border_width; + wc.sibling = ev->above; + wc.stack_mode = ev->detail; + XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); } XSync(dpy, False); diff --git a/src/wmfs.c b/src/wmfs.c index 620defa..eea8f27 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -194,7 +194,7 @@ handle_signal(int signum) XSetErrorHandler(errorhandlerdummy); for(c = clients; c; c = c->next) { - XReparentWindow(dpy, c->win, root, 0, 0); + XReparentWindow(dpy, c->win, root, c->frame_geo.x, c->frame_geo.y); client_unmanage(c); } fprintf(stderr, "\nExit WMFS... Bye !!\n"); @@ -261,7 +261,6 @@ main(int argc, char **argv) sigaction(SIGTERM, &sig, NULL); sigaction(SIGINT, &sig, NULL); - /* Check if an other WM is already running; set the error handler */ XSetErrorHandler(errorhandler); diff --git a/src/wmfs.h b/src/wmfs.h index 5e9eae0..f224549 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -98,6 +98,7 @@ void uicb_infobar_togglepos(uicb_t cmd); /* client.c */ int client_pertag(int tag); void client_attach(Client *c); +void client_configure(Client *c); void client_detach(Client *c); void client_focus(Client *c); /* client_gb_*() {{{ */