On 2014-07-19 01:47, Mike wrote:

Well, I haven't tried to build yet, but I have been going through the
source code, and I found something interesting.

I downloaded the swt source code for both Win32 and Win64, and compared
them in WinMerge.

What's interesting is the source code is littered with stuff like this:

File: org/eclipse/swt/widgets/IME.java

Yes, they have a tool (or built step) that replaces "int /*long*/" with "long /*int*/" to convert to 64bit.


SWT - Win32
*******************
LRESULT WM_KILLFOCUS (int /*long*/ wParam, int /*long*/ lParam) {
     if (!isInlineEnabled ()) return null;
     int /*long*/ hwnd = parent.handle;
     int /*long*/ hIMC = OS.ImmGetContext (hwnd);
     if (hIMC != 0) {
         if (OS.ImmGetOpenStatus (hIMC)) {
             OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR,
OS.CPS_COMPLETE, 0);
         }
         OS.ImmReleaseContext (hwnd, hIMC);
     }
     return null;
}

SWT - Win64
********************
LRESULT WM_KILLFOCUS (long /*int*/ wParam, long /*int*/ lParam) {
     if (!isInlineEnabled ()) return null;
     long /*int*/ hwnd = parent.handle;
     long /*int*/ hIMC = OS.ImmGetContext (hwnd);
     if (hIMC != 0) {
         if (OS.ImmGetOpenStatus (hIMC)) {
             OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR,
OS.CPS_COMPLETE, 0);
         }
         OS.ImmReleaseContext (hwnd, hIMC);
     }
     return null;
}


DWT
********************
LRESULT WM_KILLFOCUS (int /*long*/ wParam, int /*long*/ lParam) {
     if (!isInlineEnabled ()) return null;
     auto hwnd = parent.handle;
     auto hIMC = OS.ImmGetContext (hwnd);
     if (hIMC !is null) {
         if (OS.ImmGetOpenStatus (hIMC)) {
             OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR,
OS.CPS_COMPLETE, 0);
         }
         OS.ImmReleaseContext (hwnd, hIMC);
     }
     return null;
}

It appears DWT has modeled any `Handle`s as `void*`, and therefore uses
`auto` whenever possible.  I could probably do a search & replace for
"int /*long*/" or "/*long*/ int" and replace it with "ptrdiff_t" and
cover 80% of the necessary changes.

Thoughts?

Ideally I would like that the native type is used, that's what I've done in the OS X port. But if the existing code uses "int /*long*/" then I would say it's acceptable to use "ptrdiff_t". Perhaps we want to come up with a new name?

Also, could you please answer the following questions for me?
* What version of SWT is the current DWT source code based on?

It's 3.449.0, at least according to this [1].

* How would you like me to submit pull requests? Little-by-little, or
one big whopper?

If possible, smaller changes. But I would prefer DWT to be buildable in-between pull requests.

* How does one go about testing DWT?

[1] https://github.com/d-widget-toolkit/org.eclipse.swt.win32.win32.x86/blob/master/src/org/eclipse/swt/internal/Library.d#L31-L41

--
/Jacob Carlborg

Reply via email to