wayland: Take scale into account when placing windows relatively

When placing a popup and the legacy transient wl_shell_surface surfaces,
take the current scale of the window into account. This commit doesn't
fix relative positioning in case a window scale would change, but since
the use case for relative positioning is mostly popups, which would be
dismissed before the parent window would be moved, it should not be that
much of a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
This commit is contained in:
Jonas Ådahl
2015-03-25 14:39:30 +08:00
parent fbd237bc66
commit db6caa2c49
3 changed files with 33 additions and 12 deletions

View File

@ -1401,11 +1401,8 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
&surface->popup.parent_destroy_listener);
window = meta_window_wayland_new (display, surface);
meta_window_move_frame (window, FALSE,
parent_surf->window->buffer_rect.x + x,
parent_surf->window->buffer_rect.y + y);
meta_window_wayland_place_relative_to (window, parent_surf->window, x, y);
window->showing_for_first_time = FALSE;
window->placed = TRUE;
meta_wayland_surface_set_window (surface, window);
@ -1569,10 +1566,9 @@ wl_shell_surface_set_transient (struct wl_client *client,
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
meta_window_set_transient_for (surface->window, parent_surf->window);
meta_window_move_frame (surface->window, FALSE,
parent_surf->window->rect.x + x,
parent_surf->window->rect.y + y);
surface->window->placed = TRUE;
meta_window_wayland_place_relative_to (surface->window,
parent_surf->window,
x, y);
}
static void
@ -1621,10 +1617,9 @@ wl_shell_surface_set_popup (struct wl_client *client,
}
meta_window_set_transient_for (surface->window, parent_surf->window);
meta_window_move_frame (surface->window, FALSE,
parent_surf->window->rect.x + x,
parent_surf->window->rect.y + y);
surface->window->placed = TRUE;
meta_window_wayland_place_relative_to (surface->window,
parent_surf->window,
x, y);
if (!surface->popup.parent)
{