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.
This commit is contained in:
Kris Maglione 2010-05-27 18:05:27 -04:00
parent a50e6e42ac
commit c4e7c2de67
2 changed files with 9 additions and 1 deletions

View File

@ -36,6 +36,12 @@ enum {
UrgClient,
};
enum {
SourceUnknown,
SourceClient,
SourcePager
};
enum EWMHType {
TypeDesktop = 1<<0,
TypeDock = 1<<1,

View File

@ -378,7 +378,9 @@ ewmh_clientmessage(XClientMessageEvent *e) {
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;