event: Re-add unmapnotify function
This commit is contained in:
@@ -68,6 +68,7 @@ bar_create(int x, int y, uint w, uint h, int bord, uint color, Bool entermask)
|
||||
void
|
||||
bar_delete(BarWindow *bw)
|
||||
{
|
||||
XSelectInput(dpy, bw->win, NoEventMask);
|
||||
XDestroyWindow(dpy, bw->win);
|
||||
XFreePixmap(dpy, bw->dr);
|
||||
free(bw);
|
||||
|
||||
12
src/client.c
12
src/client.c
@@ -444,21 +444,25 @@ client_unmanage(Client *c)
|
||||
int i;
|
||||
Client *cc;
|
||||
|
||||
XGrabServer(dpy);
|
||||
XSetErrorHandler(errorhandlerdummy);
|
||||
|
||||
/* 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;
|
||||
/* }}} */
|
||||
|
||||
/* Detach this client of the chain
|
||||
* and set the withdraw state */
|
||||
client_detach(c);
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
setwinstate(c->win, WithdrawnState);
|
||||
XSync(dpy, False);
|
||||
XUngrabServer(dpy);
|
||||
|
||||
if(conf.titlebar.exist)
|
||||
titlebar_delete(c);
|
||||
efree(c);
|
||||
XSync(dpy, False);
|
||||
arrange();
|
||||
|
||||
return;
|
||||
|
||||
16
src/event.c
16
src/event.c
@@ -442,6 +442,21 @@ propertynotify(XEvent ev)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unmapnotify(XEvent ev)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
if((c = client_get(event.xunmap.window))
|
||||
&& ev.xunmap.event == root
|
||||
&& ev.xunmap.send_event
|
||||
&& getwinstate(c->win) == NormalState
|
||||
&& !c->hide)
|
||||
client_unmanage(c);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
void
|
||||
getevent(void)
|
||||
@@ -458,6 +473,7 @@ getevent(void)
|
||||
case MapRequest: maprequest(event); break;
|
||||
case MappingNotify: mapnotify(event); break;
|
||||
case PropertyNotify: propertynotify(event); break;
|
||||
case UnmapNotify: unmapnotify(event); break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -38,7 +38,6 @@ init(void)
|
||||
/* First init */
|
||||
gc = DefaultGC (dpy, screen);
|
||||
screen = DefaultScreen (dpy);
|
||||
root = RootWindow (dpy, screen);
|
||||
|
||||
init_font();
|
||||
init_cursor();
|
||||
@@ -117,6 +116,8 @@ init_root(void)
|
||||
{
|
||||
XSetWindowAttributes at;
|
||||
|
||||
root = RootWindow (dpy, screen);
|
||||
|
||||
at.event_mask = KeyMask | ButtonPressMask | ButtonReleaseMask |
|
||||
SubstructureRedirectMask | SubstructureNotifyMask |
|
||||
EnterWindowMask | LeaveWindowMask | StructureNotifyMask ;
|
||||
|
||||
@@ -61,6 +61,8 @@ titlebar_create(Client *c)
|
||||
void
|
||||
titlebar_delete(Client *c)
|
||||
{
|
||||
if(c->title)
|
||||
XFree(c->title);
|
||||
bar_delete(c->tbar);
|
||||
c->tbar = NULL;
|
||||
|
||||
|
||||
@@ -125,12 +125,14 @@ void mouseaction(Client *c, int x, int y, int type);
|
||||
void uicb_mousemove(uicb_t cmd);
|
||||
void uicb_resizemouse(uicb_t cmd);
|
||||
void propertynotify(XEvent ev);
|
||||
void unmapnotify(XEvent ev);
|
||||
void getevent(void);
|
||||
|
||||
/* util.c */
|
||||
void *emalloc(uint element, uint size);
|
||||
void efree(void *ptr);
|
||||
ulong getcolor(char *color);
|
||||
long getwinstate(Window win);
|
||||
double round(double x);
|
||||
void setwinstate(Window win, long state);
|
||||
void uicb_spawn(uicb_t);
|
||||
|
||||
Reference in New Issue
Block a user