]> Pileus Git - ~andy/gtk/commitdiff
[broadway] Position non-popup windows ourselves
authorAlexander Larsson <alexl@redhat.com>
Fri, 8 Apr 2011 13:17:43 +0000 (15:17 +0200)
committerAlexander Larsson <alexl@redhat.com>
Sun, 10 Apr 2011 18:16:13 +0000 (20:16 +0200)
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
gdk/broadway/gdkwindow-broadway.c

index 838277188c9a98c1558168b9390d6216e804b937..f9b59498a92edcc8cb502b48bf0cc4e2f7f2fde4 100644 (file)
@@ -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;
 
index 7b6189fb93ede0f6cf8cfe264cd6e656683d6cd3..c00fbe981cb3e0290fbcdc4db42309e288fbd1b4 100644 (file)
@@ -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,