[mutter] wayland/xdg-shell: Scale configure relative popup coordinate



commit a3d7ae621421da5667f6cda9c0a2efb1ec051d79
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Sep 23 17:18:21 2016 +0800

    wayland/xdg-shell: Scale configure relative popup coordinate
    
    The parent local popup coordinate needs to be scaled according to the
    monitor scale it is assigned.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771841

 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 ae6d0b7..c83ec87 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -874,6 +874,7 @@ xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role
   MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (shell_surface_role);
   MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_popup);
   MetaWindow *parent_window = xdg_popup->parent_surface->window;
+  int monitor_scale;
   int x, y;
 
   /* If the parent surface was destroyed, its window will be destroyed
@@ -887,8 +888,9 @@ xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role
   if (!parent_window)
     return;
 
-  x = new_x - parent_window->rect.x;
-  y = new_y - parent_window->rect.y;
+  monitor_scale = meta_window_wayland_get_main_monitor_scale (parent_window);
+  x = (new_x - parent_window->rect.x) / monitor_scale;
+  y = (new_y - parent_window->rect.y) / monitor_scale;
   zxdg_popup_v6_send_configure (xdg_popup->resource,
                                 x, y, new_width, new_height);
   meta_wayland_xdg_surface_send_configure (xdg_surface);


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