diff options
author | Timm Bäder <mail@baedert.org> | 2017-06-17 08:54:59 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-19 21:27:14 -0400 |
commit | 12fdb19d630461519581c04686f9376bfce811aa (patch) | |
tree | 1c30c14b56e57ad375b28086f526f2e50540d734 /gtk/gtkexpander.c | |
parent | b5aa1982c9627b0f43014ab582f73c9ab0473369 (diff) | |
download | gtk+-12fdb19d630461519581c04686f9376bfce811aa.tar.gz |
expander: Fix pressed_in_title check
gesture coords are relative to the expander widget, the title allocation
is relative to the box child.
Diffstat (limited to 'gtk/gtkexpander.c')
-rw-r--r-- | gtk/gtkexpander.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 711be4c63e..12f8191430 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -545,20 +545,16 @@ gesture_multipress_pressed_cb (GtkGestureMultiPress *gesture, GtkExpander *expander) { GtkExpanderPrivate *priv = expander->priv; - GtkAllocation title_allocation, allocation; + GtkAllocation title_allocation; - gtk_widget_get_allocation (GTK_WIDGET (expander), &allocation); - gtk_widget_get_allocation (priv->title_widget, &title_allocation); + gtk_widget_get_own_allocation (priv->title_widget, &title_allocation); + gtk_widget_translate_coordinates (priv->title_widget, GTK_WIDGET (expander), + title_allocation.x, title_allocation.y, + &title_allocation.x, &title_allocation.y); /* Coordinates are in the widget coordinate system, so transform * the title_allocation to it. */ - title_allocation.x -= allocation.x; - title_allocation.y -= allocation.y; - - priv->pressed_in_title = (x >= title_allocation.x && - x < title_allocation.x + title_allocation.width && - y >= title_allocation.y && - y < title_allocation.y + title_allocation.height); + priv->pressed_in_title = gdk_rectangle_contains_point (&title_allocation, x, y); } static void |