aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2016-09-16 14:32:02 +0000
committerokan2016-09-16 14:32:02 +0000
commit86e2c481f56ad0ea549838666d9fda03519fe1ef (patch)
tree6fb0d617fe57de9f58f1b7c0c1bec3ab3034bd04 /client.c
parent10ebf1c3ea2b2d85a814934adc17e24cc6ea723a (diff)
downloadcwm-86e2c481f56ad0ea549838666d9fda03519fe1ef.tar.gz
During init, query screen for _NET_ACTIVE_WINDOW and set that client as
active; while we already look at what's under the pointer, use this information first, then look under the pointer (saving that round-trip). This restores the active state to a client after restart even if the pointer is not above it (and of course the pointer is not above another client).
Diffstat (limited to '')
-rw-r--r--client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/client.c b/client.c
index 38b1471..b6d3b38 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.221 2016/09/14 21:00:24 okan Exp $
+ * $OpenBSD: client.c,v 1.222 2016/09/16 14:32:02 okan Exp $
*/
#include <sys/types.h>
@@ -43,13 +43,13 @@ static int client_inbound(struct client_ctx *, int, int);
struct client_ctx *curcc = NULL;
struct client_ctx *
-client_init(Window win, struct screen_ctx *sc)
+client_init(Window win, struct screen_ctx *sc, int active)
{
struct client_ctx *cc;
XWindowAttributes wattr;
int mapped;
Window rwin, cwin;
- int x, y, wx, wy, activate = 0;
+ int x, y, wx, wy;
unsigned int mask;
if (win == None)
@@ -105,9 +105,9 @@ client_init(Window win, struct screen_ctx *sc)
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,
+ if ((active == 0) && (XQueryPointer(X_Dpy, cc->win, &rwin, &cwin,
&x, &y, &wx, &wy, &mask)) && (cwin != None))
- activate = 1;
+ active = 1;
}
XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
@@ -145,7 +145,7 @@ out:
XSync(X_Dpy, False);
XUngrabServer(X_Dpy);
- if (activate)
+ if (active)
client_setactive(cc);
return(cc);