mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Move redundant bits from screen_init (while dealing with existing
clients) directly into client_init, performing the X roundtrip only once. With the previous change in maprequest, this moves decision making into one place for creating new clients.
This commit is contained in:
12
client.c
12
client.c
@ -55,18 +55,26 @@ client_find(Window win)
|
||||
}
|
||||
|
||||
struct client_ctx *
|
||||
client_init(Window win, struct screen_ctx *sc, int mapped)
|
||||
client_init(Window win, struct screen_ctx *sc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
XWindowAttributes wattr;
|
||||
long state;
|
||||
int mapped;
|
||||
|
||||
if (win == None)
|
||||
return (NULL);
|
||||
if (!XGetWindowAttributes(X_Dpy, win, &wattr))
|
||||
return (NULL);
|
||||
if (sc == NULL)
|
||||
|
||||
if (sc == NULL) {
|
||||
sc = screen_fromroot(wattr.root);
|
||||
mapped = 1;
|
||||
} else {
|
||||
if (wattr.override_redirect || wattr.map_state != IsViewable)
|
||||
return (NULL);
|
||||
mapped = wattr.map_state != IsUnmapped;
|
||||
}
|
||||
|
||||
cc = xcalloc(1, sizeof(*cc));
|
||||
|
||||
|
Reference in New Issue
Block a user