src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -50,11 +50,11 @@
     private static native void initIDs();
     static {
         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();
 
     @Override
     public native void toFront();

@@ -150,10 +150,17 @@
         // We do not implement this method because we
         // have delegated to FileDialog#setFilenameFilter
     }
 
     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();
         if (filename != null) {
             final File file = new File(filename);

@@ -169,9 +176,9 @@
                 filename = file.getName();
                 // Directory path for gtk_file_chooser_set_current_folder.
                 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());
     }
 }