diff options
author | Silenio Quarti | 2007-11-13 21:36:10 +0000 |
---|---|---|
committer | Silenio Quarti | 2007-11-13 21:36:10 +0000 |
commit | b39791292251291ac4772734658a9bbffe365967 (patch) | |
tree | 0ebf2d9690999c8b47f2527b8efff561168dc03e | |
parent | fc95ab508b453f24716d12a33f7f001fba7071c5 (diff) | |
download | eclipse.platform.swt-b39791292251291ac4772734658a9bbffe365967.tar.gz eclipse.platform.swt-b39791292251291ac4772734658a9bbffe365967.tar.xz eclipse.platform.swt-b39791292251291ac4772734658a9bbffe365967.zip |
*** empty log message ***
6 files changed, 25 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c index 454cf06281..f1d31c78e7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c @@ -15,6 +15,22 @@ #define OS_NATIVE(func) Java_org_eclipse_swt_internal_cocoa_OS_##func +#ifndef NO_CGWarpMouseCursorPosition +JNIEXPORT jint JNICALL OS_NATIVE(CGWarpMouseCursorPosition) + (JNIEnv *env, jclass that, jobject arg0) +{ + CGPoint _arg0, *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, CGWarpMouseCursorPosition_FUNC); + if (arg0) if ((lparg0 = getCGPointFields(env, arg0, &_arg0)) == NULL) goto fail; + rc = (jint)CGWarpMouseCursorPosition(*lparg0); +fail: + if (arg0 && lparg0) setCGPointFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, CGWarpMouseCursorPosition_FUNC); + return rc; +} +#endif + #ifndef NO_CloseRgn JNIEXPORT void JNICALL OS_NATIVE(CloseRgn) (JNIEnv *env, jclass that, jint arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c index 3e4a51fea0..12a61b2302 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c @@ -14,9 +14,10 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 309; -int OS_nativeFunctionCallCount[309]; +int OS_nativeFunctionCount = 310; +int OS_nativeFunctionCallCount[310]; char * OS_nativeFunctionNames[] = { + "CGWarpMouseCursorPosition", "CloseRgn", "CopyRgn", "DeleteGlobalRef", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h index 2f3b313793..86e0e2571e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h @@ -25,6 +25,7 @@ extern char* OS_nativeFunctionNames[]; #endif typedef enum { + CGWarpMouseCursorPosition_FUNC, CloseRgn_FUNC, CopyRgn_FUNC, DeleteGlobalRef_FUNC, 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 756fd7be6c..6de40f832d 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 @@ -31,6 +31,7 @@ public static final native int GetCurrentProcess(int[] psn); public static final native int SetFrontProcess(int[] psn); public static final native int TransformProcessType(int[] psn, int transformState); public static final native void NSIntersectionRect (NSRect result, NSRect aRect, NSRect bRect); +public static final native int CGWarpMouseCursorPosition (CGPoint newCursorPosition); /** QuickDraw calls */ public static final native int NewRgn(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java index c7070fdd29..c721364fc2 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java @@ -1910,7 +1910,7 @@ public Rectangle getClipping() { NSRect clip = data.clipPath.bounds(); OS.NSIntersectionRect(rect, rect, clip); } - if (data.inverseTransform != null) { + if (data.inverseTransform != null && rect.width > 0 && rect.height > 0) { NSPoint pt = new NSPoint(); pt.x = rect.x; pt.y = rect.y; @@ -1925,9 +1925,6 @@ public Rectangle getClipping() { rect.height = size.height; } } - if (rect.width <= 0 || rect.height <= 0) { - rect.x = rect.y = rect.width = rect.height = 0; - } return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); } 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 b2d42c7230..450f8fddce 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 @@ -2503,9 +2503,9 @@ void setCurrentCaret (Caret caret) { */ public void setCursorLocation (int x, int y) { checkDevice (); -// CGPoint pt = new CGPoint (); -// pt.x = x; pt.y = y; -// OS.CGWarpMouseCursorPosition (pt); + CGPoint pt = new CGPoint (); + pt.x = x; pt.y = y; + OS.CGWarpMouseCursorPosition (pt); } /** |