diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2013-04-10 20:30:56 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2013-04-10 20:36:37 +0400 |
commit | 5e47c45b7b60985723fccad7cd70be56d384467d (patch) | |
tree | 116730993a8e36d665bc8a85dd174a0f1e012c59 | |
parent | c68dcc2a8ae2df61428583bf9cca3706e3dded06 (diff) |
[GTK] Drag&Drop fix0.1
Use the Move action by default when no specific
action has been set.
-rwxr-xr-x | Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs index 0e8bec95..8c94af54 100755 --- a/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs @@ -975,12 +975,20 @@ namespace Xwt.GtkBackend if (DragDropInfo.DragDataRequests == 0) { if (DragDropInfo.DragDataForMotion) { - // This is a workaround to what seems to be a mac gtk bug. - // Suggested action is set to all when no control key is pressed + // If no specific action is set, it means that no key has been pressed. + // In that case, use Move or Copy or Link as default (when allowed, in this order). var cact = ConvertDragAction (context.Actions); - if (cact == DragDropAction.All) - cact = DragDropAction.Move; - + if (cact != DragDropAction.Copy && cact != DragDropAction.Move && cact != DragDropAction.Link) { + if (cact.HasFlag (DragDropAction.Move)) + cact = DragDropAction.Move; + else if (cact.HasFlag (DragDropAction.Copy)) + cact = DragDropAction.Copy; + else if (cact.HasFlag (DragDropAction.Link)) + cact = DragDropAction.Link; + else + cact = DragDropAction.None; + } + DragOverEventArgs da = new DragOverEventArgs (DragDropInfo.LastDragPosition, DragDropInfo.DragData, cact); Toolkit.Invoke (delegate { EventSink.OnDragOver (da); |