--- old/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java 2014-01-10 14:54:45.336228639 +0400 +++ new/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java 2014-01-10 14:54:45.200228635 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ initIDs(); } - private native void run(String title, int mode, String dir, String file, + private native void run(long ownerWindow, String title, int mode, String dir, String file, FilenameFilter filter, boolean isMultipleMode, int x, int y); private native void quit(); @@ -152,6 +152,13 @@ } private void showNativeDialog() { + long ownerWindow = 0L; + + XWindowPeer ownerPeer = getOwnerPeer(); + if (ownerPeer != null) { + ownerWindow = ownerPeer.getWindow(); + } + String dirname = fd.getDirectory(); // File path has a priority against directory path. String filename = fd.getFile(); @@ -171,7 +178,7 @@ dirname = file.getParent(); } } - run(fd.getTitle(), fd.getMode(), dirname, filename, + run(ownerWindow, fd.getTitle(), fd.getMode(), dirname, filename, fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY()); } } --- old/src/solaris/native/sun/awt/gtk2_interface.c 2014-01-10 14:54:45.708228648 +0400 +++ new/src/solaris/native/sun/awt/gtk2_interface.c 2014-01-10 14:54:45.564228644 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -332,7 +332,6 @@ GtkWidget *child); static void (*fp_gtk_menu_item_set_submenu)(GtkMenuItem *menu_item, GtkWidget *submenu); -static void (*fp_gtk_widget_realize)(GtkWidget *widget); static GdkPixbuf* (*fp_gtk_widget_render_icon)(GtkWidget *widget, const gchar *stock_id, GtkIconSize size, const gchar *detail); static void (*fp_gtk_widget_set_name)(GtkWidget *widget, const gchar *name); @@ -789,6 +788,7 @@ fp_gdk_threads_enter = dl_symbol("gdk_threads_enter"); fp_gdk_threads_leave = dl_symbol("gdk_threads_leave"); + fp_gdk_x11_drawable_get_xid = dl_symbol("gdk_x11_drawable_get_xid"); /** * Functions for sun_awt_X11_GtkFileDialogPeer.c */ --- old/src/solaris/native/sun/awt/gtk2_interface.h 2014-01-10 14:54:46.120228659 +0400 +++ new/src/solaris/native/sun/awt/gtk2_interface.h 2014-01-10 14:54:45.980228655 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #include #include +#include #define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip) #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) @@ -777,6 +778,7 @@ int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf); int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf); GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error); +void (*fp_gtk_widget_realize)(GtkWidget *widget); void (*fp_gtk_widget_destroy)(GtkWidget *widget); void (*fp_gtk_window_present)(GtkWindow *window); void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y); @@ -830,6 +832,8 @@ void (*fp_gdk_threads_enter)(void); void (*fp_gdk_threads_leave)(void); +XID (*fp_gdk_x11_drawable_get_xid)(GdkDrawable *drawable); + gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error); --- old/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c 2014-01-10 14:54:46.528228669 +0400 +++ new/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c 2014-01-10 14:54:46.384228665 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ * questions. */ +#include #include #include #include @@ -32,6 +33,8 @@ #include "java_awt_FileDialog.h" #include "debug_assert.h" +extern Display *awt_display; + static JavaVM *jvm; /* To cache some method IDs */ @@ -288,6 +291,7 @@ */ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer, + jlong owner, jstring jtitle, jint mode, jstring jdir, jstring jfile, jobject jfilter, jboolean multiple, int x, int y) { @@ -370,6 +374,11 @@ (*env)->SetLongField(env, jpeer, widgetFieldID, ptr_to_jlong(dialog)); + if (owner && dialog) { + fp_gtk_widget_realize(dialog); + XSetTransientForHint(awt_display, fp_gdk_x11_drawable_get_xid(dialog->window), owner); + } + fp_gtk_widget_show(dialog); fp_gtk_main();