<AWT Dev> Bug 6913179, FileDialog uses native GTK under Linux: first patch

Costantino Cerbo c.cerbo at gmail.com
Sun Jan 24 11:26:23 PST 2010

Hello Anthony,

2010/1/22 Anthony Petrov <Anthony.Petrov at sun.com>:
> Since you're working on an AWT fix, I suggest using the awt repository. The
> following command does the job for me:
> $ hg clone http://hg.openjdk.java.net/jdk7/awt/jdk

Yes! After cloning the awt repository (instead of the tl) I could
finally make an incremental build with success!
Maybe somebody should document it a little bit better on the OpenJdk
website. Anyway thanks a lot!

In this new patch I put into practice your previous comments:
  * GtkFileDialogPeer extends XDialogPeer and implements
FileDialogPeer instead of extending XFileDialogPeer
  * Limited visibility to private when necessary
  * setVisible(false) hide the dialog if called in different thread.
  * Code formatted according C and Sun java convention (with line
width 80 columns)
  * java_vm renamed to jvm
  * Function env() replaced by JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm,
  * Callbacks methods IDs cached in static variables
(filenameFilterCallbackMethodID, setFileInternalMethodID)
  * Check if GTK+ >= 2.4 before invoking gtk_file_chooser_load() or in

Then I solved also the remaining problems:
  * The dialog peer is disposed on close (I should also dispose the
original FileDialog)
  * The shortcut "Search" is available: I dynamically load also the
library "libgthread-2.0.so"

I also added to the UNIXToolkit a method to check the GTK+ Version.
It's used to enable the new FileDialog only when GTK+ >= 2.4 and it
may be also useful for the GTK L&F (for example from GTK 2.18 the most
buttons have no icon).

I've extensively manually tested the new FileDialog and haven't found
any bug: I think this patch is quit "production-ready".

I'm looking forward to hearing you feedback!

Best Regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b6913179-2.patch
Type: application/octet-stream
Size: 23815 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20100124/ea5bfdeb/b6913179-2.patch 

More information about the awt-dev mailing list