layout/wmfs: Fix unmanage clients and quit() And fix tile layout when there many nmaster (Top/Bottom)
This commit is contained in:
parent
a55ddfe2ca
commit
b95d5df147
11
src/client.c
11
src/client.c
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
22
src/wmfs.c
22
src/wmfs.c
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user