[gtk+/gtk-3-10] entry: Make DnD coordinate calculation compensate for entry icons
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-10] entry: Make DnD coordinate calculation compensate for entry icons
- Date: Sun, 6 Apr 2014 03:43:22 +0000 (UTC)
commit 2a164256170d962abee95a0b0733afa5121b698f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Mar 7 01:21:50 2014 +0100
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 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index cf5fcf4..e18003d 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -9593,6 +9593,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;
@@ -9605,6 +9606,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);
@@ -9663,6 +9671,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;
@@ -9674,6 +9683,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]