From 43b0eee81d04499e4a72085d88d352a43bbb293b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 7 Mar 2014 01:21:50 +0100 Subject: [PATCH] entry: Make DnD coordinate calculation compensate for entry icons This made DnD have effect farther on the left when dragging text over any entry with icons in it. https://bugzilla.gnome.org/show_bug.cgi?id=725866 --- gtk/gtkentry.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index a433426067..95e27800a9 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -9762,6 +9762,7 @@ gtk_entry_drag_motion (GtkWidget *widget, { GtkEntry *entry = GTK_ENTRY (widget); GtkEntryPrivate *priv = entry->priv; + GtkAllocation primary, secondary; GtkStyleContext *style_context; GtkWidget *source_widget; GdkDragAction suggested_action; @@ -9774,6 +9775,13 @@ gtk_entry_drag_motion (GtkWidget *widget, x -= padding.left; y -= padding.top; + get_icon_allocations (entry, &primary, &secondary); + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) + x -= secondary.width; + else + x -= primary.width; + old_position = priv->dnd_position; new_position = gtk_entry_find_position (entry, x + priv->scroll_offset); @@ -9832,6 +9840,7 @@ gtk_entry_drag_data_received (GtkWidget *widget, GtkEntry *entry = GTK_ENTRY (widget); GtkEntryPrivate *priv = entry->priv; GtkEditable *editable = GTK_EDITABLE (widget); + GtkAllocation primary, secondary; GtkStyleContext *style_context; GtkBorder padding; gchar *str; @@ -9843,6 +9852,13 @@ gtk_entry_drag_data_received (GtkWidget *widget, x -= padding.left; y -= padding.top; + get_icon_allocations (entry, &primary, &secondary); + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) + x -= secondary.width; + else + x -= primary.width; + if (str && priv->editable) { gint new_position;