Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Struggling to get SWT_AWT bridge working on Mac with Java 7
Struggling to get SWT_AWT bridge working on Mac with Java 7 [message #1098126] Fri, 30 August 2013 16:56 Go to next message
Tom Denham is currently offline Tom DenhamFriend
Messages: 3
Registered: August 2013
Junior Member
My troubles are recorded on the DJNative swing forum
sourceforge.net/p/djproject/discussion/671154/thread/02fa4e30/

But I think it might actually be an SWT problem. Anyone care to comment?

Many thanks
Tom
Re: Struggling to get SWT_AWT bridge working on Mac with Java 7 [message #1099852 is a reply to message #1098126] Mon, 02 September 2013 09:57 Go to previous messageGo to next message
Tom Denham is currently offline Tom DenhamFriend
Messages: 3
Registered: August 2013
Junior Member
Apologies for the terse previous post, I'll see if I can elabortate a bit more here.

I'm trying to get the web browser component from the DJ Native Swing Project (djproject.sourceforge.net/ns/) working on Mac version of my application when using Java 7.

  • The Windows version works fine with Java 7
  • The Mac version works fine on (Apple) Java 6
  • The Mac version is broken on OpenJDK Java 7 and 8.


I've tried getting this working on Mac by building the latest OpenJDK7 from source and by using the latest OpenJDK 8 build (from a couple of days ago).

I've also tried with SWT 4.3 and the latest 4.4 builds.

I believe I'm seeing a problem with the SWT_AWT bridge, so I hope this is the right place to discuss it.

The first problem I hit, I tracked down to swt_awt.c, and the call to JAWT_GetAWT()

This was never returning a handle.

I got past this by spotting this comment in jawt_md.h
/*
 * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
 * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
 * return false. This is to maintain compatibility with applications that used the
 * interface with Java 6 which had multiple rendering models. This flag is not necessary
 * when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
 *
 * Example:
 *   JAWT awt;
 *   awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
 *   jboolean success = JAWT_GetAWT(env, &awt);
 */
#define JAWT_MACOSX_USE_CALAYER 0x80000000


By updating the version line in awt_swt.c, I now get further, but hit the following error in the native code

2013-08-30 15:55:24.443 java[94082:1407] +[AWTSurfaceLayers addSubview:]: unrecognized selector sent to class 0x151a147d0

So - a few questions


  • Does anyone expect this to work?
  • Where is the native code in the git repo - I can't find it.
  • Is the awt.version fix I made appropriate or should I have done something else?
  • Any ideas on why my call to org.eclipse.swt.awt.SWT_AWT.new_Shell is failing with the above objective-c error?

Thanks
Tom
Re: Struggling to get SWT_AWT bridge working on Mac with Java 7 [message #1100048 is a reply to message #1099852] Mon, 02 September 2013 15:26 Go to previous message
Tom Denham is currently offline Tom DenhamFriend
Messages: 3
Registered: August 2013
Junior Member
And, a simple repro for anyone - just try snippet 337 (http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet337.java)

It works fine on Windows but is broken on Mac.
Previous Topic:Outlook E-Mail
Next Topic:tool tip on Button ?
Goto Forum:
  


Current Time: Tue Apr 23 07:29:07 GMT 2024

Powered by FUDForum. Page generated in 0.02628 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top