< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m

Print this page

        

*** 35,44 **** --- 35,45 ---- #import "CDataTransferer.h" #import "CDropTarget.h" #import "CDragSource.h" #import "DnDUtilities.h" #import "ThreadUtilities.h" + #import "LWCToolkit.h" // When sIsJavaDragging is true Java drag gesture has been recognized and a drag is/has been initialized. // We must stop posting MouseEvent.MOUSE_DRAGGED events for the duration of the drag or all hell will break // loose in shared code - tracking state going haywire.
*** 509,521 **** // Set up the fDragKeyModifier, so we know if the operation has changed // Set up the fDragMouseModifier, so we can |= it later (since CoreDrag doesn't tell us mouse states during a drag) fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers]; fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers]; - sNeedsEnter = YES; - @try { // Data dragging: if (isFileDrag == FALSE) { [view dragImage:dragImage at:dragOrigin offset:dragOffset event:dragEvent pasteboard:pb source:view slideBack:YES]; } else if (fileDragPromises == FALSE) { // File dragging: --- 510,522 ---- // Set up the fDragKeyModifier, so we know if the operation has changed // Set up the fDragMouseModifier, so we can |= it later (since CoreDrag doesn't tell us mouse states during a drag) fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers]; fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers]; @try { + sNeedsEnter = YES; + AWTToolkit.inDoDragDropLoop = YES; // Data dragging: if (isFileDrag == FALSE) { [view dragImage:dragImage at:dragOrigin offset:dragOffset event:dragEvent pasteboard:pb source:view slideBack:YES]; } else if (fileDragPromises == FALSE) { // File dragging:
*** 559,568 **** --- 560,570 ---- JNFCallVoidMethod(env, fDragSourceContextPeer, dragDropFinishedMethod, success, dragOp, (jint) point.x, (jint) point.y); // AWT_THREADING Safe (event) JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V"); JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable } @finally { sNeedsEnter = NO; + AWTToolkit.inDoDragDropLoop = NO; } // We have to do this, otherwise AppKit doesn't know we're finished dragging. Yup, it's that bad. if ([[[NSRunLoop currentRunLoop] currentMode] isEqualTo:NSEventTrackingRunLoopMode]) { [NSApp postEvent:[self nsDragEvent:NO] atStart:YES];
*** 605,632 **** - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination { }*/ - (void)draggedImage:(NSImage *)image beganAt:(NSPoint)screenPoint { DLog4(@"[CDragSource draggedImage beganAt]: (%f, %f) %@\n", screenPoint.x, screenPoint.y, self); ! // Initialize static variables: sDragOperation = NSDragOperationNone; sDraggingLocation = screenPoint; } - (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation { DLog4(@"[CDragSource draggedImage endedAt:]: (%f, %f) %@\n", screenPoint.x, screenPoint.y, self); ! sDraggingLocation = screenPoint; sDragOperation = operation; } - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint { //DLog4(@"[CDragSource draggedImage moved]: (%d, %d) %@\n", (int) screenPoint.x, (int) screenPoint.y, self); JNIEnv* env = [ThreadUtilities getJNIEnv]; JNF_COCOA_ENTER(env); // There are two things we would be interested in: // a) mouse pointer has moved // b) drag actions (key modifiers) have changed BOOL notifyJava = FALSE; --- 607,635 ---- - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination { }*/ - (void)draggedImage:(NSImage *)image beganAt:(NSPoint)screenPoint { DLog4(@"[CDragSource draggedImage beganAt]: (%f, %f) %@\n", screenPoint.x, screenPoint.y, self); ! [AWTToolkit eventCountPlusPlus]; // Initialize static variables: sDragOperation = NSDragOperationNone; sDraggingLocation = screenPoint; } - (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation { DLog4(@"[CDragSource draggedImage endedAt:]: (%f, %f) %@\n", screenPoint.x, screenPoint.y, self); ! [AWTToolkit eventCountPlusPlus]; sDraggingLocation = screenPoint; sDragOperation = operation; } - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint { //DLog4(@"[CDragSource draggedImage moved]: (%d, %d) %@\n", (int) screenPoint.x, (int) screenPoint.y, self); JNIEnv* env = [ThreadUtilities getJNIEnv]; JNF_COCOA_ENTER(env); + [AWTToolkit eventCountPlusPlus]; // There are two things we would be interested in: // a) mouse pointer has moved // b) drag actions (key modifiers) have changed BOOL notifyJava = FALSE;
< prev index next >