summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2013-12-12 20:15:08 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2013-12-12 20:15:08 +0000
commit57b592530b6844d688f4e7a6d1377f0b3739046e (patch)
treedbcd3cbf205c47d4c0ae2062d7bf258519f35c67
parentbe4865f46a007520771f3613dc04b5be655adbb4 (diff)
ICCCM explicitly states that server time (CurrentTime) should *not* be
used for focus events, but rather the timestamp of the generated event. Track the last event timestamp and send it down for a WM_TAKE_FOCUS ClientMessage. I suspect we should do this for clients that don't announce this Atom as well, though the raciness gets us into a bind. Solves focus order issue since WM_TAKE_FOCUS; fix verified by sthen@ ok sthen@
-rw-r--r--app/cwm/calmwm.c3
-rw-r--r--app/cwm/calmwm.h5
-rw-r--r--app/cwm/client.c13
-rw-r--r--app/cwm/xevents.c4
4 files changed, 16 insertions, 9 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c
index b44196c28..d6bc6a15c 100644
--- a/app/cwm/calmwm.c
+++ b/app/cwm/calmwm.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: calmwm.c,v 1.80 2013/07/15 14:50:44 okan Exp $
+ * $OpenBSD: calmwm.c,v 1.81 2013/12/12 20:15:07 okan Exp $
*/
#include <sys/param.h>
@@ -37,6 +37,7 @@
char **cwm_argv;
Display *X_Dpy;
+Time Last_Event_Time = CurrentTime;
Atom cwmh[CWMH_NITEMS];
Atom ewmh[EWMH_NITEMS];
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index 8ce7bdc2a..c4790778c 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -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: calmwm.h,v 1.233 2013/12/11 15:41:11 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.234 2013/12/12 20:15:07 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -316,6 +316,7 @@ struct mwm_hints {
#define MWM_DECOR_BORDER (1<<1)
extern Display *X_Dpy;
+extern Time Last_Event_Time;
extern struct screen_ctx_q Screenq;
extern struct client_ctx_q Clientq;
extern struct conf Conf;
@@ -381,7 +382,7 @@ void client_htile(struct client_ctx *);
void client_lower(struct client_ctx *);
void client_map(struct client_ctx *);
void client_maximize(struct client_ctx *);
-void client_msg(struct client_ctx *, Atom);
+void client_msg(struct client_ctx *, Atom, Time);
void client_move(struct client_ctx *);
struct client_ctx *client_init(Window, struct screen_ctx *, int);
void client_ptrsave(struct client_ctx *);
diff --git a/app/cwm/client.c b/app/cwm/client.c
index f63a66a6a..5a0005fba 100644
--- a/app/cwm/client.c
+++ b/app/cwm/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.159 2013/12/11 22:14:23 okan Exp $
+ * $OpenBSD: client.c,v 1.160 2013/12/12 20:15:07 okan Exp $
*/
#include <sys/param.h>
@@ -168,6 +168,9 @@ client_setactive(struct client_ctx *cc)
struct screen_ctx *sc = cc->sc;
struct client_ctx *oldcc;
+ if (cc->flags & CLIENT_HIDDEN)
+ return;
+
XInstallColormap(X_Dpy, cc->colormap);
if ((cc->flags & CLIENT_INPUT) ||
@@ -176,7 +179,7 @@ client_setactive(struct client_ctx *cc)
RevertToPointerRoot, CurrentTime);
}
if (cc->flags & CLIENT_WM_TAKE_FOCUS)
- client_msg(cc, cwmh[WM_TAKE_FOCUS]);
+ client_msg(cc, cwmh[WM_TAKE_FOCUS], Last_Event_Time);
if ((oldcc = client_current())) {
oldcc->active = 0;
@@ -511,7 +514,7 @@ client_wm_hints(struct client_ctx *cc)
}
void
-client_msg(struct client_ctx *cc, Atom proto)
+client_msg(struct client_ctx *cc, Atom proto, Time ts)
{
XClientMessageEvent cm;
@@ -521,7 +524,7 @@ client_msg(struct client_ctx *cc, Atom proto)
cm.message_type = cwmh[WM_PROTOCOLS];
cm.format = 32;
cm.data.l[0] = proto;
- cm.data.l[1] = CurrentTime;
+ cm.data.l[1] = ts;
XSendEvent(X_Dpy, cc->win, False, NoEventMask, (XEvent *)&cm);
}
@@ -530,7 +533,7 @@ void
client_send_delete(struct client_ctx *cc)
{
if (cc->flags & CLIENT_WM_DELETE_WINDOW)
- client_msg(cc, cwmh[WM_DELETE_WINDOW]);
+ client_msg(cc, cwmh[WM_DELETE_WINDOW], CurrentTime);
else
XKillClient(X_Dpy, cc->win);
}
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index f972ab9d4..e933ebbed 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/xevents.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: xevents.c,v 1.97 2013/12/11 15:41:11 okan Exp $
+ * $OpenBSD: xevents.c,v 1.98 2013/12/12 20:15:07 okan Exp $
*/
/*
@@ -212,6 +212,8 @@ xev_handle_enternotify(XEvent *ee)
XCrossingEvent *e = &ee->xcrossing;
struct client_ctx *cc;
+ Last_Event_Time = e->time;
+
if ((cc = client_find(e->window)) != NULL)
client_setactive(cc);
}