From a55ddfe2ca27d94546f36d51d4c67988d6c7cf7a Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sun, 16 Nov 2008 20:45:52 +0100 Subject: [PATCH] client/frame: Improve client_unmanage function and add frame_delete --- src/client.c | 31 ++++++++++++++----------------- src/event.c | 8 +++++--- src/frame.c | 20 ++++++++++++++++++++ src/wmfs.h | 1 + 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/client.c b/src/client.c index dcb5a0c..006f46d 100644 --- a/src/client.c +++ b/src/client.c @@ -72,6 +72,8 @@ client_configure(Client *c) { XConfigureEvent ev; + client_moveresize(c, c->geo, True); + ev.type = ConfigureNotify; ev.event = c->win; ev.window = c->win; @@ -188,6 +190,10 @@ client_focus(Client *c) return; } +/* The following function are the same point : + * find a client membere with a Window {{{ + */ + /* Get Client with a window */ /** Get a client->win with a window * \param w Window @@ -556,34 +562,25 @@ client_unhide(Client *c) void client_unmanage(Client *c) { - int i; - Client *cc; - XGrabServer(dpy); XSetErrorHandler(errorhandlerdummy); + + /* Some ******* require that... */ XReparentWindow(dpy, c->win, root, 0, 0); - /* Unset all focus stuff {{{ */ + if(sel == c) client_focus(NULL); - for(i = 0, cc = clients; cc; cc = cc->next, ++i) - if(selbytag[i] == c) - selbytag[i] = NULL; - /* }}} */ client_detach(c); + XUngrabButton(dpy, AnyButton, AnyModifier, c->win); setwinstate(c->win, WithdrawnState); - XDestroySubwindows(dpy, c->frame); - XDestroyWindow(dpy, c->frame); - if(TBARH) - { - bar_delete_subwin(c->titlebar); - bar_delete(c->titlebar); - } - XFree(c->title); - efree(c); XSync(dpy, False); + frame_delete(c); + XSetErrorHandler(errorhandler); XUngrabServer(dpy); arrange(); + XFree(c->title); + efree(c); return; } diff --git a/src/event.c b/src/event.c index 8a6a140..a7fec00 100644 --- a/src/event.c +++ b/src/event.c @@ -135,6 +135,8 @@ configurerequest(XConfigureRequestEvent *ev) && (geo.y < MAXH && geo.y > 0 - geo.height)) client_moveresize(c, geo, True); } + else + client_configure(c); } else { @@ -333,7 +335,7 @@ propertynotify(XPropertyEvent *ev) /** UnmapNotify handle event * \param ev XUnmapEvent pointer -*/ + */ void unmapnotify(XUnmapEvent *ev) { @@ -350,9 +352,9 @@ unmapnotify(XUnmapEvent *ev) } /** Event handle function: execute every function - * handle by event + * handle by event * \param ev Event -*/ + */ void getevent(XEvent ev) { diff --git a/src/frame.c b/src/frame.c index ed7cb17..dac1cda 100644 --- a/src/frame.c +++ b/src/frame.c @@ -96,6 +96,26 @@ frame_create(Client *c) return; } +/** Delete a frame + * \param c The client frame +*/ +void +frame_delete(Client *c) +{ + /* If there is, delete the titlebar */ + if(TBARH) + { + bar_delete_subwin(c->titlebar); + bar_delete(c->titlebar); + } + + /* Delete the frame's sub win and the frame */ + XDestroySubwindows(dpy, c->frame); + XDestroyWindow(dpy, c->frame); + + return; +} + /** Move a frame * \param c The client frame * \param geo Coordinate info for move the frame diff --git a/src/wmfs.h b/src/wmfs.h index 107bc86..d3ff3b2 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -135,6 +135,7 @@ void uicb_client_kill(uicb_t); /* frame.c */ void frame_create(Client *c); +void frame_delete(Client *c); void frame_moveresize(Client *c, XRectangle geo); void frame_update(Client *c);