client/frame: Improve client_unmanage function and add frame_delete

This commit is contained in:
Martin Duquesnoy
2008-11-16 20:45:52 +01:00
parent 587fa97a8c
commit a55ddfe2ca
4 changed files with 40 additions and 20 deletions

View File

@@ -72,6 +72,8 @@ client_configure(Client *c)
{ {
XConfigureEvent ev; XConfigureEvent ev;
client_moveresize(c, c->geo, True);
ev.type = ConfigureNotify; ev.type = ConfigureNotify;
ev.event = c->win; ev.event = c->win;
ev.window = c->win; ev.window = c->win;
@@ -188,6 +190,10 @@ client_focus(Client *c)
return; return;
} }
/* The following function are the same point :
* find a client membere with a Window {{{
*/
/* Get Client with a window */ /* Get Client with a window */
/** Get a client->win with a window /** Get a client->win with a window
* \param w Window * \param w Window
@@ -556,34 +562,25 @@ client_unhide(Client *c)
void void
client_unmanage(Client *c) client_unmanage(Client *c)
{ {
int i;
Client *cc;
XGrabServer(dpy); XGrabServer(dpy);
XSetErrorHandler(errorhandlerdummy); XSetErrorHandler(errorhandlerdummy);
/* Some ******* require that... */
XReparentWindow(dpy, c->win, root, 0, 0); XReparentWindow(dpy, c->win, root, 0, 0);
/* Unset all focus stuff {{{ */
if(sel == c) if(sel == c)
client_focus(NULL); client_focus(NULL);
for(i = 0, cc = clients; cc; cc = cc->next, ++i)
if(selbytag[i] == c)
selbytag[i] = NULL;
/* }}} */
client_detach(c); client_detach(c);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setwinstate(c->win, WithdrawnState); 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); XSync(dpy, False);
frame_delete(c);
XSetErrorHandler(errorhandler);
XUngrabServer(dpy); XUngrabServer(dpy);
arrange(); arrange();
XFree(c->title);
efree(c);
return; return;
} }

View File

@@ -135,6 +135,8 @@ configurerequest(XConfigureRequestEvent *ev)
&& (geo.y < MAXH && geo.y > 0 - geo.height)) && (geo.y < MAXH && geo.y > 0 - geo.height))
client_moveresize(c, geo, True); client_moveresize(c, geo, True);
} }
else
client_configure(c);
} }
else else
{ {
@@ -333,7 +335,7 @@ propertynotify(XPropertyEvent *ev)
/** UnmapNotify handle event /** UnmapNotify handle event
* \param ev XUnmapEvent pointer * \param ev XUnmapEvent pointer
*/ */
void void
unmapnotify(XUnmapEvent *ev) unmapnotify(XUnmapEvent *ev)
{ {
@@ -350,9 +352,9 @@ unmapnotify(XUnmapEvent *ev)
} }
/** Event handle function: execute every function /** Event handle function: execute every function
* handle by event * handle by event
* \param ev Event * \param ev Event
*/ */
void void
getevent(XEvent ev) getevent(XEvent ev)
{ {

View File

@@ -96,6 +96,26 @@ frame_create(Client *c)
return; 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 /** Move a frame
* \param c The client frame * \param c The client frame
* \param geo Coordinate info for move the frame * \param geo Coordinate info for move the frame

View File

@@ -135,6 +135,7 @@ void uicb_client_kill(uicb_t);
/* frame.c */ /* frame.c */
void frame_create(Client *c); void frame_create(Client *c);
void frame_delete(Client *c);
void frame_moveresize(Client *c, XRectangle geo); void frame_moveresize(Client *c, XRectangle geo);
void frame_update(Client *c); void frame_update(Client *c);