summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2008-06-13 21:50:41 +0000
committerSilenio Quarti <silenio>2008-06-13 21:50:41 +0000
commit98a4a56c018233577cff0e8e47d70c6c037c182b (patch)
tree8ca07230629c905ecf5112cc31c1254e40881b03
parentd482d3ac5db20fa051bd067d7f91f3fa9cbb9993 (diff)
downloadeclipse.platform.swt-98a4a56c018233577cff0e8e47d70c6c037c182b.tar.gz
eclipse.platform.swt-98a4a56c018233577cff0e8e47d70c6c037c182b.tar.xz
eclipse.platform.swt-98a4a56c018233577cff0e8e47d70c6c037c182b.zip
cursor in CoolBar
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java14
2 files changed, 25 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index 3b850d2089..4e48cc96a7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -2489,7 +2489,22 @@ public void setCursor (Cursor cursor) {
checkWidget();
if (cursor != null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
this.cursor = cursor;
- view.window().invalidateCursorRectsForView(view);
+ NSWindow window = view.window();
+ NSPoint location = window.convertScreenToBase(NSEvent.mouseLocation());
+ NSView view = window.contentView().hitTest(location);
+ Control control = null;
+ if (view != null) {
+ do {
+ Widget widget = display.getWidget (view);
+ if (widget instanceof Control) {
+ control = (Control)widget;
+ break;
+ }
+ view = view.superview();
+ } while (view != null);
+ }
+ if (control != null && control.isTrim (view)) control = null;
+ display.setCursor (control);
}
void setDefaultFont () {
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 9a81a05264..646b21f227 100755
--- 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
@@ -2693,6 +2693,13 @@ void setCurrentCaret (Caret caret) {
}
}
+void setCursor (Control control) {
+ Cursor cursor = null;
+ if (control != null) cursor = control.findCursor ();
+ if (cursor == null) cursor = getSystemCursor (SWT.CURSOR_ARROW);
+ cursor.handle.set ();
+}
+
/**
* Sets the location of the on-screen pointer relative to the top left corner
* of the screen. <b>Note: It is typically considered bad practice for a
@@ -3180,18 +3187,15 @@ void applicationSendMouseEvent (NSEvent nsEvent, boolean send) {
case OS.NSMouseMoved: {
Control control = findControl(nsEvent);
if (control != currentControl) {
- Cursor cursor = null;
- if (control != null) cursor = control.findCursor ();
- if (cursor == null) cursor = getSystemCursor (SWT.CURSOR_ARROW);
- cursor.handle.set ();
if (currentControl != null) {
currentControl.sendMouseEvent (nsEvent, SWT.MouseExit, send);
}
+ currentControl = control;
if (control != null) {
control.sendMouseEvent (nsEvent, SWT.MouseEnter, send);
if (up) timerExec (getToolTipTime (), hoverTimer);
}
- currentControl = control;
+ setCursor (control);
}
if (!up && control != null) {
timerExec (getToolTipTime (), hoverTimer);