<AWT Dev> <Swing Dev> Bug 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros

Anthony Petrov Anthony.Petrov at Sun.COM
Mon Jan 11 07:11:18 PST 2010

Hi Costantino,

On 1/11/2010 1:15 AM Costantino Cerbo wrote:
> I'd like now to integrate it with the real OpenJDK codebase, but I've
> see that the GTK libraries aren't invoked through #include <gtk/gtk.h>
> but through "gtk2_interface.h" (in
> jdk7/mytl/jdk/src/solaris/native/sun/awt).
> That means, I should extend this header file to accept also the
> GtkFileChooser related functions that are in my
> native/src/GtkFileDialogPeer.c.
> Could you (or somebody else) please explain me, how to do that?

I guess that gtk2_interface.c at the same directory could help clarify that.

> Besides I have the following questions/comments:
> 1) Maybe should we write a new class sun.awt.X11.GtkFileDialogPeer
> instead of modify sun.awt.X11.XFileDialogPeer?
> The old XFileDialogPeer will be continued to be used in system without
> the GTK libraries. That means, we should modify
> sun.awt.X11.XToolkit#createFileDialog(FileDialog) to return
> GtkFileDialogPeer instead of XFileDialogPeer, if GTK is avalaible.
> By the way, how can we check in the JDK the presence of GTK? (I think,
> it's already done for the availability of the GTK L&F, but I could not
> find how).

That would be awesome. We certainly don't want to introduce a hard 
dependency on the presence of the GTK libraries to run Java programs.

> 2) java.awt.FileDialog supports only the selection of files but not of
> folders: Why don't we allow its method setMode(.) to accept also other
> values than LOAD (0) or SAVE (1). For example we could pass the value
> 2 to allow only the selection of folders? It's a minimal change that
> doesn't broke the existing API. On platforms where the new selection
> mode for folders isn't yet implemented, the behaviour should be the
> same as for the mode LOAD (0).

That better be addresses with a separate fix. Currently we don't have an 
implementation for that functionality on the MS Windows platform, so the 
fix would have to introduce both Windows and X11 versions.

> 3) I could compile the entire OpenJdk 7 without problem, but when I
> try to compile only the awt part, it fails with the error message in
> the attached file (error.log).

You can do incremental builds (i.e. running the make at make/sun/xawt or 
make/sun|java/awt) only after you have compiled the whole OpenJDK.

best regards,

More information about the awt-dev mailing list