From a6032ff131d030ef4db5bde55519ae8cfa524c67 Mon Sep 17 00:00:00 2001 From: Reginald Kennedy Date: Sat, 14 Dec 2013 06:06:08 +0800 Subject: [PATCH] Add new OBEYAPPFOCUSREQ quirk. 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 | 5 +++++ spectrwm.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spectrwm.1 b/spectrwm.1 index 1028811..8d5afa3 100644 --- a/spectrwm.1 +++ b/spectrwm.1 @@ -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: diff --git a/spectrwm.c b/spectrwm.c index fa8ac2e..a90eb31 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -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 -- 1.7.10.4