aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Müller2022-01-23 12:16:52 +0100
committerWolfgang Müller2022-01-23 12:30:19 +0100
commit417a61ed616a272c9412ab4d8f2dcd04ead25fe1 (patch)
treeb4f11b243ff64d9ae1e75bf99616c21e1cc39cd0
parent84ca12376778a704129f702ce32d6d40f1000420 (diff)
downloadcwm-417a61ed616a272c9412ab4d8f2dcd04ead25fe1.tar.gz
Have _NET_ACTIVE_WINDOW warp the pointer only on direct user input
This functionally partly reverts commit db0f56a (Do not warp mouse to windows marked active by EWMH, 2022-01-17) which introduced a bug where the pointer would no longer be warped to windows activated by rofi. Since the window switcher internal to cwm calls client_ptr_warp directly this was not noticed immediately. Thankfully the EWMH spec defines a "source indication" [1] in the _NET_ACTIVE_WINDOW request [2]. This field specifies whether the request came from a normal application or a pager and "other clients that represent direct user actions". Window switchers like rofi should honor this field and therefore it is trivial to fix this bug by checking for the correct source indication value. This means that normal windows are now prohibited from warping the pointer under any circumstance, but the user (through specific applications) may still elect to have the window manager honor _NET_ACTIVE_WINDOW this way. [1] https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#sourceindication [2] https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm45682917892304
-rw-r--r--xevents.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/xevents.c b/xevents.c
index 12fb72b..8cfee2d 100644
--- a/xevents.c
+++ b/xevents.c
@@ -401,6 +401,17 @@ xev_handle_clientmessage(XEvent *ee)
if ((old_cc = client_current(NULL)) != NULL)
client_ptr_save(old_cc);
client_show(cc);
+
+ /*
+ * Only warp the pointer if the source indication field says that
+ * the request to activate another window comes from a pager or
+ * other direct user input.
+ *
+ * This will stop certain dialog windows from repeatedly activating
+ * themselves, effectively jailing the cursor.
+ */
+ if(e->data.l[0] == 2)
+ client_ptr_warp(cc);
}
} else if (e->message_type == ewmh[_NET_WM_DESKTOP]) {
if ((cc = client_find(e->window)) != NULL) {