diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2017-02-01 09:41:07 +0100 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2017-02-06 09:29:38 +0100 |
commit | afa78fcffe7785425ed188a0cde52df68a6d3b88 (patch) | |
tree | 26d934b4f2424be074f152fe9096de4b44f2ec1a /gdk | |
parent | 705fc628409e73839a5dae30f4156bfee08c43ba (diff) | |
download | gtk+-afa78fcffe7785425ed188a0cde52df68a6d3b88.tar.gz |
wayland: do not clamp anchor values
Clamping the anchor values as introduced in commit 9a5ffcd to fix bug
777176 breaks menu positioning.
By keeping the anchors rectangle size greater than zero, we end up
deducting some positive value from the original position, so there is no
need to clamp() actually, keeping the values positive is enough and
avoids the issue with menu positioning on the menubar.
An additional benefit is to make the code a lot simpler.
https://bugzilla.gnome.org/show_bug.cgi?id=778009
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/wayland/gdkwindow-wayland.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 384a5eb16d..64b7356dc4 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -2655,25 +2655,11 @@ sanitize_anchor_rect (GdkWindow *window, { gint original_width = rect->width; gint original_height = rect->height; - GdkWindow *parent = get_popup_parent (window); rect->width = MAX (1, rect->width); rect->height = MAX (1, rect->height); - rect->x -= rect->width - original_width; - rect->y -= rect->height - original_height; - - /* Make sure the anchor rectangle does not extend outside the window - * geometry of the parent surface. - */ - if (parent) - { - GdkRectangle geometry; - - /* The rectangle is relative to the parent window geometry */ - gdk_wayland_window_get_window_geometry (parent, &geometry); - rect->x = CLAMP (rect->x, 0, geometry.width); - rect->y = CLAMP (rect->y, 0, geometry.height); - } + rect->x = MAX (rect->x + original_width - rect->width, 0); + rect->y = MAX (rect->y + original_height - rect->height, 0); } static void |