You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/10/22 13:33:11 UTC

svn commit: r828663 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Author: tvolkert
Date: Thu Oct 22 11:33:10 2009
New Revision: 828663

URL: http://svn.apache.org/viewvc?rev=828663&view=rev
Log:
Fixed small bug in ApplicationContext -- wasn't calling DragSource.endDrag() on native drags that were initiated from within Pivot

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=828663&r1=828662&r2=828663&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Thu Oct 22 11:33:10 2009
@@ -565,7 +565,8 @@
             return dropDescendant;
         }
 
-        private void startNativeDrag(final DragSource dragSource, final MouseEvent mouseEvent) {
+        private void startNativeDrag(final DragSource dragSource, final Component dragDescendant,
+            final MouseEvent mouseEvent) {
             java.awt.dnd.DragSource awtDragSource = java.awt.dnd.DragSource.getDefaultDragSource();
 
             final int supportedDropActions = dragSource.getSupportedDropActions();
@@ -649,6 +650,7 @@
                 public void dragDropEnd(DragSourceDropEvent event) {
                     DragSourceContext context = event.getDragSourceContext();
                     context.setCursor(java.awt.Cursor.getDefaultCursor());
+                    dragSource.endDrag(dragDescendant, getDropAction(event.getDropAction()));
                 }
             });
         }
@@ -968,15 +970,17 @@
                                             DragSource dragSource = dragDescendant.getDragSource();
                                             dragLocation = dragDescendant.mapPointFromAncestor(display, x, y);
 
-                                            if (dragSource.beginDrag(dragDescendant, dragLocation.x, dragLocation.y)) {
+                                            if (dragSource.beginDrag(dragDescendant,
+                                                dragLocation.x, dragLocation.y)) {
                                                 // A drag has started
                                                 if (dragSource.isNative()) {
+                                                    startNativeDrag(dragSource, dragDescendant,
+                                                        event);
+
                                                     // Clear the drag state since it is not used for
                                                     // native drags
                                                     dragDescendant = null;
                                                     dragLocation = null;
-
-                                                    startNativeDrag(dragSource, event);
                                                 } else {
                                                     if (dragSource.getRepresentation() != null
                                                         && dragSource.getOffset() == null) {