[gtk+] [broadway] Position non-popup windows ourselves



commit fe79bbd618bc3c6fa4c9b7d9dc98ff526b1c6091
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Apr 8 15:17:43 2011 +0200

    [broadway] Position non-popup windows ourselves
    
    We ignore the initial positions for non-popup windows, instead we
    place the windows ourselves (or in the useToplevel mode by the WM).

 gdk/broadway/broadway.js          |   19 +++++++++++++++----
 gdk/broadway/gdkwindow-broadway.c |    8 --------
 2 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 8382771..f9b5949 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -334,9 +334,11 @@ function getFrameOffset(surface) {
     return {x: x, y: y};
 }
 
+var positionIndex = 0;
 function cmdCreateSurface(id, x, y, width, height, isTemp)
 {
     var surface = { id: id, x: x, y:y, width: width, height: height, isTemp: isTemp };
+    surface.positioned = isTemp;
     surface.drawQueue = [];
     surface.transientParent = 0;
     surface.visible = false;
@@ -385,6 +387,11 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
 	canvas.style["display"] = "block";
 
 	surface.frame = frame;
+
+	surface.x = 100 + positionIndex * 10;
+	surface.y = 100 + positionIndex * 10;
+	positionIndex = (positionIndex + 1) % 20;
+	sendInput ("w", [surface.id, surface.x, surface.y, surface.width, surface.height]);
     }
 
     var context = canvas.getContext("2d");
@@ -409,10 +416,13 @@ function cmdShowSurface(id)
     if (useToplevelWindows) {
 	var doc = document;
 	if (!surface.isTemp) {
-	    var win = window.open('','_blank',
-				  'width='+surface.width+',height='+surface.height+
-				  ',left='+surface.x+',top='+surface.y+',screenX='+surface.x+',screenY='+surface.y+
-				  ',location=no,menubar=no,scrollbars=no,toolbar=no');
+	    var options =
+		'width='+surface.width+',height='+surface.height+
+		',location=no,menubar=no,scrollbars=no,toolbar=no';
+	    if (surface.positioned)
+		options = options +
+		',left='+surface.x+',top='+surface.y+',screenX='+surface.x+',screenY='+surface.y;
+	    var win = window.open('','_blank', options);
 	    win.surface = surface;
 	    registerWindow(win);
 	    doc = win.document;
@@ -540,6 +550,7 @@ function cmdDeleteSurface(id)
 function cmdMoveSurface(id, x, y)
 {
     var surface = surfaces[id];
+    surface.positioned = true;
     surface.x = x;
     surface.y = y;
 
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 7b6189f..c00fbe9 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -348,14 +348,6 @@ _gdk_broadway_display_create_window_impl (GdkDisplay    *display,
 
   broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
 
-  /* Instead of window manager placement we have this mini hack
-     so that the main/first window is not covered in the demos. */
-  if (impl->id > 1 && window->window_type == GDK_WINDOW_TOPLEVEL)
-    {
-      window->x = 100;
-      window->y = 20;
-    }
-
   if (broadway_display->output)
     broadway_output_new_surface (broadway_display->output,
 				 impl->id,



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