forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
adf39dd291
commit
43b0eee81d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user