Bug 1430728 - [Wayland] - position wl_subsurface when attached GtkWidget allocation changes, r?jhorak draft
authorMartin Stransky <stransky@redhat.com>
Tue, 16 Jan 2018 10:26:58 +0100
changeset 720856 a9fa4885299c2b1e83ab44b6ea5b9210bec3190e
parent 720739 a3887394965f161d011eebc74e8987a653366e4b
child 746170 9631c25412eae3d4b82663e2274749b8edff9de4
push id95663
push userstransky@redhat.com
push dateTue, 16 Jan 2018 10:37:43 +0000
reviewersjhorak
bugs1430728
milestone59.0a1
Bug 1430728 - [Wayland] - position wl_subsurface when attached GtkWidget allocation changes, r?jhorak MozReview-Commit-ID: 1q3XIouxavQ
widget/gtk/mozcontainer.cpp
--- a/widget/gtk/mozcontainer.cpp
+++ b/widget/gtk/mozcontainer.cpp
@@ -419,16 +419,27 @@ moz_container_size_allocate (GtkWidget  
         gtk_widget_get_realized (widget)) {
 
         gdk_window_move_resize(gtk_widget_get_window(widget),
                                allocation->x,
                                allocation->y,
                                allocation->width,
                                allocation->height);
     }
+
+#if defined(MOZ_WAYLAND)
+    // We need to position our subsurface according to GdkWindow
+    // when offset changes (GdkWindow is maximized for instance).
+    // see gtk-clutter-embed.c for reference.
+    if (container->subsurface) {
+        gint x, y;
+        gdk_window_get_position(gtk_widget_get_window(widget), &x, &y);
+        wl_subsurface_set_position(container->subsurface, x, y);
+    }
+#endif
 }
 
 void
 moz_container_remove (GtkContainer *container, GtkWidget *child_widget)
 {
     MozContainerChild *child;
     MozContainer *moz_container;
     GdkWindow* parent_window;