Bug 1592350 [Wayland] Call wl_surface_commit() on parent surface when subsurface position is updated, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D51133

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-10-31 19:00:30 +00:00
Родитель 764af517bf
Коммит 04afc29457
2 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -155,9 +155,9 @@ static gint moz_container_get_scale(MozContainer* container) {
}
void moz_container_move(MozContainer* container, int dx, int dy) {
if (container->subsurface) {
wl_subsurface_set_position(container->subsurface, dx, dy);
}
container->subsurface_dx = dx;
container->subsurface_dy = dy;
container->surface_position_update = true;
}
void moz_container_scale_update(MozContainer* container) {
@ -215,6 +215,9 @@ void moz_container_init(MozContainer* container) {
container->ready_to_draw = GDK_IS_X11_DISPLAY(gdk_display_get_default());
container->surface_needs_clear = true;
container->inital_draw_cb = nullptr;
container->subsurface_dx = 0;
container->subsurface_dy = 0;
container->surface_position_update = 0;
#endif
LOG(("%s [%p]\n", __FUNCTION__, (void*)container));
@ -597,7 +600,8 @@ struct wl_surface* moz_container_get_wl_surface(MozContainer* container) {
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
gint x, y;
gdk_window_get_position(window, &x, &y);
wl_subsurface_set_position(container->subsurface, x, y);
moz_container_move(container, x, y);
wl_subsurface_set_desync(container->subsurface);
// Route input to parent wl_surface owned by Gtk+ so we get input
@ -616,6 +620,20 @@ struct wl_surface* moz_container_get_wl_surface(MozContainer* container) {
(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;
}
}
return container->surface;
}

Просмотреть файл

@ -75,9 +75,11 @@ struct _MozContainer {
#ifdef MOZ_WAYLAND
struct wl_surface* surface;
struct wl_subsurface* subsurface;
int subsurface_dx, subsurface_dy;
struct wl_egl_window* eglwindow;
struct wl_callback* frame_callback_handler;
int frame_callback_handler_surface_id;
gboolean surface_position_update;
gboolean surface_needs_clear;
gboolean ready_to_draw;
std::function<void(void)> inital_draw_cb;