[mutter/gnome-3-22] wayland/xdg-shell: Scale window menu coordinates



commit 2ae42f0db2ab21438b8a217706f1517ffd8952a9
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Dec 30 20:51:06 2016 +0800

    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

 src/wayland/meta-wayland-xdg-shell.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index 6267587..aa355da 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]