event: Improve configure request event handle

This commit is contained in:
Martin Duquesnoy 2008-11-09 16:31:17 +01:00
parent 80f1ebead0
commit 97c8da0153
4 changed files with 52 additions and 17 deletions

View File

@ -56,6 +56,28 @@ client_attach(Client *c)
return; 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 void
client_detach(Client *c) client_detach(Client *c)
{ {

View File

@ -131,23 +131,36 @@ configurerequest(XConfigureRequestEvent *ev)
{ {
CHECK(!c->tile); CHECK(!c->tile);
CHECK(!c->lmax); 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; else
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)))
{ {
client_moveresize(c, geo, True); wc.x = ev->x;
XReparentWindow(dpy, c->win, c->frame, wc.y = ev->y;
conf.client.borderheight, wc.width = ev->width;
conf.titlebar.height + conf.client.borderheight); 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); XSync(dpy, False);

View File

@ -194,7 +194,7 @@ handle_signal(int signum)
XSetErrorHandler(errorhandlerdummy); XSetErrorHandler(errorhandlerdummy);
for(c = clients; c; c = c->next) 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); client_unmanage(c);
} }
fprintf(stderr, "\nExit WMFS... Bye !!\n"); fprintf(stderr, "\nExit WMFS... Bye !!\n");
@ -261,7 +261,6 @@ main(int argc, char **argv)
sigaction(SIGTERM, &sig, NULL); sigaction(SIGTERM, &sig, NULL);
sigaction(SIGINT, &sig, NULL); sigaction(SIGINT, &sig, NULL);
/* Check if an other WM is already running; set the error handler */ /* Check if an other WM is already running; set the error handler */
XSetErrorHandler(errorhandler); XSetErrorHandler(errorhandler);

View File

@ -98,6 +98,7 @@ void uicb_infobar_togglepos(uicb_t cmd);
/* client.c */ /* client.c */
int client_pertag(int tag); int client_pertag(int tag);
void client_attach(Client *c); void client_attach(Client *c);
void client_configure(Client *c);
void client_detach(Client *c); void client_detach(Client *c);
void client_focus(Client *c); void client_focus(Client *c);
/* client_gb_*() {{{ */ /* client_gb_*() {{{ */