Skip to content
Browse files

Fix drag&drop support for gtk widgets which don't have a gdkwindow

  • Loading branch information...
1 parent 2f13c9e commit fe850c1dfe6963f9b619fb7f4143cc3c2da7c282 @slluis slluis committed Mar 7, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs
View
17 Xwt.Gtk/Xwt.GtkBackend/WidgetBackend.cs
@@ -341,10 +341,12 @@ public virtual void EnableEvent (object eventId)
WidgetEvent ev = (WidgetEvent) eventId;
switch (ev) {
case WidgetEvent.DragLeave:
- Widget.DragLeave += HandleWidgetDragLeave;
+ AllocEventBox ();
+ EventsRootWidget.DragLeave += HandleWidgetDragLeave;
break;
case WidgetEvent.DragStarted:
- Widget.DragBegin += HandleWidgetDragBegin;
+ AllocEventBox ();
+ EventsRootWidget.DragBegin += HandleWidgetDragBegin;
break;
case WidgetEvent.KeyPressed:
Widget.KeyPressEvent += HandleKeyPressEvent;
@@ -909,10 +911,10 @@ public void DragStart (DragStartData sdata)
void HandleDragBegin (object o, Gtk.DragBeginArgs args)
{
- Widget.DragEnd += HandleWidgetDragEnd;
- Widget.DragFailed += HandleDragFailed;
- Widget.DragDataDelete += HandleDragDataDelete;
- Widget.DragDataGet += HandleWidgetDragDataGet;
+ EventsRootWidget.DragEnd += HandleWidgetDragEnd;
+ EventsRootWidget.DragFailed += HandleDragFailed;
+ EventsRootWidget.DragDataDelete += HandleDragDataDelete;
+ EventsRootWidget.DragDataGet += HandleWidgetDragDataGet;
}
void HandleWidgetDragDataGet (object o, Gtk.DragDataGetArgs args)
@@ -967,14 +969,15 @@ protected virtual void OnSetDragTarget (Gtk.TargetEntry[] table, Gdk.DragAction
public void SetDragSource (TransferDataType[] types, DragDropAction dragAction)
{
+ AllocEventBox ();
DragDropInfo.SourceDragAction = ConvertDragAction (dragAction);
var table = Util.BuildTargetTable (types);
OnSetDragSource (Gdk.ModifierType.Button1Mask, (Gtk.TargetEntry[]) table, DragDropInfo.SourceDragAction);
}
protected virtual void OnSetDragSource (Gdk.ModifierType modifierType, Gtk.TargetEntry[] table, Gdk.DragAction actions)
{
- Gtk.Drag.SourceSet (Widget, modifierType, table, actions);
+ Gtk.Drag.SourceSet (EventsRootWidget, modifierType, table, actions);
}
Gdk.DragAction ConvertDragAction (DragDropAction dragAction)

0 comments on commit fe850c1

Please sign in to comment.
Something went wrong with that request. Please try again.