mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Only when mapping clients from an initial wm start or restart, query the
pointer and if it matches the child window, activate it; new clients will not need to make this roundtrip to the server. Based on a patch from Preben Guldberg.
This commit is contained in:
10
client.c
10
client.c
@@ -48,6 +48,9 @@ client_init(Window win, struct screen_ctx *sc)
|
|||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
int mapped;
|
int mapped;
|
||||||
|
Window rwin, cwin;
|
||||||
|
int x, y, wx, wy, activate = 0;
|
||||||
|
unsigned int mask;
|
||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@@ -97,6 +100,10 @@ client_init(Window win, struct screen_ctx *sc)
|
|||||||
client_move(cc);
|
client_move(cc);
|
||||||
if ((cc->wmh) && (cc->wmh->flags & StateHint))
|
if ((cc->wmh) && (cc->wmh->flags & StateHint))
|
||||||
client_set_wm_state(cc, cc->wmh->initial_state);
|
client_set_wm_state(cc, cc->wmh->initial_state);
|
||||||
|
} else {
|
||||||
|
if ((XQueryPointer(X_Dpy, cc->win, &rwin, &cwin,
|
||||||
|
&x, &y, &wx, &wy, &mask)) && (cwin != None))
|
||||||
|
activate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
|
XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
|
||||||
@@ -134,6 +141,9 @@ out:
|
|||||||
XSync(X_Dpy, False);
|
XSync(X_Dpy, False);
|
||||||
XUngrabServer(X_Dpy);
|
XUngrabServer(X_Dpy);
|
||||||
|
|
||||||
|
if (activate)
|
||||||
|
client_setactive(cc);
|
||||||
|
|
||||||
return(cc);
|
return(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user