apple.awt.brushMetalLook support on OpenJDK7? - JNI solution?

Tobias Bley tobi at ultramixer.com
Mon Apr 23 02:58:06 PDT 2012


Thanks Hendrik, I know the report, voted and commented it ;)

But there is no acitvity since 5 month :( 

So I think about my own native solution in writing JNI code. My current problem is that with OpenJDK7 it's not possible to get the NSWindow from JavaWindow in Objective C code: The folling code only works on JDK6:

// Given a Java component, return an NSWindow*
NSWindow * GetWindowFromComponent(jobject parent, JNIEnv *env)
{
   JAWT awt;
   JAWT_DrawingSurface* ds;
   JAWT_DrawingSurfaceInfo* dsi;
   JAWT_MacOSXDrawingSurfaceInfo* dsi_mac;
   jboolean result;
   jint lock;

   // Get the AWT
   awt.version = JAWT_VERSION_1_4;
   result = JAWT_GetAWT(env, &awt);
   assert(result != JNI_FALSE);

   // Get the drawing surface
   ds = awt.GetDrawingSurface(env, parent);
   assert(ds != NULL);

   // Lock the drawing surface
   lock = ds->Lock(ds);
   assert((lock & JAWT_LOCK_ERROR) == 0);

   // Get the drawing surface info
   dsi = ds->GetDrawingSurfaceInfo(ds);

   // Get the platform-specific drawing info
   dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo;

   // Get the NSView corresponding to the component that was passed
   NSView *view = dsi_mac->cocoaViewRef;

   // Free the drawing surface info
   ds->FreeDrawingSurfaceInfo(dsi);
   // Unlock the drawing surface
   ds->Unlock(ds);

   // Free the drawing surface
   awt.FreeDrawingSurface(ds);

   // Get the view's parent window; this is what we need to show a sheet
   return [view window];
}



-- 
 Tobias Bley
 Chief Executive Officer

--------------------------------------------------------
 
 UltraMixer Digital Audio Solutions
 Schillerstraße  29
 D-01326 Dresden
 Germany

--------------------------------------------------------
 bley at ultramixer.com   http://www.ultramixer.com



Am 23.04.2012 um 11:30 schrieb Hendrik Schreiber <hs at tagtraum.com>:

> On Apr 23, 2012, at 11:18 AM, Tobias Bley wrote:
> 
>> it seams in current OpenJDK7 there is no support for Apples JDK6 property "apple.awt.brushMetalLook"? So we can not provide the same quality of GUI like with JDK6 :(
>> 
>> Is there any solution for OpenJDK7 to make textured windows?
>> 
>> I wrote a little JNI code to make a Java window a "textured window" but it doen't work with OpenJDK7 as well :(
>> 
>> Any suggestions?
> 
> There is a bug for this:
> 
> http://java.net/jira/browse/MACOSX_PORT-764
> Also see: http://lists.apple.com/archives/java-dev/2011/Dec/msg00008.html
> 
> Cheers,
> 
> -hendrik



More information about the macosx-port-dev mailing list