diff options
author | Lakshmi Shanmugam | 2013-09-02 06:44:35 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2013-09-02 06:44:35 +0000 |
commit | e1ed2e305b572c142219fc5140ca7b70afdb4469 (patch) | |
tree | c37a39c07becab5f813003fdfd2b863c7f1ca226 /bundles | |
parent | afc0fa6e8d839b2b3830e8588568e0e0ce159e34 (diff) | |
download | eclipse.platform.swt-e1ed2e305b572c142219fc5140ca7b70afdb4469.tar.gz eclipse.platform.swt-e1ed2e305b572c142219fc5140ca7b70afdb4469.tar.xz eclipse.platform.swt-e1ed2e305b572c142219fc5140ca7b70afdb4469.zip |
Bug 414134-[DND]Setting Control's cursor other than
SWT.CURSOR_ARROW causes drag operation to show incorrect icon
Diffstat (limited to 'bundles')
6 files changed, 27 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java index 915e34a57e..153be8b1aa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java @@ -78,6 +78,7 @@ public class DropTarget extends Widget { static Callback dropTarget2Args, dropTarget3Args, dropTarget6Args; static long /*int*/ proc2Args, proc3Args, proc6Args; + static final String LOCK_CURSOR = "org.eclipse.swt.internal.lockCursor"; //$NON-NLS-1$ static { Class clazz = DropTarget.class; @@ -256,7 +257,7 @@ int draggingEntered(long /*int*/ id, long /*int*/ sel, NSObject sender) { selectedOperation = event.detail; } - if ((selectedOperation == DND.DROP_NONE) && (OS.PTR_SIZEOF == 4)) { + if (selectedOperation == DND.DROP_NONE) { setDropNotAllowed(); } else { if(((Boolean)control.getData(IS_ACTIVE)).booleanValue() == false) { @@ -332,7 +333,7 @@ int draggingUpdated(long /*int*/ id, long /*int*/ sel, NSObject sender) { selectedOperation = event.detail; } - if ((selectedOperation == DND.DROP_NONE) && (OS.PTR_SIZEOF == 4)) { + if (selectedOperation == DND.DROP_NONE) { setDropNotAllowed(); } else { if(((Boolean)control.getData(IS_ACTIVE)).booleanValue() == false) { @@ -940,13 +941,20 @@ public void setTransfer(Transfer[] transferAgents){ void setDropNotAllowed() { if (!dropNotAllowed) { NSCursor.currentCursor().push(); - if (OS.PTR_SIZEOF == 4) OS.SetThemeCursor(OS.kThemeNotAllowedCursor); + Display display = getDisplay(); + display.setData (LOCK_CURSOR, Boolean.FALSE); + NSCursor.operationNotAllowedCursor().push(); + display.setData (LOCK_CURSOR, Boolean.TRUE); dropNotAllowed = true; } } void clearDropNotAllowed() { if (dropNotAllowed) { + Display display = getDisplay(); + display.setData (LOCK_CURSOR, Boolean.FALSE); + NSCursor.pop(); + display.setData (LOCK_CURSOR, Boolean.TRUE); NSCursor.pop(); dropNotAllowed = false; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 4452ba50d6..32c58dc1d7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -1123,6 +1123,9 @@ <arg swt_gen="true"></arg> <retval swt_gen="true" swt_java_type="NSCursor"></retval> </method> + <method class_method="true" selector="operationNotAllowedCursor" swt_gen="true"> + <retval swt_gen="true"></retval> + </method> <method class_method="true" selector="pointingHandCursor" swt_gen="true"> <retval swt_gen="true"></retval> </method> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java index 453c58f3e0..dabf09c6ea 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -55,6 +55,11 @@ public NSCursor initWithImage(NSImage newImage, NSPoint aPoint) { return result == this.id ? this : (result != 0 ? new NSCursor(result) : null); } +public static NSCursor operationNotAllowedCursor() { + long /*int*/ result = OS.objc_msgSend(OS.class_NSCursor, OS.sel_operationNotAllowedCursor); + return result != 0 ? new NSCursor(result) : null; +} + public static NSCursor pointingHandCursor() { long /*int*/ result = OS.objc_msgSend(OS.class_NSCursor, OS.sel_pointingHandCursor); return result != 0 ? new NSCursor(result) : null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index c2f2b4bc9e..59d241bb75 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1591,6 +1591,7 @@ public static final long /*int*/ sel_openFile_withApplication_ = sel_registerNam public static final long /*int*/ sel_openPanel = sel_registerName("openPanel"); public static final long /*int*/ sel_openURL_ = sel_registerName("openURL:"); public static final long /*int*/ sel_openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers_ = sel_registerName("openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:"); +public static final long /*int*/ sel_operationNotAllowedCursor = sel_registerName("operationNotAllowedCursor"); public static final long /*int*/ sel_options = sel_registerName("options"); public static final long /*int*/ sel_orderBack_ = sel_registerName("orderBack:"); public static final long /*int*/ sel_orderFront_ = sel_registerName("orderFront:"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java index 3021a8f4ac..ad755198eb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Cursor.java @@ -176,7 +176,7 @@ public Cursor(Device device, int style) { case SWT.CURSOR_SIZENW: handle = NSCursor.crosshairCursor(); break; case SWT.CURSOR_UPARROW: handle = NSCursor.crosshairCursor(); break; case SWT.CURSOR_IBEAM: shouldCreateCursor = true; break; - case SWT.CURSOR_NO: handle = NSCursor.crosshairCursor(); break; + case SWT.CURSOR_NO: handle = NSCursor.operationNotAllowedCursor(); break; default: SWT.error(SWT.ERROR_INVALID_ARGUMENT); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index e08f51fae0..2de29b8730 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -175,6 +175,7 @@ public class Display extends Device { Callback observerCallback; boolean lockCursor = true; + static final String LOCK_CURSOR = "org.eclipse.swt.internal.lockCursor"; //$NON-NLS-1$ long /*int*/ oldCursorSetProc; Callback cursorSetCallback; @@ -4404,6 +4405,10 @@ public void setData (String key, Object value) { if (key.equals (MOZILLA_RUNNING)) { mozillaRunning = ((Boolean)value).booleanValue (); } + + if (key.equals (LOCK_CURSOR)) { + lockCursor = ((Boolean)value).booleanValue (); + } /* Remove the key/value pair */ if (value == null) { |