[gtk+/gestures: 198/202] texthandle: Mind the invisible area when moving the handle



commit ca1510177c8784c5eee2fb1d73f43f2b2dfc27fd
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed May 21 14:58:50 2014 +0200

    texthandle: Mind the invisible area when moving the handle
    
    The handle is still centered horizontally, but the extra vertical
    space wasn't taken into account, leading to misplacing the dragging
    point (and the handle) during motion events.

 gtk/gtktexthandle.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 2261987..ab04955 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -193,14 +193,18 @@ gtk_text_handle_widget_event (GtkWidget     *widget,
            event->motion.state & GDK_BUTTON1_MASK &&
            priv->windows[pos].dragged)
     {
-      gint x, y, width, height;
+      gint x, y, width, height, handle_height;
+      GtkAllocation allocation;
 
-      _gtk_text_handle_get_size (handle, &width, &height);
+      gtk_widget_get_allocation (priv->windows[pos].widget, &allocation);
+      width = allocation.width;
+      height = allocation.height;
+      _gtk_text_handle_get_size (handle, NULL, &handle_height);
       x = event->motion.x - priv->windows[pos].dx + (width / 2);
       y = event->motion.y - priv->windows[pos].dy;
 
       if (pos != GTK_TEXT_HANDLE_POSITION_CURSOR)
-        y += height;
+        y += height - handle_height;
 
       y += priv->windows[pos].pointing_to.height / 2;
 


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