--- old/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java 2014-01-20 19:02:01.443224199 +0400 +++ new/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java 2014-01-20 19:02:01.307224200 +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 @@ -24,7 +24,8 @@ */ package sun.awt.X11; -import java.awt.FileDialog; +import java.awt.*; +import java.awt.event.ComponentEvent; import java.awt.peer.FileDialogPeer; import java.io.File; import java.io.FilenameFilter; @@ -52,8 +53,9 @@ 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 @@ -95,6 +97,38 @@ /** * Called exclusively by the native C code. */ + private void notifyConfigure(long window, int x, int y, int width, int height) { + XToolkit.awtLock(); + try { + Insets insets = XWM.getInsetsFromExtents(window); + if (insets == null) { + insets = new Insets(0,0,0,0); + } + + int resX = x - insets.left; + int resY = y - insets.top; + int resWidth = width + insets.left + insets.right; + int resHeight = height + insets.top + insets.bottom; + + Rectangle bounds = target.getBounds(); + + if (bounds.x != resX || bounds.y != resY) { + AWTAccessor.getComponentAccessor().setLocation(target, resX, resY); + postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED)); + } + + if (bounds.width != resWidth || bounds.height != resHeight) { + AWTAccessor.getComponentAccessor().setSize(target, resWidth, resHeight); + postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED)); + } + } finally { + XToolkit.awtUnlock(); + } + } + + /** + * Called exclusively by the native C code. + */ private boolean filenameFilterCallback(String fullname) { if (fd.getFilenameFilter() == null) { // no filter, accept all. @@ -152,6 +186,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 +212,8 @@ dirname = file.getParent(); } } - run(fd.getTitle(), fd.getMode(), dirname, filename, - fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY()); + + run(ownerWindow, fd.getTitle(), fd.getMode(), dirname, filename, + fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY()); } }