Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java58
1 files changed, 29 insertions, 29 deletions
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 5dbf3cf255..cc443d2368 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
@@ -3352,35 +3352,35 @@ public boolean post(Event event) {
mouseCursorPosition.y = event.y;
eventRef = OS.CGEventCreateMouseEvent(eventSource, OS.kCGEventMouseMoved, mouseCursorPosition, 0);
} else {
- NSPoint nsCursorPosition = NSEvent.mouseLocation();
- NSRect primaryFrame = getPrimaryFrame();
- mouseCursorPosition.x = nsCursorPosition.x;
- mouseCursorPosition.y = (int) (primaryFrame.height - nsCursorPosition.y);
- int eventType = 0;
- // SWT buttons are 1-based: 1,2,3,4,5; CG buttons are 0 based: 0,2,1,3,4
- int cgButton;
- switch (event.button) {
- case 1:
- eventType = (event.type == SWT.MouseDown ? OS.kCGEventLeftMouseDown : OS.kCGEventLeftMouseUp);
- cgButton = 0;
- break;
- case 2:
- eventType = (event.type == SWT.MouseDown ? OS.kCGEventOtherMouseDown : OS.kCGEventOtherMouseUp);
- cgButton = 2;
- break;
- case 3:
- eventType = (event.type == SWT.MouseDown ? OS.kCGEventRightMouseDown : OS.kCGEventRightMouseUp);
- cgButton = 1;
- break;
- default:
- eventType = (event.type == SWT.MouseDown ? OS.kCGEventOtherMouseDown : OS.kCGEventOtherMouseUp);
- cgButton = event.button - 1;
- break;
- }
-
- if (cgButton >= 0) {
- eventRef = OS.CGEventCreateMouseEvent(eventSource, eventType, mouseCursorPosition, cgButton);
- }
+ NSPoint nsCursorPosition = NSEvent.mouseLocation();
+ NSRect primaryFrame = getPrimaryFrame();
+ mouseCursorPosition.x = nsCursorPosition.x;
+ mouseCursorPosition.y = (int) (primaryFrame.height - nsCursorPosition.y);
+ int eventType = 0;
+ // SWT buttons are 1-based: 1,2,3,4,5; CG buttons are 0 based: 0,2,1,3,4
+ int cgButton;
+ switch (event.button) {
+ case 1:
+ eventType = (event.type == SWT.MouseDown ? OS.kCGEventLeftMouseDown : OS.kCGEventLeftMouseUp);
+ cgButton = 0;
+ break;
+ case 2:
+ eventType = (event.type == SWT.MouseDown ? OS.kCGEventOtherMouseDown : OS.kCGEventOtherMouseUp);
+ cgButton = 2;
+ break;
+ case 3:
+ eventType = (event.type == SWT.MouseDown ? OS.kCGEventRightMouseDown : OS.kCGEventRightMouseUp);
+ cgButton = 1;
+ break;
+ default:
+ eventType = (event.type == SWT.MouseDown ? OS.kCGEventOtherMouseDown : OS.kCGEventOtherMouseUp);
+ cgButton = event.button - 1;
+ break;
+ }
+
+ if (cgButton >= 0) {
+ eventRef = OS.CGEventCreateMouseEvent(eventSource, eventType, mouseCursorPosition, cgButton);
+ }
}
break;
}

Back to the top