[kupfer] launch: Only consider visible windows as already active



commit fb0800d3213459ebf4106d6c451573c3eb96aca4
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sun Apr 3 17:03:50 2011 +0200

    launch: Only consider visible windows as already active
    
    It would refuse to jump to minimized windows if they were "stacked in
    front". Now we only consider it already active if it's visible on the
    current workspace.

 kupfer/launch.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/launch.py b/kupfer/launch.py
index 5eaef9b..fc724be 100644
--- a/kupfer/launch.py
+++ b/kupfer/launch.py
@@ -239,14 +239,19 @@ class ApplicationsMatcherService (pretty.OutputMixin):
 		cur_screen = application_windows[0].get_screen()
 		cur_workspace = cur_screen.get_active_workspace()
 
-		def _include_window(window):
+		def visible_window(window):
+			return (window.get_window_type() == wnck.WINDOW_NORMAL and
+			        window.is_visible_on_workspace(cur_workspace))
+
+		def normal_window(window):
 			return window.get_window_type() == wnck.WINDOW_NORMAL
 
-		all_windows = [w for w in self._get_wnck_screen_windows_stacked()
-		               if _include_window(w)]
+		## get all visible windows in stacking order
+		vis_windows = filter(visible_window,
+		                     self._get_wnck_screen_windows_stacked())
 
 		## sort windows into "bins" by workspace
-		for w in filter(_include_window, application_windows):
+		for w in filter(normal_window, application_windows):
 			wspc = w.get_workspace() or cur_workspace
 			workspaces.setdefault(wspc, []).append(w)
 
@@ -259,7 +264,7 @@ class ApplicationsMatcherService (pretty.OutputMixin):
 		# are the topmost
 		focus_windows = []
 		if (cur_wspc_windows and 
-		    set(all_windows[-len(cur_wspc_windows):]) != set(cur_wspc_windows)):
+		    set(vis_windows[-len(cur_wspc_windows):]) != set(cur_wspc_windows)):
 			focus_windows = cur_wspc_windows
 		else:
 			# all windows are focused, find on next workspace



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]