wayland: Place subsurfaces relative to their parent

Now that subsurfaces can be created as child of another GdkWindow (and
not just the root window), they must be placed according to the location
of their parent, i.e. the abs_x/abs_y must be updated and taken into
account when placing and moving subsurfaces under Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=774917
This commit is contained in:
Olivier Fourdan 2016-11-23 14:55:40 +01:00
parent 4cd8796c0e
commit 605303681b
2 changed files with 11 additions and 4 deletions

View File

@ -973,9 +973,12 @@ recompute_visible_regions_internal (GdkWindow *private,
old_abs_y = private->abs_y;
/* Update absolute position */
if (gdk_window_has_impl (private))
if ((gdk_window_has_impl (private) &&
private->window_type != GDK_WINDOW_SUBSURFACE) ||
(gdk_window_is_toplevel (private) &&
private->window_type == GDK_WINDOW_SUBSURFACE))
{
/* Native window starts here */
/* Native windows and toplevel subsurfaces start here */
private->abs_x = 0;
private->abs_y = 0;
}

View File

@ -1280,7 +1280,9 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
impl->display_server.wl_subsurface =
wl_subcompositor_get_subsurface (display_wayland->subcompositor,
impl->display_server.wl_surface, parent_impl->display_server.wl_surface);
wl_subsurface_set_position (impl->display_server.wl_subsurface, window->x, window->y);
wl_subsurface_set_position (impl->display_server.wl_subsurface,
window->x + window->abs_x,
window->y + window->abs_y);
/* In order to synchronize the initial position with the initial frame
* content, wait with making the subsurface desynchronized until after
@ -2611,7 +2613,9 @@ gdk_window_wayland_move_resize (GdkWindow *window,
if (impl->display_server.wl_subsurface)
{
wl_subsurface_set_position (impl->display_server.wl_subsurface, x, y);
wl_subsurface_set_position (impl->display_server.wl_subsurface,
window->x + window->abs_x,
window->y + window->abs_y);
gdk_window_request_transient_parent_commit (window);
}
}