layout/wmfs: Fix unmanage clients and quit() And fix tile layout when there many nmaster (Top/Bottom)
This commit is contained in:
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);
|
XSendEvent(dpy, sel->win, False, NoEventMask, &ev);
|
||||||
client_unmanage(sel);
|
client_unmanage(sel);
|
||||||
|
XSetErrorHandler(errorhandler);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -565,9 +566,6 @@ client_unmanage(Client *c)
|
|||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
XSetErrorHandler(errorhandlerdummy);
|
XSetErrorHandler(errorhandlerdummy);
|
||||||
|
|
||||||
/* Some ******* require that... */
|
|
||||||
XReparentWindow(dpy, c->win, root, 0, 0);
|
|
||||||
|
|
||||||
if(sel == c)
|
if(sel == c)
|
||||||
client_focus(NULL);
|
client_focus(NULL);
|
||||||
|
|
||||||
@@ -575,9 +573,8 @@ client_unmanage(Client *c)
|
|||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
setwinstate(c->win, WithdrawnState);
|
setwinstate(c->win, WithdrawnState);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
frame_delete(c);
|
|
||||||
XSetErrorHandler(errorhandler);
|
|
||||||
XUngrabServer(dpy);
|
XUngrabServer(dpy);
|
||||||
|
frame_delete(c);
|
||||||
arrange();
|
arrange();
|
||||||
XFree(c->title);
|
XFree(c->title);
|
||||||
efree(c);
|
efree(c);
|
||||||
@@ -593,13 +590,13 @@ client_unmap(Client *c)
|
|||||||
{
|
{
|
||||||
CHECK(c);
|
CHECK(c);
|
||||||
|
|
||||||
XUnmapWindow(dpy, c->frame);
|
|
||||||
XUnmapSubwindows(dpy, c->frame);
|
|
||||||
if(TBARH)
|
if(TBARH)
|
||||||
{
|
{
|
||||||
bar_unmap_subwin(c->titlebar);
|
bar_unmap_subwin(c->titlebar);
|
||||||
bar_unmap(c->titlebar);
|
bar_unmap(c->titlebar);
|
||||||
}
|
}
|
||||||
|
XUnmapWindow(dpy, c->frame);
|
||||||
|
XUnmapSubwindows(dpy, c->frame);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,10 @@ destroynotify(XDestroyWindowEvent *ev)
|
|||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if((c = client_gb_win(ev->window)))
|
if((c = client_gb_win(ev->window)))
|
||||||
|
{
|
||||||
client_unmanage(c);
|
client_unmanage(c);
|
||||||
|
XSetErrorHandler(errorhandler);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -346,7 +349,11 @@ unmapnotify(XUnmapEvent *ev)
|
|||||||
&& ev->send_event
|
&& ev->send_event
|
||||||
&& getwinstate(c->win) == NormalState
|
&& getwinstate(c->win) == NormalState
|
||||||
&& !c->hide)
|
&& !c->hide)
|
||||||
|
{
|
||||||
|
XReparentWindow(dpy, c->win, root, 0, 0);
|
||||||
client_unmanage(c);
|
client_unmanage(c);
|
||||||
|
XSetErrorHandler(errorhandler);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ multi_tile(Position type)
|
|||||||
{
|
{
|
||||||
if(type == Top)
|
if(type == Top)
|
||||||
mastergeo.y = (n <= nmaster) ? sgeo.y : sgeo.y + (sgeo.height - mwfact) - border;
|
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;
|
mastergeo.height = (n <= nmaster) ? sgeo.height - border : mwfact;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#define NUM_OF_LAYOUT 7
|
#define NUM_OF_LAYOUT 7
|
||||||
|
|
||||||
/* Typedef */
|
/* Typedef */
|
||||||
typedef const char* uicb_t;
|
typedef const char* uicb_t;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
||||||
@@ -50,7 +50,7 @@ typedef unsigned char uchar;
|
|||||||
enum { CurNormal, CurResize, CurMove, CurLast };
|
enum { CurNormal, CurResize, CurMove, CurLast };
|
||||||
enum { WMState, WMProtocols, WMName, WMDelete, WMLast };
|
enum { WMState, WMProtocols, WMName, WMDelete, WMLast };
|
||||||
enum { NetSupported, NetWMName, NetLast };
|
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
|
* BarWindow Structure
|
||||||
|
|||||||
22
src/wmfs.c
22
src/wmfs.c
@@ -67,7 +67,18 @@ errorhandlerdummy(Display *d, XErrorEvent *event)
|
|||||||
void
|
void
|
||||||
quit(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);
|
XftFontClose(dpy, font);
|
||||||
XFreeCursor(dpy, cursor[CurNormal]);
|
XFreeCursor(dpy, cursor[CurNormal]);
|
||||||
XFreeCursor(dpy, cursor[CurMove]);
|
XFreeCursor(dpy, cursor[CurMove]);
|
||||||
@@ -197,17 +208,8 @@ scan(void)
|
|||||||
void
|
void
|
||||||
handle_signal(int signum)
|
handle_signal(int signum)
|
||||||
{
|
{
|
||||||
Client *c;
|
|
||||||
|
|
||||||
if(signum == SIGTERM || signum == SIGINT)
|
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();
|
quit();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user