diff options
| author | Mark Wielaard <mark@gcc.gnu.org> | 2006-08-14 23:12:35 +0000 |
|---|---|---|
| committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-08-14 23:12:35 +0000 |
| commit | ac1ed908de999523efc36f38e69bca1aadfe0808 (patch) | |
| tree | 97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/java/awt/Window.java | |
| parent | abab460491408e05ea93fb85e1975296a87df504 (diff) | |
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
Diffstat (limited to 'libjava/classpath/java/awt/Window.java')
| -rw-r--r-- | libjava/classpath/java/awt/Window.java | 128 |
1 files changed, 58 insertions, 70 deletions
diff --git a/libjava/classpath/java/awt/Window.java b/libjava/classpath/java/awt/Window.java index 8bc4715aed5..8885821811d 100644 --- a/libjava/classpath/java/awt/Window.java +++ b/libjava/classpath/java/awt/Window.java @@ -39,8 +39,6 @@ exception statement from your version. */ package java.awt; import java.awt.event.ComponentEvent; -import java.awt.event.FocusEvent; -import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowFocusListener; import java.awt.event.WindowListener; @@ -80,6 +78,8 @@ public class Window extends Container implements Accessible private int state = 0; /** @since 1.4 */ private boolean focusableWindowState = true; + /** @since 1.5 */ + private boolean alwaysOnTop = false; // A list of other top-level windows owned by this window. private transient Vector ownedWindows = new Vector(); @@ -130,7 +130,6 @@ public class Window extends Container implements Accessible // cycle roots. focusCycleRoot = true; setLayout(new BorderLayout()); - addWindowFocusListener(); GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration(); @@ -142,67 +141,6 @@ public class Window extends Container implements Accessible graphicsConfiguration = gc; } - private void addWindowFocusListener() - { - addWindowFocusListener(new WindowAdapter() - { - public void windowGainedFocus(WindowEvent event) - { - EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); - if (windowFocusOwner != null) - { - synchronized (eq) - { - KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); - Component currentFocusOwner = manager.getGlobalPermanentFocusOwner(); - if (currentFocusOwner != null) - { - eq.postEvent(new FocusEvent(currentFocusOwner, - FocusEvent.FOCUS_LOST, false, - windowFocusOwner)); - eq.postEvent(new FocusEvent(windowFocusOwner, - FocusEvent.FOCUS_GAINED, false, - currentFocusOwner)); - } - else - eq.postEvent(new FocusEvent(windowFocusOwner, - FocusEvent.FOCUS_GAINED, false)); - } - } - else - eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_GAINED, - false)); - } - - public void windowLostFocus(WindowEvent event) - { - EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); - if (windowFocusOwner != null) - { - synchronized (eq) - { - KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); - Component currentFocusOwner = manager.getGlobalPermanentFocusOwner(); - if (currentFocusOwner != null) - { - eq.postEvent(new FocusEvent(currentFocusOwner, - FocusEvent.FOCUS_GAINED, false, - windowFocusOwner)); - eq.postEvent(new FocusEvent(windowFocusOwner, - FocusEvent.FOCUS_LOST, false, - currentFocusOwner)); - } - else - eq.postEvent(new FocusEvent(windowFocusOwner, - FocusEvent.FOCUS_LOST, false)); - } - } - else - eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_LOST, false)); - } - }); - } - /** * Initializes a new instance of <code>Window</code> with the specified * parent. The window will initially be invisible. @@ -420,13 +358,17 @@ public class Window extends Container implements Accessible /** * Sends this window to the back so that all other windows display in * front of it. + * + * If the window is set to be always-on-top, this will remove its + * always-on-top status. */ public void toBack() { if (peer != null) { - WindowPeer wp = (WindowPeer) peer; - wp.toBack(); + if( alwaysOnTop ) + setAlwaysOnTop( false ); + ( (WindowPeer) peer ).toBack(); } } @@ -437,10 +379,7 @@ public class Window extends Container implements Accessible public void toFront() { if (peer != null) - { - WindowPeer wp = (WindowPeer) peer; - wp.toFront(); - } + ( (WindowPeer) peer ).toFront(); } /** @@ -1236,6 +1175,55 @@ public class Window extends Container implements Accessible } /** + * Returns whether the Windows is an always-on-top window, + * meaning whether the window can be obscured by other windows or not. + * + * @return <code>true</code> if the windows is always-on-top, + * <code>false</code> otherwise. + * @since 1.5 + */ + public final boolean isAlwaysOnTop() + { + return alwaysOnTop; + } + + /** + * Sets the always-on-top state of this window (if supported). + * + * Setting a window to always-on-top means it will not be obscured + * by any other windows (with the exception of other always-on-top + * windows). Not all platforms may support this. + * + * If an window's always-on-top status is changed to false, the window + * will remain at the front but not be anchored there. + * + * Calling toBack() on an always-on-top window will change its + * always-on-top status to false. + * + * @since 1.5 + */ + public final void setAlwaysOnTop(boolean alwaysOnTop) + { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission( new AWTPermission("setWindowAlwaysOnTop") ); + + if( this.alwaysOnTop == alwaysOnTop ) + return; + + if( alwaysOnTop ) + toFront(); + + firePropertyChange("alwaysOnTop", this.alwaysOnTop, alwaysOnTop ); + this.alwaysOnTop = alwaysOnTop; + + if (peer != null) + ( (WindowPeer) peer).updateAlwaysOnTop(); + else + System.out.println("Null peer?!"); + } + + /** * Generate a unique name for this window. * * @return A unique name for this window. |
