[gtk+] textview: Look up the drop location iter on the right coordinates on DND



commit f2fd655754407103f8fb9b2c3e7586fb595ab917
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Sep 24 20:25:26 2015 +0200

    textview: Look up the drop location iter on the right coordinates on DND
    
    We are passing widget coordinates to gtk_text_view_window_to_buffer_coords()
    which expects coordinates to be relative to the text window in this case.
    This may result in drop coordinates being displaced if the side windows to
    the top/left sides are visible and taking space, so the DnD indicator will
    point to the wrong position.
    
    This can be seen on gnome-builder and gedit when displaying line numbers.

 gtk/gtktextview.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index b04a90a..787e6e4 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8243,6 +8243,9 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
       y > (target_rect.y + target_rect.height))
     return FALSE; /* outside the text window, allow parent widgets to handle event */
 
+  x -= target_rect.x;
+  y -= target_rect.y;
+
   gtk_text_view_window_to_buffer_coords (text_view,
                                          GTK_TEXT_WINDOW_WIDGET,
                                          x, y,


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