wayland/xdg-shell: Scale window menu coordinates

When the monitor the surface is on has a scale other than 1, the
coordinate of the window menu popup position needs to be scaled, as it
is reported in logical pixels, while the stage is still in physical
pixels.

https://bugzilla.gnome.org/show_bug.cgi?id=776055
This commit is contained in:
Jonas Ådahl 2016-12-30 20:51:06 +08:00
parent 06f5b6b3e3
commit 2ae42f0db2

View File

@ -227,13 +227,15 @@ xdg_toplevel_show_window_menu (struct wl_client *client,
{
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
int monitor_scale;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE, NULL, NULL))
return;
monitor_scale = surface->window->monitor->scale;
meta_window_show_menu (surface->window, META_WINDOW_MENU_WM,
surface->window->buffer_rect.x + x,
surface->window->buffer_rect.y + y);
surface->window->buffer_rect.x + (x * monitor_scale),
surface->window->buffer_rect.y + (y * monitor_scale));
}
static void