summaryrefslogtreecommitdiff
path: root/mozilla-1593408.patch
blob: e5b5f46c91e335d783d7ebadac6e1e5aa98547a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
diff -up firefox-71.0/widget/gtk/mozcontainer.cpp.mozilla-1593408 firefox-71.0/widget/gtk/mozcontainer.cpp
--- firefox-71.0/widget/gtk/mozcontainer.cpp.mozilla-1593408	2019-11-26 01:02:30.000000000 +0100
+++ firefox-71.0/widget/gtk/mozcontainer.cpp	2019-11-27 11:41:20.539447954 +0100
@@ -76,6 +76,10 @@ static void moz_container_allocate_child
                                          MozContainerChild* child);
 static MozContainerChild* moz_container_get_child(MozContainer* container,
                                                   GtkWidget* child);
+#ifdef MOZ_WAYLAND
+static wl_surface* moz_container_get_gtk_container_surface(
+    MozContainer* container);
+#endif
 
 /* public methods */
 
@@ -158,6 +162,22 @@ void moz_container_move(MozContainer* co
   container->subsurface_dx = dx;
   container->subsurface_dy = dy;
   container->surface_position_update = true;
+
+  // Wayland subsurface is not created yet.
+  if (!container->subsurface) {
+    return;
+  }
+
+  // wl_subsurface_set_position is actually property of parent surface
+  // which is effective when parent surface is commited.
+  wl_surface* parent_surface =
+      moz_container_get_gtk_container_surface(container);
+  if (parent_surface) {
+    wl_subsurface_set_position(container->subsurface, container->subsurface_dx,
+                               container->subsurface_dy);
+    wl_surface_commit(parent_surface);
+    container->surface_position_needs_update = false;
+  }
 }
 
 void moz_container_scale_update(MozContainer* container) {
@@ -620,18 +640,9 @@ struct wl_surface* moz_container_get_wl_
                 (void*)container->surface));
   }
 
-  // wl_subsurface_set_position is actually property of parent surface
-  // which is effective when parent surface is commited.
   if (container->surface_position_update) {
-    wl_surface* parent_surface =
-        moz_container_get_gtk_container_surface(container);
-    if (parent_surface) {
-      wl_subsurface_set_position(container->subsurface,
-                                 container->subsurface_dx,
-                                 container->subsurface_dy);
-      wl_surface_commit(parent_surface);
-      container->surface_position_update = true;
-    }
+    moz_container_move(container, container->subsurface_dx,
+                       container->subsurface_dy);
   }
 
   return container->surface;
@@ -641,12 +652,12 @@ struct wl_egl_window* moz_container_get_
   LOGWAYLAND(("%s [%p] eglwindow %p\n", __FUNCTION__, (void*)container,
               (void*)container->eglwindow));
 
-  if (!container->eglwindow) {
-    wl_surface* surface = moz_container_get_wl_surface(container);
-    if (!surface) {
-      return nullptr;
-    }
+  wl_surface* surface = moz_container_get_wl_surface(container);
+  if (!surface) {
+    return nullptr;
+  }
 
+  if (!container->eglwindow) {
     GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
     gint scale = moz_container_get_scale(container);
     container->eglwindow =
bgstack15