JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Add new OBEYAPPFOCUSREQ quirk.
authorReginald Kennedy <rk@rejii.com>
Fri, 13 Dec 2013 22:06:08 +0000 (06:06 +0800)
committerReginald Kennedy <rk@rejii.com>
Fri, 7 Feb 2014 15:37:39 +0000 (23:37 +0800)
When an application requests focus on the window via a
_NET_ACTIVE_WINDOW client message (source indication of 1), comply with
the request.

spectrwm.1
spectrwm.c

index 1028811..8d5afa3 100644 (file)
@@ -941,6 +941,11 @@ if there are no other windows on the workspace with the same WM_CLASS
 class/instance value.  Has no effect when
 .Ic focus_mode
 is set to follow.
+.It OBEYAPPFOCUSREQ
+When an application requests focus on the window via a _NET_ACTIVE_WINDOW
+client message (source indication of 1), comply with the request.
+Note that a source indication of 0 (unspecified) or 2 (pager) are always
+obeyed.
 .El
 .Pp
 Custom quirks in the configuration file are specified as follows:
index fa8ac2e..a90eb31 100644 (file)
@@ -669,6 +669,7 @@ struct quirk {
 #define SWM_Q_FOCUSPREV                (1<<5)  /* focus on caller */
 #define SWM_Q_NOFOCUSONMAP     (1<<6)  /* Don't focus on window when mapped. */
 #define SWM_Q_FOCUSONMAP_SINGLE        (1<<7)  /* Only focus if single win of type. */
+#define SWM_Q_OBEYAPPFOCUSREQ  (1<<8)  /* Focus when applications ask. */
 };
 TAILQ_HEAD(quirk_list, quirk);
 struct quirk_list              quirks = TAILQ_HEAD_INITIALIZER(quirks);
@@ -7509,6 +7510,7 @@ const char *quirkname[] = {
        "FOCUSPREV",
        "NOFOCUSONMAP",
        "FOCUSONMAP_SINGLE",
+       "OBEYAPPFOCUSREQ",
 };
 
 /* SWM_Q_WS: retain '|' for back compat for now (2009-08-11) */
@@ -9819,7 +9821,8 @@ clientmessage(xcb_client_message_event_t *e)
                 * Allow focus changes that are a result of direct user
                 * action and from applications that use the old EWMH spec.
                 */
-               if (e->data.data32[0] != EWMH_SOURCE_TYPE_NORMAL) {
+               if (e->data.data32[0] != EWMH_SOURCE_TYPE_NORMAL ||
+                   win->quirks & SWM_Q_OBEYAPPFOCUSREQ) {
                        if (WS_FOCUSED(win->ws))
                                focus_win(win);
                        else