simplify unmanage code
This commit is contained in:
parent
cc871d3391
commit
7ad579898f
|
@ -171,7 +171,7 @@ exit_on_signal(int sig __attribute__ ((unused)))
|
|||
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
|
||||
* default error handler, which may call exit.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
xerror(Display * edpy, XErrorEvent * ee)
|
||||
{
|
||||
if(ee->error_code == BadWindow
|
||||
|
|
|
@ -22,11 +22,8 @@
|
|||
#ifndef AWESOME_AWESOME_H
|
||||
#define AWESOME_AWESOME_H
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "uicb.h"
|
||||
|
||||
int xerror(Display *, XErrorEvent *);
|
||||
|
||||
Uicb uicb_quit;
|
||||
|
||||
#endif
|
||||
|
|
22
client.c
22
client.c
|
@ -25,7 +25,6 @@
|
|||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "awesome.h"
|
||||
#include "tag.h"
|
||||
#include "rules.h"
|
||||
#include "util.h"
|
||||
|
@ -567,28 +566,35 @@ client_unban(Client *c)
|
|||
}
|
||||
|
||||
void
|
||||
client_unmanage(Client *c, long state)
|
||||
client_unmanage(Client *c)
|
||||
{
|
||||
XWindowChanges wc;
|
||||
Tag *tag;
|
||||
|
||||
wc.border_width = c->oldborder;
|
||||
|
||||
/* The server grab construct avoids race conditions. */
|
||||
XGrabServer(globalconf.display);
|
||||
|
||||
XConfigureWindow(globalconf.display, c->win, CWBorderWidth, &wc); /* restore border */
|
||||
|
||||
/* remove client everywhere */
|
||||
client_detach(c);
|
||||
if(globalconf.focus->client == c)
|
||||
focus(NULL, True, c->screen);
|
||||
focus_delete_client(c);
|
||||
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
|
||||
untag_client(c, tag);
|
||||
|
||||
if(globalconf.focus->client == c)
|
||||
focus(NULL, True, c->screen);
|
||||
|
||||
|
||||
XUngrabButton(globalconf.display, AnyButton, AnyModifier, c->win);
|
||||
window_setstate(c->win, state);
|
||||
window_setstate(c->win, WithdrawnState);
|
||||
|
||||
XSync(globalconf.display, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(globalconf.display);
|
||||
if(state != NormalState)
|
||||
arrange(c->screen);
|
||||
|
||||
arrange(c->screen);
|
||||
p_delete(&c);
|
||||
}
|
||||
|
||||
|
|
2
client.h
2
client.h
|
@ -34,7 +34,7 @@ void focus(Client *, Bool, int);
|
|||
void client_manage(Window, XWindowAttributes *, int);
|
||||
Bool client_resize(Client *, Area, Bool);
|
||||
void client_unban(Client *);
|
||||
void client_unmanage(Client *, long);
|
||||
void client_unmanage(Client *);
|
||||
void client_updatewmhints(Client *);
|
||||
void client_updatesizehints(Client *);
|
||||
void client_updatetitle(Client *);
|
||||
|
|
4
event.c
4
event.c
|
@ -227,7 +227,7 @@ handle_event_destroynotify(XEvent * e)
|
|||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||
|
||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||
client_unmanage(c, WithdrawnState);
|
||||
client_unmanage(c);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -395,7 +395,7 @@ handle_event_unmapnotify(XEvent * e)
|
|||
if((c = get_client_bywin(globalconf.clients, ev->window))
|
||||
&& ev->event == RootWindow(e->xany.display, get_phys_screen(c->screen))
|
||||
&& ev->send_event && window_getstate(c->win) == NormalState)
|
||||
client_unmanage(c, WithdrawnState);
|
||||
client_unmanage(c);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue