layout/wmfs: Fix unmanage clients and quit() And fix tile layout when there many nmaster (Top/Bottom)

This commit is contained in:
Martin Duquesnoy 2008-11-17 00:23:46 +01:00
parent a55ddfe2ca
commit b95d5df147
5 changed files with 26 additions and 20 deletions

View File

@ -310,6 +310,7 @@ uicb_client_kill(uicb_t cmd)
XSendEvent(dpy, sel->win, False, NoEventMask, &ev);
client_unmanage(sel);
XSetErrorHandler(errorhandler);
return;
}
@ -565,9 +566,6 @@ client_unmanage(Client *c)
XGrabServer(dpy);
XSetErrorHandler(errorhandlerdummy);
/* Some ******* require that... */
XReparentWindow(dpy, c->win, root, 0, 0);
if(sel == c)
client_focus(NULL);
@ -575,9 +573,8 @@ client_unmanage(Client *c)
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setwinstate(c->win, WithdrawnState);
XSync(dpy, False);
frame_delete(c);
XSetErrorHandler(errorhandler);
XUngrabServer(dpy);
frame_delete(c);
arrange();
XFree(c->title);
efree(c);
@ -593,13 +590,13 @@ client_unmap(Client *c)
{
CHECK(c);
XUnmapWindow(dpy, c->frame);
XUnmapSubwindows(dpy, c->frame);
if(TBARH)
{
bar_unmap_subwin(c->titlebar);
bar_unmap(c->titlebar);
}
XUnmapWindow(dpy, c->frame);
XUnmapSubwindows(dpy, c->frame);
return;
}

View File

@ -165,7 +165,10 @@ destroynotify(XDestroyWindowEvent *ev)
Client *c;
if((c = client_gb_win(ev->window)))
{
client_unmanage(c);
XSetErrorHandler(errorhandler);
}
return;
}
@ -346,7 +349,11 @@ unmapnotify(XUnmapEvent *ev)
&& ev->send_event
&& getwinstate(c->win) == NormalState
&& !c->hide)
{
XReparentWindow(dpy, c->win, root, 0, 0);
client_unmanage(c);
XSetErrorHandler(errorhandler);
}
return;
}

View File

@ -297,7 +297,7 @@ multi_tile(Position type)
{
if(type == Top)
mastergeo.y = (n <= nmaster) ? sgeo.y : sgeo.y + (sgeo.height - mwfact) - border;
mastergeo.width = (sgeo.width / nmaster) - BORDH;
mastergeo.width = (sgeo.width / nmaster) - (border * 2);
mastergeo.height = (n <= nmaster) ? sgeo.height - border : mwfact;
}
else

View File

@ -40,7 +40,7 @@
#define NUM_OF_LAYOUT 7
/* Typedef */
typedef const char* uicb_t;
typedef const char* uicb_t;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned short ushort;
@ -50,7 +50,7 @@ typedef unsigned char uchar;
enum { CurNormal, CurResize, CurMove, CurLast };
enum { WMState, WMProtocols, WMName, WMDelete, WMLast };
enum { NetSupported, NetWMName, NetLast };
typedef enum { Top = 0, Bottom, Right, Left, Center, PositionLast } Position;
typedef enum { Top, Bottom, Right, Left, Center, PositionLast } Position;
/*
* BarWindow Structure

View File

@ -67,7 +67,18 @@ errorhandlerdummy(Display *d, XErrorEvent *event)
void
quit(void)
{
/* Exiting WMFS :'( */
Client *c;
/* Set the silent error handler */
XSetErrorHandler(errorhandlerdummy);
/* Unmanage all clients */
for(c = clients; c; c = c->next)
{
XReparentWindow(dpy, c->win, root, c->frame_geo.x, c->frame_geo.y);
client_unmanage(c);
}
XftFontClose(dpy, font);
XFreeCursor(dpy, cursor[CurNormal]);
XFreeCursor(dpy, cursor[CurMove]);
@ -197,17 +208,8 @@ scan(void)
void
handle_signal(int signum)
{
Client *c;
if(signum == SIGTERM || signum == SIGINT)
{
XSetErrorHandler(errorhandlerdummy);
for(c = clients; c; c = c->next)
{
XReparentWindow(dpy, c->win, root, c->frame_geo.x, c->frame_geo.y);
client_unmanage(c);
}
fprintf(stderr, "\nExit WMFS... Bye !!\n");
quit();
exit(EXIT_FAILURE);
}