[hackers] [wmii] Allow _NET_ACTIVE_WINDOW requests from clients, if they have recent user activity. Rationale: || Kris Maglione

From: <hg_AT_suckless.org>
Date: Thu, 27 May 2010 22:05:38 +0000 (UTC)

changeset: 2657:87818ee68036
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Thu May 27 18:05:27 2010 -0400
files: cmd/wmii/dat.h cmd/wmii/ewmh.c
description:
Allow _NET_ACTIVE_WINDOW requests from clients, if they have recent user activity. Rationale:

I don't like allowing clients to activate windows, because they
usually seem to do it for annoying reasons. However, system tray
icons usually activate their main windows when clicked, which is
what the user expects. So, as a comprimise, only allow the action if
the user has recently interacted with them.

diff -r 2d996aa17f50 -r 87818ee68036 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Thu May 27 17:44:28 2010 -0400
+++ b/cmd/wmii/dat.h Thu May 27 18:05:27 2010 -0400
@@ -36,6 +36,12 @@
         UrgClient,
 };
 
+enum {
+ SourceUnknown,
+ SourceClient,
+ SourcePager
+};
+
 enum EWMHType {
         TypeDesktop = 1<<0,
         TypeDock = 1<<1,
diff -r 2d996aa17f50 -r 87818ee68036 cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Thu May 27 17:44:28 2010 -0400
+++ b/cmd/wmii/ewmh.c Thu May 27 18:05:27 2010 -0400
@@ -378,7 +378,9 @@
                 if(c == nil)
                         return 1;
                 Dprint(DEwmh, "\tclient: %C\n", c);
- if(l[0] != 2)
+ if(l[0] == SourceClient && abs(event_xtime - l[1]) > 5000)
+ return 1;
+ if(l[0] != SourceClient && l[0] != SourcePager)
                         return 1;
                 focus(c, true);
                 return 1;
Received on Thu May 27 2010 - 22:05:38 UTC

This archive was generated by hypermail 2.2.0 : Thu May 27 2010 - 22:12:04 UTC