summaryrefslogtreecommitdiff
path: root/gtk/gtktextview.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-11-14 21:07:11 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-11-14 21:07:11 +0000
commit6da9e17a1e5e58d29a4af3af836b5c1a0c86c0bc (patch)
tree51ebe646d6d7abb66ae17e3438803734ca4f57fc /gtk/gtktextview.c
parent2672c1173e70b6cac39d2db37fac46169f3601e0 (diff)
downloadgtk+-6da9e17a1e5e58d29a4af3af836b5c1a0c86c0bc.tar.gz
Fix drag-and-drop to default to GDK_ACTION_MOVE if the drag is within a
2000-11-14 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_drag_motion): Fix drag-and-drop to default to GDK_ACTION_MOVE if the drag is within a single widget. Defaults to GDK_ACTION_COPY between widgets.
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r--gtk/gtktextview.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index bdb77b3d94..4117f2a8ec 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -3818,7 +3818,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
GtkTextIter end;
GdkRectangle target_rect;
gint bx, by;
-
+
text_view = GTK_TEXT_VIEW (widget);
target_rect = text_view->text_window->allocation;
@@ -3836,8 +3836,8 @@ gtk_text_view_drag_motion (GtkWidget *widget,
gtk_text_layout_get_iter_at_pixel (text_view->layout,
&newplace,
- bx, by);
-
+ bx, by);
+
if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
&start, &end) &&
gtk_text_iter_in_range (&newplace, &start, &end))
@@ -3847,13 +3847,29 @@ gtk_text_view_drag_motion (GtkWidget *widget,
gtk_text_mark_set_visible (text_view->dnd_mark, FALSE);
}
else
- {
+ {
if (gtk_text_iter_editable (&newplace, text_view->editable))
{
+ GtkWidget *source_widget;
+ GdkDragAction suggested_action;
+
+ suggested_action = context->suggested_action;
+
+ source_widget = gtk_drag_get_source_widget (context);
+
+ if (source_widget == widget)
+ {
+ /* Default to MOVE, unless the user has
+ * pressed ctrl or alt to affect available actions
+ */
+ if ((context->actions & GDK_ACTION_MOVE) != 0)
+ suggested_action = GDK_ACTION_MOVE;
+ }
+
gtk_text_mark_set_visible (text_view->dnd_mark,
text_view->cursor_visible);
- gdk_drag_status (context, context->suggested_action, time);
+ gdk_drag_status (context, suggested_action, time);
}
else
{