summaryrefslogtreecommitdiffstats
path: root/Exclude-the-current-application-from-no_focus_window.patch
blob: 22f9f569784decc825e23dfcb0d90e1cc3d5644f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 10c92eeae2fb4130cade27e1c2d631ef00019a2c Mon Sep 17 00:00:00 2001
From: Owen W. Taylor <otaylor@fishsoup.net>
Date: Wed, 23 Jun 2010 16:49:37 -0400
Subject: [PATCH 1/2] Exclude the current application from no_focus_windows setting

The idea of the no_focus_windows setting is to allow identifying
legacy application windows that are stealing focus from other
applications and suppress that behavior. Sometimes its not possible to
identify specific problem windows of an application and its
necessary to blanket add all windows of the application. In this
case no_focus_windows can disrupt the internal flow of focus
within the application.

On the assumption that apps internally handle focus correctly
and have been tested not to steal focus from themselves at
annoying times, we exclude windows of the the current application
from no_focus_windows.

https://bugzilla.gnome.org/show_bug.cgi?id=599248
---
 src/core/window.c          |   11 ++++++++++-
 src/metacity.schemas.in.in |    3 +++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/core/window.c b/src/core/window.c
index cacc3eb..399bb42 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1977,12 +1977,21 @@ window_state_on_map (MetaWindow *window,
                      gboolean *places_on_top)
 {
   gboolean intervening_events;
+  MetaWindow *focus_window;
 
   /* A 'no focus' window is a window that has been configured in GConf
    * to never take focus on map; typically it will be a notification
    * window from a legacy app that doesn't support _NET_WM_USER_TIME.
+   *
+   * This doesn't apply to applications taking focus from themselves;
+   * the assumption is applications have been properly tested to internally
+   * handle focus properly.
    */
-  if (meta_prefs_window_is_no_focus (window->title, window->res_class))
+  focus_window = window->display->focus_window;
+  if (focus_window &&
+      !meta_window_same_application (window, focus_window) &&
+      !meta_window_same_client (window, focus_window) &&
+      meta_prefs_window_is_no_focus (window->title, window->res_class))
     intervening_events = TRUE;
   else
     intervening_events = intervening_user_event_occurred (window);
diff --git a/src/metacity.schemas.in.in b/src/metacity.schemas.in.in
index c42fa96..e0dec3d 100644
--- a/src/metacity.schemas.in.in
+++ b/src/metacity.schemas.in.in
@@ -123,6 +123,9 @@
 	    WM_CLASS matches the shell-style glob pattern &lt;glob&gt;.
 	    (and &lt;expr&gt; &lt;expr&gt;) (or &lt;expr&gt; &lt;expr&gt;) (not &lt;expr): Boolean combinations
 	    of expressions.
+
+	    New windows from the current active application are unaffected by
+	    this setting.
          </long>
       </locale>
     </schema>
-- 
1.7.0.1