xwayland: Fix assert with some parented windows
Having use_geometry set is not the only time we have a parent window, apparently. Clicking on the 'Line diff' drop down in gitk would cause an assert() because of this. Fixes #769 Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
5b1207a425
commit
123e921871
@ -81,35 +81,39 @@ static void
|
|||||||
weston_desktop_surface_update_view_position(struct weston_desktop_surface *surface)
|
weston_desktop_surface_update_view_position(struct weston_desktop_surface *surface)
|
||||||
{
|
{
|
||||||
struct weston_desktop_view *view;
|
struct weston_desktop_view *view;
|
||||||
|
struct weston_desktop_surface *parent =
|
||||||
|
weston_desktop_surface_get_parent(surface);
|
||||||
|
int32_t x = surface->position.x;
|
||||||
|
int32_t y = surface->position.y;
|
||||||
|
|
||||||
|
if (!parent) {
|
||||||
|
struct weston_coord_global pos;
|
||||||
|
|
||||||
|
pos.c = weston_coord(x, y);
|
||||||
|
wl_list_for_each(view, &surface->view_list, link)
|
||||||
|
weston_view_set_position(view->view, pos);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (surface->use_geometry) {
|
if (surface->use_geometry) {
|
||||||
|
struct weston_geometry geometry, parent_geometry;
|
||||||
struct weston_desktop_surface *parent =
|
struct weston_desktop_surface *parent =
|
||||||
weston_desktop_surface_get_parent(surface);
|
weston_desktop_surface_get_parent(surface);
|
||||||
struct weston_geometry geometry, parent_geometry;
|
|
||||||
struct weston_coord offset;
|
|
||||||
|
|
||||||
offset = weston_coord(surface->position.x, surface->position.y);
|
|
||||||
|
|
||||||
geometry = weston_desktop_surface_get_geometry(surface);
|
geometry = weston_desktop_surface_get_geometry(surface);
|
||||||
parent_geometry = weston_desktop_surface_get_geometry(parent);
|
parent_geometry = weston_desktop_surface_get_geometry(parent);
|
||||||
|
|
||||||
offset.x += parent_geometry.x - geometry.x;
|
x += parent_geometry.x - geometry.x;
|
||||||
offset.y += parent_geometry.y - geometry.y;
|
y += parent_geometry.y - geometry.y;
|
||||||
wl_list_for_each(view, &surface->view_list, link) {
|
}
|
||||||
struct weston_view *wv = view->view;
|
|
||||||
struct weston_coord_surface surf_offset;
|
|
||||||
|
|
||||||
surf_offset.c = offset;
|
wl_list_for_each(view, &surface->view_list, link) {
|
||||||
surf_offset.coordinate_space_id = wv->geometry.parent->surface;
|
struct weston_coord_surface offset;
|
||||||
weston_view_set_rel_position(wv, surf_offset);
|
struct weston_view *wv = view->view;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
struct weston_coord_global pos;
|
|
||||||
|
|
||||||
pos.c = weston_coord(surface->position.x, surface->position.y);
|
offset = weston_coord_surface(x, y, wv->geometry.parent->surface);
|
||||||
|
weston_view_set_rel_position(view->view, offset);
|
||||||
wl_list_for_each(view, &surface->view_list, link)
|
|
||||||
weston_view_set_position(view->view, pos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user