Blame SOURCES/Exclude-the-current-application-from-no_focus_window.patch

8063f1
From 3a8164d5ddf688db9cb00657861351febf013e72 Mon Sep 17 00:00:00 2001
8063f1
From: "Owen W. Taylor" <otaylor@fishsoup.net>
8063f1
Date: Wed, 23 Jun 2010 16:49:37 -0400
8063f1
Subject: [PATCH] Exclude the current application from no-focus-windows
8063f1
 setting
8063f1
8063f1
The idea of the no-focus-windows setting is to allow identifying
8063f1
legacy application windows that are stealing focus from other
8063f1
applications and suppress that behavior. Sometimes its not possible to
8063f1
identify specific problem windows of an application and its
8063f1
necessary to blanket add all windows of the application. In this
8063f1
case no-focus-windows can disrupt the internal flow of focus
8063f1
within the application.
8063f1
8063f1
On the assumption that apps internally handle focus correctly
8063f1
and have been tested not to steal focus from themselves at
8063f1
annoying times, we exclude windows of the the current application
8063f1
from no-focus-windows.
8063f1
8063f1
https://bugzilla.gnome.org/show_bug.cgi?id=599248
8063f1
---
8063f1
 src/core/window.c                     |   11 ++++++++++-
8063f1
 src/org.gnome.metacity.gschema.xml.in |    3 +++
8063f1
 2 files changed, 13 insertions(+), 1 deletions(-)
8063f1
8063f1
diff --git a/src/core/window.c b/src/core/window.c
8063f1
index 5440160..6f5c280 100644
8063f1
--- a/src/core/window.c
8063f1
+++ b/src/core/window.c
8063f1
@@ -1980,12 +1980,21 @@ window_state_on_map (MetaWindow *window,
8063f1
                      gboolean *places_on_top)
8063f1
 {
8063f1
   gboolean intervening_events;
8063f1
+  MetaWindow *focus_window;
8063f1
 
8063f1
   /* A 'no focus' window is a window that has been configured in GConf
8063f1
    * to never take focus on map; typically it will be a notification
8063f1
    * window from a legacy app that doesn't support _NET_WM_USER_TIME.
8063f1
+   *
8063f1
+   * This doesn't apply to applications taking focus from themselves;
8063f1
+   * the assumption is applications have been properly tested to internally
8063f1
+   * handle focus properly.
8063f1
    */
8063f1
-  if (meta_prefs_window_is_no_focus (window->title, window->res_class))
8063f1
+  focus_window = window->display->focus_window;
8063f1
+  if (focus_window &&
8063f1
+      !meta_window_same_application (window, focus_window) &&
8063f1
+      !meta_window_same_client (window, focus_window) &&
8063f1
+      meta_prefs_window_is_no_focus (window->title, window->res_class))
8063f1
     intervening_events = TRUE;
8063f1
   else
8063f1
     intervening_events = intervening_user_event_occurred (window);
8063f1
diff --git a/src/org.gnome.metacity.gschema.xml.in b/src/org.gnome.metacity.gschema.xml.in
8063f1
index 6900fa6..e4f86bd 100644
8063f1
--- a/src/org.gnome.metacity.gschema.xml.in
8063f1
+++ b/src/org.gnome.metacity.gschema.xml.in
8063f1
@@ -41,6 +41,9 @@
8063f1
 	WM_CLASS matches the shell-style glob pattern <glob>.
8063f1
 	(and <expr> <expr>) (or <expr> <expr>) (not <expr): Boolean combinations
8063f1
 	of expressions.
8063f1
+
8063f1
+        New windows from the current active application are unaffected by
8063f1
+        this setting.
8063f1
       </_description>
8063f1
     </key>
8063f1
   </schema>
8063f1
-- 
8063f1
1.7.9
8063f1