[gnome-shell-extensions] AutoMoveWindows: try harder to get an application for a window



commit 53384f9eaf74d55967ae572a0bec9be4af6500dc
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Feb 19 20:33:51 2011 +0100

    AutoMoveWindows: try harder to get an application for a window
    
    First of all, remove windows that are not interesting (like popup
    menus and tooltips). Then, queue once an idle if the app is null,
    in the hope that ShellWindowTracker picks up the window.

 extensions/auto-move-windows/extension.js |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index 48afa75..ec966c2 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -32,10 +32,24 @@ WindowMover.prototype = {
         }
     },
 
-    _findAndMove: function(display, window) {
+    _findAndMove: function(display, window, noRecurse) {
+	if (!this._windowTracker.is_window_interesting(window))
+	    return;
+
 	let spaces = this._settings.get_strv(SETTINGS_KEY);
 
 	let app = this._windowTracker.get_window_app(window);
+	if (!app) {
+	    if (!noRecurse) {
+		// window is not tracked yet
+		Mainloop.idle_add(Lang.bind(this, function() {
+		    this._findAndMove(display, window, true);
+		    return false;
+		}));
+	    } else
+		log ('Cannot find application for window');
+	    return;
+	}
 	let app_id = app.get_id();
         for ( let j = 0 ; j < spaces.length; j++ ) {
             let apps_to_space = spaces[j].split(":");



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