summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-12 18:41:36 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-09-14 11:29:32 +0800
commitd792400d7c258b349c1dbaed0a12eee796a4b958 (patch)
tree852abc007dc8299bce080acfa1446817776b0a5b /gdk
parent74d237df410f850e31d5d20e0380ca3ad1caf766 (diff)
downloadgtk+-d792400d7c258b349c1dbaed0a12eee796a4b958.tar.gz
wayland: Transform moved_to_rect result properly
The result of move_to_rect, received from the xdg_popup.configure event, needs to be translated to the correct coordinate space; that is from real parent window geometry to coordinates relative to the gdk window set as transient-for. https://bugzilla.gnome.org/show_bug.cgi?id=771117
Diffstat (limited to 'gdk')
-rw-r--r--gdk/wayland/gdkwindow-wayland.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 17cfed5d5d..4c6f38d1c8 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1640,6 +1640,21 @@ translate_to_real_parent_window_geometry (GdkWindow *window,
}
static void
+translate_from_real_parent_window_geometry (GdkWindow *window,
+ gint *x,
+ gint *y)
+{
+ GdkWindow *parent;
+ gint dx = 0;
+ gint dy = 0;
+
+ parent = get_real_parent_and_translate (window, &dx, &dy);
+
+ *x -= dx - parent->shadow_left;
+ *y -= dy - parent->shadow_top;
+}
+
+static void
calculate_popup_rect (GdkWindow *window,
GdkGravity rect_anchor,
GdkGravity window_anchor,
@@ -1822,24 +1837,20 @@ calculate_moved_to_rect_result (GdkWindow *window,
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkRectangle best_rect;
- GdkRectangle geometry;
- x += impl->transient_for->shadow_left;
- y += impl->transient_for->shadow_top;
+ translate_from_real_parent_window_geometry (window, &x, &y);
+ *final_rect = (GdkRectangle) {
+ .x = x,
+ .y = y,
+ .width = width,
+ .height = height,
+ };
calculate_popup_rect (window,
impl->pending_move_to_rect.rect_anchor,
impl->pending_move_to_rect.window_anchor,
&best_rect);
- gdk_wayland_window_get_window_geometry (window, &geometry);
- *final_rect = (GdkRectangle) {
- .x = x,
- .y = y,
- .width = geometry.width,
- .height = geometry.height
- };
-
*flipped_rect = best_rect;
if (x != best_rect.x &&