diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-10-13 00:24:18 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2015-10-13 02:07:24 +0200 |
commit | ab001d01c8274013e66d29a6e58275d819845c3c (patch) | |
tree | 53b9357cdcb8c42f0b22aa77674035157262e4ad | |
parent | d8e41e13089811a640a28c65471f3701bad5d755 (diff) | |
download | gtk+-ab001d01c8274013e66d29a6e58275d819845c3c.tar.gz |
textview: Ensure magnifier popover points within widget area
Otherwise the popopver will be automatically unmapped in
_gtk_popover_update_child_visible() when the X axis (coming more
or less directly from events) goes outside the textview.
-rw-r--r-- | gtk/gtktextview.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 787e6e4640..e09fe901ba 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5048,10 +5048,13 @@ gtk_text_view_show_magnifier (GtkTextView *text_view, { cairo_rectangle_int_t rect; GtkTextViewPrivate *priv; + GtkAllocation allocation; GtkRequisition req; #define N_LINES 1 + gtk_widget_get_allocation (GTK_WIDGET (text_view), &allocation); + priv = text_view->priv; _gtk_text_view_ensure_magnifier (text_view); @@ -5070,6 +5073,7 @@ gtk_text_view_show_magnifier (GtkTextView *text_view, _gtk_magnifier_set_coords (GTK_MAGNIFIER (priv->magnifier), rect.x, rect.y + rect.height / 2); + rect.x = CLAMP (rect.x, 0, allocation.width); rect.y += rect.height / 4; rect.height -= rect.height / 4; gtk_popover_set_pointing_to (GTK_POPOVER (priv->magnifier_popover), |