firefox/mozilla-1593408.patch

77 lines
2.9 KiB
Diff

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-28 11:29:58.522095531 +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_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 =