Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Starting the AWT Native Toolkit [was Re: BSD Java 6 Preview Release 2]




On Nov 29, 2007, at 11:57 AM, John Wallace wrote:

My biggest technical concern is coordinating the Cocoa event thread against the Swing Event Dispatch Thread. I think it's going to be relatively easy to get the various Cocoa peer code running, but getting events flowing smoothly between them may take some doing.

Technical challenges:
1. Event dispatching
2. Graphics optimization (making it not flicker; making it fast)
3. Look & Feel code (Quaqua will go a long way to helping here)

Whether we use straight JNI, or JNA or JNIWrapper doesn't really matter much. I prefer either JNA or JNIWrapper since straight JNI is too easy to mess up. Writing the new toolkit for creating the native Cocoa peers looks pretty straightforward too.

Like anything else, we should be able to get 90% of this done pretty quickly. How quickly we get the last 10% depends a lot on how well we architected our solution. To that end, I do think we should orient our solution around Cocoa rather than Carbon.

Agreed on Cocoa; Carbon is a non-starter on 64-bit systems -- the SWT guys are now working on a Cocoa port.


I've committed a skeleton AWT Toolkit for Mac OS X, which is included in the default build:
j2se/src/solaris/classes/sun/awt/mac/CGToolkit.java
j2se/src/solaris/native/sun/awt/mac awt_CGToolkit.m


(Yes, solaris seems like an odd directory for this, but all Linux/BSD/ Solaris code is placed inside the j2se/src/solaris directory).

The AWT Toolkit can be used by setting awt.toolkit to sun.awt.mac.CGToolkit (ie, -Dawt.toolkit=sun.awt.mac.CGToolkit)

Currently, only Toolkit.beep() is implemented (but it's a very lovely beep). API docs:
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Toolkit.html


To build only AWT, you can cd to j2se/make/sun/awt and run:

make ALT_BOOTDIR=/System/Library/Frameworks/JavaVM.framework/Home \
ALT_MOTIF_DIR=/opt/local SYS_CFLAGS="" LANG="C" JAVA_HOME="" CLASSPATH="" \
LD_LIBRARY_PATH="" MAKEFLAGS="" SKIP_COMPARE_IMAGES="YES" \
BUILD_DEPLOY="false" ALT_DEVTOOLS_PATH=/usr ALT_CUPS_HEADERS_PATH=/usr/ include \
HOTSPOT_BUILD_JOBS=5 PARALLEL_BUILD_JOBS=5 ALT_HOTSPOT_CLIENT_PATH=/ usr/local/soylatte16-i386-r3/jre/lib/i386/client/ ALT_HOTSPOT_SERVER_PATH=/usr/local/soylatte16-i386-r3/jre/lib/i386/ server/


(Adjusting paths as necessary)

This will output a working JVM in j2se/build/bsd-i586. For the initial build, you make need to run make from top-level j2se/make directory.

Within the JDK sources you can find several toolkit implementation examples:
Windows:
j2se/src/windows/classes/sun/awt/windows/
j2se/src/windows/native/sun/windows/


X11 & Motif:
	j2se/src/solaris/classes/sun/awt
	j2se/src/solaris/native/sun/awt/


In the context of your listed technical challenges -- event dispatching, graphics performance -- here's what I'd like find answers to next;
- What is the right solution for getting a window on the screen, drawing something?
- Is it possible to leverage the existing OpenGL pipeline?


-landonf
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: BSD Java 6 Preview Release 2 (From: Emmanuel Puybaret <email@hidden>)
 >Re: BSD Java 6 Preview Release 2 (From: John Wallace <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.