[gtk+] [broadway] Use mozInnerScreenX & co to get window position



commit 75dc3f3a07441a534f20be79a67675dce01bf0dd
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Apr 11 17:03:33 2011 +0200

    [broadway] Use mozInnerScreenX & co to get window position
    
    This way we don't have to rely on any event, which won't work until
    we get an event.

 gdk/broadway/broadway.js |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index f01911f..97858fd 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -125,8 +125,6 @@ var surfaces = {};
 var stackingOrder = [];
 var outstandingCommands = new Array();
 var inputSocket = null;
-var frameSizeX = -1;
-var frameSizeY = -1;
 
 var GDK_CROSSING_NORMAL = 0;
 var GDK_CROSSING_GRAB = 1;
@@ -250,9 +248,15 @@ function updateBrowserWindowGeometry(win) {
 
     var x = surface.x;
     var y = surface.y;
-    if (frameSizeX > 0) {
-	x = win.screenX + frameSizeX;
-	y = win.screenY + frameSizeY;
+
+    if (win.mozInnerScreenX != undefined) {
+	x = win.mozInnerScreenX;
+	y = win.mozInnerScreenY;
+    } else if (win.screenTop != undefined) {
+	x = win.screenTop;
+	y = win.screenLeft;
+    } else {
+	alert("No implementation to get window position");
     }
 
     if (x != surface.x || y != surface.y ||
@@ -869,15 +873,6 @@ function updateForEvent(ev) {
     lastTimeStamp = ev.timeStamp;
     if (ev.target.surface && ev.target.surface.window) {
 	var win = ev.target.surface.window;
-	if (ev.screenX != undefined && ev.clientX != undefined) {
-	    var newFrameSizeX = ev.screenX - ev.clientX - win.screenX;
-	    var newFrameSizeY = ev.screenY - ev.clientY - win.screenY;
-	    if (newFrameSizeX != frameSizeX || newFrameSizeY != frameSizeY) {
-		frameSizeX = newFrameSizeX;
-		frameSizeY = newFrameSizeY;
-		toplevelWindows.forEach(updateBrowserWindowGeometry);
-	    }
-	}
 	updateBrowserWindowGeometry(win);
     }
 }



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