summaryrefslogtreecommitdiff
path: root/gtk/gtkentry.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-03-07 01:21:50 +0100
committerMatthias Clasen <mclasen@redhat.com>2014-03-06 22:54:46 -0500
commit43b0eee81d04499e4a72085d88d352a43bbb293b (patch)
tree7eb0a73b9e0ac366d7589ffe5e193022bb202e4b /gtk/gtkentry.c
parentadf39dd291b561681da0fd3346e782e6fb224abc (diff)
downloadgtk+-43b0eee81d04499e4a72085d88d352a43bbb293b.tar.gz
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
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r--gtk/gtkentry.c16
1 files changed, 16 insertions, 0 deletions
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;