wayland/xdg-shell: Scale configure relative popup coordinate
authorJonas Ådahl <jadahl@gmail.com>
Fri, 23 Sep 2016 09:18:21 +0000 (17:18 +0800)
committerPeter Michael Green <plugwash@raspbian.org>
Fri, 21 Oct 2016 23:24:13 +0000 (23:24 +0000)
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

Gbp-Pq: Name wayland-xdg-shell-Scale-configure-relative-popup-coo.patch

src/wayland/meta-wayland-xdg-shell.c

index 591a1ed6c8a811f7db13dcc277b5bf9641432667..b1b377173b6ae32e16bcb024e2bd1ee91474e285 100644 (file)
@@ -873,6 +873,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
@@ -886,8 +887,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);