2006-12-26 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / X11Dnd.cs
index 2928ecdef45aa10c485b3a1d9c126879d0a3629d..2cb4a9cfb464abd9a6e5c634d5932a69d56297ab 100644 (file)
@@ -299,12 +299,12 @@ namespace System.Windows.Forms {
                private IntPtr XdndActionCopy;
                private IntPtr XdndActionMove;
                private IntPtr XdndActionLink;
-               private IntPtr XdndActionPrivate;
-               private IntPtr XdndActionList;
-               private IntPtr XdndActionDescription;
-               private IntPtr XdndActionAsk;
+               //private IntPtr XdndActionPrivate;
+               //private IntPtr XdndActionList;
+               //private IntPtr XdndActionDescription;
+               //private IntPtr XdndActionAsk;
 
-               private State state;
+               //private State state;
 
                private int converts_pending;
                private bool position_recieved;
@@ -314,7 +314,6 @@ namespace System.Windows.Forms {
                private IntPtr toplevel;
                private DataObject data;
 
-               private IntPtr drag_action;
                private Control control;
                private int pos_x, pos_y;
                private DragDropEffects allowed;
@@ -324,7 +323,8 @@ namespace System.Windows.Forms {
                private Cursor CursorCopy;
                private Cursor CursorMove;
                private Cursor CursorLink;
-               private IntPtr CurrentCursorHandle;
+               // check out the TODO below
+               //private IntPtr CurrentCursorHandle;
                
                public X11Dnd (IntPtr display)
                {
@@ -393,7 +393,7 @@ namespace System.Windows.Forms {
                                return;
 
                        if (drag_data.State == DragState.Beginning) {
-                               state = State.Accepting;
+                               //state = State.Accepting;
                        } else if (drag_data.State != DragState.None) {
 
                                if (drag_data.WillAccept) {
@@ -507,23 +507,6 @@ namespace System.Windows.Forms {
                        return false;
                }
 
-               // DEBUG CODE REMOVE
-               private string GetText (IntPtr handle) {
-                       string text = String.Empty;
-                       IntPtr  textptr;
-
-                       textptr = IntPtr.Zero;
-
-                       XplatUIX11.XFetchName (display, handle, ref textptr);
-                       if (textptr != IntPtr.Zero) {
-                               text = Marshal.PtrToStringAnsi(textptr);
-                               XplatUIX11.XFree (textptr);
-                       }
-
-                       return text;
-               }
-
-                       
                // return true if the event is handled here
                public bool HandleClientMessage (ref XEvent xevent)
                {
@@ -639,7 +622,8 @@ namespace System.Windows.Forms {
                        pos_x = (int) xevent.ClientMessageEvent.ptr3 >> 16;
                        pos_y = (int) xevent.ClientMessageEvent.ptr3 & 0xFFFF;
 
-                       allowed = EffectFromAction (xevent.ClientMessageEvent.ptr5);
+                       // Copy is implicitly allowed
+                       allowed = EffectFromAction (xevent.ClientMessageEvent.ptr5) | DragDropEffects.Copy;
 
                        IntPtr parent, child, new_child, last_drop_child;
                        parent = XplatUIX11.XRootWindow (display, 0);
@@ -697,8 +681,8 @@ namespace System.Windows.Forms {
                        } else {
                                drag_event.x = pos_x;
                                drag_event.y = pos_y;
-                               SendStatus (source, drag_event.Effect);
                                control.DndOver (drag_event);
+                               SendStatus (source, drag_event.Effect);
                        }
                        
                        return true;
@@ -764,7 +748,7 @@ namespace System.Windows.Forms {
                                                        EventMask.ButtonPressMask |
                                                        EventMask.ButtonReleaseMask,
                                                        cursor.Handle, IntPtr.Zero);
-                                       CurrentCursorHandle = cursor.Handle;
+                                       //CurrentCursorHandle = cursor.Handle;
                                        //}     
                        }
                        return true;
@@ -983,10 +967,10 @@ namespace System.Windows.Forms {
                        XdndActionCopy = XplatUIX11.XInternAtom (display, "XdndActionCopy", false);
                        XdndActionMove = XplatUIX11.XInternAtom (display, "XdndActionMove", false);
                        XdndActionLink = XplatUIX11.XInternAtom (display, "XdndActionLink", false);
-                       XdndActionPrivate = XplatUIX11.XInternAtom (display, "XdndActionPrivate", false);
-                       XdndActionList = XplatUIX11.XInternAtom (display, "XdndActionList", false);
-                       XdndActionDescription = XplatUIX11.XInternAtom (display, "XdndActionDescription", false);
-                       XdndActionAsk = XplatUIX11.XInternAtom (display, "XdndActionAsk", false);
+                       //XdndActionPrivate = XplatUIX11.XInternAtom (display, "XdndActionPrivate", false);
+                       //XdndActionList = XplatUIX11.XInternAtom (display, "XdndActionList", false);
+                       //XdndActionDescription = XplatUIX11.XInternAtom (display, "XdndActionDescription", false);
+                       //XdndActionAsk = XplatUIX11.XInternAtom (display, "XdndActionAsk", false);
 
                        foreach (MimeHandler handler in MimeHandlers) {
                                handler.Type = XplatUIX11.XInternAtom (display, handler.Name, false);