[gtk+/gtk-3-22] TextView: Fix gesture coords with :border-width >0



commit bd7c87c762c75bbb8dfb5fed23964651188ef206
Author: Daniel Boles <dboles src gnome org>
Date:   Mon Aug 28 21:56:06 2017 +0100

    TextView: Fix gesture coords with :border-width >0
    
    Container:border-width caused the x/y coords converted to iters to be
    offset inwards by that width, breaking positioning/selecting by gesture.
    
    So, subtract :border-width in widget_to_text_window_coords(). This fixes
    gesture positions, & plays fine with :margin & CSS margin/border/padding
    
    N.B.: This is not to endorse :border-width. It’s gone in GTK+ 4 & weird
    on a TextView: it’d be more intuitive to – if you must! – set it on the
    TV parent. Really, please just use CSS instead. Still, it’s easy to fix.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759725

 gtk/gtktextview.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index c40ac2e..f267c6c 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5083,6 +5083,10 @@ _widget_to_text_window_coords (GtkTextView *text_view,
                                gint        *y)
 {
   GtkTextViewPrivate *priv = text_view->priv;
+  gint border_width = gtk_container_get_border_width (GTK_CONTAINER (text_view));
+
+  *x -= border_width;
+  *y -= border_width;
 
   if (priv->top_window)
     (*y) -= priv->top_window->requisition.height;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]