Community
Participate
Working Groups
Cocoa 64 bit build Version: 3.7.0 Build id: I20110603-0909 Steps: 1) Run Snippet 353 2) Try the rotate gesture on the trackpad The gesture is recognized but event.rotation field is always 0. This works fine on 32 bit build.
Hi Silenio, The problem is that NSEvent.rotation() is not returning the correct value. public float rotation() { return (float)OS.objc_msgSend_fpret(this.id, OS.sel_rotation); } The method objc_msgSend_fpret() doesn't return the correct float value only in 64 bit build. The native code for objc_msgSend_fpret() in os.c uses (jdouble) as the return type in the function pointer. But, since NSEvent rotation() returns float shouldn't we use (jfloat) as the return type in the function pointer? Also, I'm not sure why this is not a problem on 32 bit build. In SWT code, we use 2 methods that returns float value --> NSEvent.rotation() and NSNumber.floatValue(). NSNumber.floatValue() too has the same problem, i.e, works on 32 bit but not on 64 bit.
Created attachment 202087 [details] test patch Created this test patch to test if using float instead of double fixes the problem. OS.java already has objc_msgSend_fpret(int, int) so I have added objc_msgSend_fpret with float return type with a different method name and defined it in os_custom.c. This works on both 32 & 64 bit.
I changed the Mac Generator tool to generate the appropriate code when the return type is float on 64 bit. Fixed. http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2f42a694a040beadb46715d86b45bb678c89d78c
Verified in I20110912-2126