aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2015-09-23 14:09:40 +0000
committerokan2015-09-23 14:09:40 +0000
commit337fd02962f9d55347c18b20876f44d2600787ee (patch)
treecd9614090bafb8b9d09ef0720628c35b4181d729 /client.c
parentea3954427e3e3453eba49e302bf4e3a0272b172e (diff)
downloadcwm-337fd02962f9d55347c18b20876f44d2600787ee.tar.gz
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.
Diffstat (limited to 'client.c')
-rw-r--r--client.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/client.c b/client.c
index 5d93e81..50ed77c 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.209 2015/08/27 18:53:15 okan Exp $
+ * $OpenBSD: client.c,v 1.210 2015/09/23 14:09:40 okan Exp $
*/
#include <sys/types.h>
@@ -48,6 +48,9 @@ client_init(Window win, struct screen_ctx *sc)
struct client_ctx *cc;
XWindowAttributes wattr;
int mapped;
+ Window rwin, cwin;
+ int x, y, wx, wy, activate = 0;
+ unsigned int mask;
if (win == None)
return(NULL);
@@ -97,6 +100,10 @@ client_init(Window win, struct screen_ctx *sc)
client_move(cc);
if ((cc->wmh) && (cc->wmh->flags & StateHint))
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 |
@@ -134,6 +141,9 @@ out:
XSync(X_Dpy, False);
XUngrabServer(X_Dpy);
+ if (activate)
+ client_setactive(cc);
+
return(cc);
}