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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2010, 2013, 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 --- 1,7 ---- /* ! * 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
*** 22,32 **** * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.awt.X11; ! import java.awt.FileDialog; import java.awt.peer.FileDialogPeer; import java.io.File; import java.io.FilenameFilter; import sun.awt.AWTAccessor; --- 22,33 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.awt.X11; ! import java.awt.*; ! import java.awt.event.ComponentEvent; import java.awt.peer.FileDialogPeer; import java.io.File; import java.io.FilenameFilter; import sun.awt.AWTAccessor;
*** 50,61 **** private static native void initIDs(); static { initIDs(); } ! private native void run(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(); --- 51,63 ---- private static native void initIDs(); static { initIDs(); } ! 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();
*** 93,102 **** --- 95,136 ---- } /** * 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. return true; }
*** 150,159 **** --- 184,200 ---- // 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,177 **** filename = file.getName(); // Directory path for gtk_file_chooser_set_current_folder. dirname = file.getParent(); } } ! run(fd.getTitle(), fd.getMode(), dirname, filename, fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY()); } } --- 210,219 ---- filename = file.getName(); // Directory path for gtk_file_chooser_set_current_folder. dirname = file.getParent(); } } ! ! run(ownerWindow, fd.getTitle(), fd.getMode(), dirname, filename, fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY()); } }