]> Pileus Git - ~andy/gtk/commitdiff
[broadway] Track transient_for
authorAlexander Larsson <alexl@redhat.com>
Tue, 5 Apr 2011 10:02:46 +0000 (12:02 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 7 Apr 2011 08:03:17 +0000 (10:03 +0200)
gdk/broadway/broadway.c
gdk/broadway/broadway.h
gdk/broadway/broadway.js
gdk/broadway/gdkwindow-broadway.c
gdk/broadway/gdkwindow-broadway.h

index 0ddefde3b972de27cda1421c45fa8350d6f50364..bada96e29840e89d7e127f262d80738e9dc78ba6 100644 (file)
@@ -778,6 +778,25 @@ broadway_output_resize_surface(BroadwayOutput *output,  int id, int w, int h)
   broadway_output_write (output, buf, sizeof (buf));
 }
 
+void
+broadway_output_set_transient_for (BroadwayOutput *output,
+                                  int             id,
+                                  int             parent_id)
+{
+  char buf[HEADER_LEN + 6];
+  int p;
+
+  p = write_header (output, buf, 'p');
+
+  append_uint16 (id, buf, &p);
+  append_uint16 (parent_id, buf, &p);
+
+  assert (p == sizeof (buf));
+
+  broadway_output_write (output, buf, sizeof (buf));
+}
+
+
 void
 broadway_output_put_rgb (BroadwayOutput *output,  int id, int x, int y,
                         int w, int h, int byte_stride, void *data)
index ab8eae624058a118467e9ef45ca0d71d0efac9d0..2f93d27eaa7ecff3f408c94bc2ed37d652aeac1d 100644 (file)
@@ -33,6 +33,9 @@ void            broadway_output_resize_surface  (BroadwayOutput *output,
                                                 int             id,
                                                 int             w,
                                                 int             h);
+void            broadway_output_set_transient_for (BroadwayOutput *output,
+                                                  int             id,
+                                                  int             parent_id);
 void            broadway_output_put_rgb         (BroadwayOutput *output,
                                                 int             id,
                                                 int             x,
index 4b1cb3259ed9205e25884775c7388e6116329245..3f34a2abb9302bb0af0da33d61f379207fafa8b8 100644 (file)
@@ -103,6 +103,7 @@ function initContext(canvas, x, y, id)
     context.globalCompositeOperation = "source-over";
     document.body.appendChild(canvas);
     context.drawQueue = [];
+    context.transientParent = 0;
 
     return context;
 }
@@ -240,6 +241,13 @@ function handleCommands(cmdObj)
            surfaces[id].canvas.style["display"] = "none";
            break;
 
+       case 'p': // Set transient parent
+           var id = base64_16(cmd, i);
+           i = i + 3;
+           var parentId = base64_16(cmd, i);
+           i = i + 3;
+           surfaces[id].transientParent = parentId;
+
        case 'd': // Delete surface
            var id = base64_16(cmd, i);
            i = i + 3;
index 3518d40a491841aa99e36267e1240a04772161d1..24c4bb2458ae9e96a14dea0ee13716a198df6399 100644 (file)
@@ -231,6 +231,10 @@ _gdk_broadway_resync_windows (void)
          broadway_output_show_surface (display->output, impl->id);
          window_data_send (display->output, impl);
        }
+      if (impl->transient_for)
+       {
+         broadway_output_set_transient_for (display->output, impl->id, impl->transient_for);
+       }
     }
 
   gdk_display_flush (GDK_DISPLAY (display));
@@ -764,6 +768,24 @@ static void
 gdk_broadway_window_set_transient_for (GdkWindow *window,
                                       GdkWindow *parent)
 {
+  GdkBroadwayDisplay *display;
+  GdkWindowImplBroadway *impl;
+  int parent_id;
+
+  impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
+
+  parent_id = 0;
+  if (parent)
+    parent_id = GDK_WINDOW_IMPL_BROADWAY (parent->impl)->id;
+
+  impl->transient_for = parent_id;
+
+  display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
+  if (display->output)
+    {
+      broadway_output_set_transient_for (display->output, impl->id, impl->transient_for);
+      gdk_display_flush (GDK_DISPLAY (display));
+    }
 }
 
 static void
index bed2c827c21a13060a0b987b08bf204b5455196e..0b3c8574296e0668c025f74f5be2e6440b87d771 100644 (file)
@@ -60,6 +60,8 @@ struct _GdkWindowImplBroadway
 
   int id;
 
+  int transient_for;
+
   gint8 toplevel_window_type;
   gboolean dirty;
   gboolean last_synced;