| Summary: | Rotate gesture not working on 64bit build | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Lakshmi P Shanmugam <lshanmug> | ||||
| Component: | SWT | Assignee: | Silenio Quarti <Silenio_Quarti> | ||||
| Status: | VERIFIED FIXED | QA Contact: | Silenio Quarti <Silenio_Quarti> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.8 M2 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Lakshmi P Shanmugam
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 |