From fdb38b5dec07592071acd31d8a9dfaf4e29617ac Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Fri, 21 Nov 2008 02:21:43 +0100 Subject: [PATCH] event: Fix configure request handle --- src/client.c | 4 ---- src/event.c | 58 +++++++++++++++------------------------------------ src/frame.c | 10 ++++----- src/structs.h | 2 +- 4 files changed, 23 insertions(+), 51 deletions(-) diff --git a/src/client.c b/src/client.c index c6e5391..2af5b7c 100644 --- a/src/client.c +++ b/src/client.c @@ -270,8 +270,6 @@ client_get_name(Client *c) void client_hide(Client *c) { - CHECK(!c->unmapwithevent); - client_unmap(c); c->hide = True; setwinstate(c->win, IconicState); @@ -584,8 +582,6 @@ uicb_client_raise(uicb_t cmd) void client_unhide(Client *c) { - CHECK(!c->unmapwithevent); - client_map(c); c->hide = False; setwinstate(c->win, NormalState); diff --git a/src/event.c b/src/event.c index 3a2f951..b4f76b7 100644 --- a/src/event.c +++ b/src/event.c @@ -106,38 +106,28 @@ configurerequest(XConfigureRequestEvent *ev) { Client *c; XWindowChanges wc; - XRectangle geo; if((c = client_gb_win(ev->window))) { 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((ev->value_mask & (CWX | CWY)) - && !(ev->value_mask & (CWWidth | CWHeight))) - client_configure(c); - 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; - if((geo.x < MAXW && geo.x > 0 - geo.width) - && (geo.y < MAXH && geo.y > 0 - geo.height)) - client_moveresize(c, geo, True); - } - else - client_configure(c); + c->geo.x = ev->x + BORDH; + c->geo.y = ev->y + TBARH; + c->geo.width = ev->width; + c->geo.height = ev->height; + wc.x = BORDH; + wc.y = TBARH + BORDH; + wc.width = c->geo.width; + wc.height = c->geo.height; + wc.border_width = ev->border_width; + wc.sibling = ev->above; + wc.stack_mode = ev->detail; + + XConfigureWindow(dpy, c->win, ev->value_mask, &wc); + + client_configure(c); } else { @@ -304,15 +294,7 @@ maprequest(XMapRequestEvent *ev) if(!(c = client_gb_win(ev->window))) client_manage(ev->window, &at); else - /* Re-map the clients that was unmapped - * with the unmap event - */ - if(c->unmapped) - { - client_map(c); - c->unmapwithevent = False; - } - + client_map(c); return; } @@ -360,10 +342,7 @@ unmapnotify(XUnmapEvent *ev) if((c = client_gb_win(ev->window)) && ev->send_event) - { - client_unmap(c); - c->unmapwithevent = True; - } + client_unmanage(c); return; } @@ -376,8 +355,6 @@ unmapnotify(XUnmapEvent *ev) void getevent(XEvent ev) { - - switch (ev.type) { case ButtonPress: buttonpress(&ev.xbutton); break; @@ -393,6 +370,5 @@ getevent(XEvent ev) case UnmapNotify: unmapnotify(&ev.xunmap); break; } - return; } diff --git a/src/frame.c b/src/frame.c index ed93d37..6f1a5ae 100644 --- a/src/frame.c +++ b/src/frame.c @@ -87,7 +87,7 @@ frame_create(Client *c) CWBackPixel, color_enlight(c->colors.frame), &at); CWIN(c->top, c->frame, 0, 0, c->frame_geo.width, SHADH, 0, CWBackPixel, color_enlight(c->colors.frame), &at); - CWIN(c->bottom, c->frame, 0, c->frame_geo.height, c->frame_geo.width, SHADH, 0, + CWIN(c->bottom, c->frame, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH, 0, CWBackPixel, SHADC, &at); CWIN(c->right, c->frame, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, SHADC, &at); @@ -125,10 +125,10 @@ frame_delete(Client *c) void frame_moveresize(Client *c, XRectangle geo) { - c->frame_geo.x = geo.x - BORDH; - c->frame_geo.y = geo.y - TBARH; - c->frame_geo.width = FRAMEW(geo.width); - c->frame_geo.height = FRAMEH(geo.height); + c->frame_geo.x = geo.x - BORDH; + c->frame_geo.y = geo.y - TBARH; + c->frame_geo.width = FRAMEW(geo.width); + c->frame_geo.height = FRAMEH(geo.height); /* Frame */ XMoveResizeWindow(dpy, c->frame, diff --git a/src/structs.h b/src/structs.h index 2c47481..839b60b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -103,7 +103,7 @@ struct Client } colors; /* Client Layout Information */ Bool max, tile, free, hide; - Bool hint, lmax, unmapped, unmapwithevent; + Bool hint, lmax, unmapped; /* Struct in chains */ Client *next; Client *prev;