Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Re: Mac OS X Port

We think it's a great idea to do a Mac port, and we are pleased to
see this much interest. To get you started we can set up separate Mac
mailing list, and provide a template of SWT API stubs. We are willing
to offer technical guidance, and review and commit code.

However there are certain things that are required before this can happen:
1) We need to get PMC approval to make this part of the Eclipse project.
2) A technical lead must come forward from the community who is willing
   to make a commitment to see the project through to its completion.
   The most important experience is **Mac OS programming** and C.
   The current SWT team is already fully committed for the near future.
3) The port has to be well done and consistent with existing SWT
   implementations.

Here are a few more notes based on the discussion so far.

The Cocoa bindings should be investigated but there are things you have to
keep in mind before using them:
  - are there licensing issues?
  - how big is the jar file?
  - can we discard unused API to reduce memory footprint?
  - does it map directly to the OS?
  - what versions of the OS does it support?

We recommend you read the following:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/main.html
http://www.eclipsecorner.org/articles/Article-SWT-Design-1/SWT-Design-1.html
http://www.eclipsecorner.org/eclipse/eclipse-charter.html

To get a feel for swt programming, check out our example plugins:
- org.eclipse.swt.examples
- org.eclipse.swt.examples.controls
- org.eclipse.swt.examples.launcher
- org.eclipse.swt.examples.paint

To look at the SWT implementation, connect to the repository using:
:pserver:anonymous@xxxxxxxxxxxxxxx:/home/eclipse
and load the latest version (v2012) of org.eclipse.swt,
or if you are really wild, load org.eclipse.swt from the HEAD stream.
If you are using Eclipse to browse the code, you will need to copy the
.classpath_xxx file for your platform to ".classpath".
For example, copy .classpath_win32 to .classpath

To see an example SWT OS binding (to the win32 API) look at:
org.eclipse.swt.internal.win32.OS   - Java side JNI code
org.eclipse.swt/Eclipse SWT/win32/library/swt.c  - 'C' side JNI code

If you really want to get your feet wet and start coding to the Mac API,
the first step is to create a top level shell with a button in it using
only library calls, and implement an event loop. Here is an example from
win32:

package org.eclipse.swt.examples.win32;

import org.eclipse.swt.internal.win32.*;

public class BigButton {
public static void main (String [] args) {
        TCHAR lpClassName = new TCHAR (0, "BUTTON", true);
        int hInstance = OS.GetModuleHandle (null);
        int hwnd = OS.CreateWindowEx (
                0, 
                lpClassName, 
                null,
                OS.WS_OVERLAPPEDWINDOW | OS.WS_VISIBLE,
                OS.CW_USEDEFAULT,
                OS.CW_USEDEFAULT,
                OS.CW_USEDEFAULT,
                OS.CW_USEDEFAULT,
                0,
                0,
                hInstance, 
                null);
        MSG msg = new MSG ();
        while (OS.GetMessage (msg, 0, 0, 0)) OS.DispatchMessage (msg);
}
}


So just to reiterate:
If you want to get an SWT Mac port project started, here's what you do:
- find a technical lead
- establish that you have a community
- report back to Mike Wilson, the SWT team lead, to officially launch the 
project

Carolyn, Veronika, Steve, and Mike


Back to the top