/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
implements WindowClosingSupport, WindowClosingListener,
// 8014736: logging has been removed from SunToolkit
/* Load debug settings for native code */
static {
}
};
/**
* Special mask for the UngrabEvent events, in addition to the
* public masks defined in AWTEvent. Should be used as the mask
* value for Toolkit.addAWTEventListener.
*/
*/
/**
* Number of buttons.
* By default it's taken from the system. If system value does not
* fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
*/
/* XFree standard mention 24 buttons as maximum:
* We workaround systems supporting more than 24 buttons.
* Otherwise, we have to use long type values as masks
* which leads to API change.
* InputEvent.BUTTON_DOWN_MASK may contain only 21 masks due to
* the 4-bytes limit for the int type. (CR 6799099)
* One more bit is reserved for FIRST_HIGH_BIT.
*/
/**
* Creates and initializes EventQueue instance for the specified
* AppContext.
* Note that event queue must be created from createNewAppContext()
* only in order to ensure that EventQueue constructor obtains
* the correct AppContext.
* @param appContext AppContext to associate with the event queue
*/
"java.awt.EventQueue");
try {
} catch (Exception e) {
e.printStackTrace();
eventQueue = new EventQueue();
}
}
public SunToolkit() {
}
public boolean useBufferPerWindow() {
return false;
}
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws HeadlessException;
throws InvalidDnDOperationException;
throws HeadlessException, AWTException;
public abstract boolean isTraySupported();
throws AWTException;
throws HeadlessException;
/**
* The AWT lock is typically only used on Unix platforms to synchronize
* access to Xlib, OpenGL, etc. However, these methods are implemented
* in SunToolkit so that they can be called from shared code (e.g.
* from the OGL pipeline) or from the X11 pipeline regardless of whether
* XToolkit or MToolkit is currently in use. There are native macros
* (such as AWT_LOCK) defined in awt.h, so if the implementation of these
* methods is changed, make sure it is compatible with the native macros.
*
* Note: The following methods (awtLock(), awtUnlock(), etc) should be
* used in place of:
* synchronized (getAWTLock()) {
* ...
* }
*
* By factoring these methods out specially, we are able to change the
* implementation of these methods (e.g. use more advanced locking
* mechanisms) without impacting calling code.
*
* Sample usage:
* private void doStuffWithXlib() {
* assert !SunToolkit.isAWTLockHeldByCurrentThread();
* SunToolkit.awtLock();
* try {
* ...
* XlibWrapper.XDoStuff();
* } finally {
* SunToolkit.awtUnlock();
* }
* }
*/
public static final void awtLock() {
}
public static final boolean awtTryLock() {
}
public static final void awtUnlock() {
}
public static final void awtLockWait()
throws InterruptedException
{
}
throws InterruptedException
{
}
public static final void awtLockNotify() {
}
public static final void awtLockNotifyAll() {
}
public static final boolean isAWTLockHeldByCurrentThread() {
return AWT_LOCK.isHeldByCurrentThread();
}
/*
* Create a new AppContext, along with its EventQueue, for a
* new ThreadGroup. Browser code, for example, would use this
* method to create an AppContext & EventQueue for an Applet.
*/
return createNewAppContext(threadGroup);
}
// Create appContext before initialization of EventQueue, so all
// the calls to AppContext.getAppContext() from EventQueue ctor
// return correct values
return appContext;
}
}
/*
* Fetch the peer associated with the given target (as specified
* in the peer creation method). This can be used to determine
* things like what the parent peer is. If the target is null
* or the target can't be found (either because the a peer was
* never created for it or the peer was disposed), a null will
* be returned.
*/
}
return null;
}
{
}
}
{
}
}
// Maps from non-Component/MenuComponent to AppContext.
// WeakHashMap<Component,AppContext>
/**
* Sets the appContext field of target. If target is not a Component or
* MenuComponent, this returns false.
*/
} else if (target instanceof MenuComponent) {
} else {
return false;
}
return true;
}
/**
* Returns the appContext field for target. If target is not a
* Component or MenuComponent this returns null.
*/
return AWTAccessor.getComponentAccessor().
} else if (target instanceof MenuComponent) {
return AWTAccessor.getMenuComponentAccessor().
} else {
return null;
}
}
/*
* Fetch the AppContext associated with the given target.
* This can be used to determine things like which EventQueue
* to use for posting events to a Component. If the target is
* null or the target can't be found, a null with be returned.
*/
return null;
}
// target is not a Component/MenuComponent, try the
// appContextMap.
}
return context;
}
/**
* Sets the synchronous status of focus requests on lightweight
* components in the specified window to the specified value.
* If the boolean parameter is <code>true</code> then the focus
* requests on lightweight components will be performed
* synchronously, if it is <code>false</code>, then asynchronously.
* By default, all windows have their lightweight request status
* set to asynchronous.
* <p>
* The application can only set the status of lightweight focus
* requests to synchronous for any of its windows if it doesn't
* perform focus transfers between different heavyweight containers.
* In this case the observable focus behaviour is the same as with
* asynchronous status.
* <p>
* If the application performs focus transfer between different
* heavyweight containers and sets the lightweight focus request
* status to synchronous for any of its windows, then further focus
* behaviour is unspecified.
* <p>
* @param w window for which the lightweight focus request status
* should be set
* @param status the value of lightweight focus request status
*/
};
}
try {
}
catch (ClassNotFoundException e) {
assert false;
}
catch (InstantiationException e) {
assert false;
}
catch (IllegalAccessException e) {
assert false;
}
return policy;
}
/*
* Insert a mapping from target to AppContext, for later retrieval
* via targetToAppContext() above.
*/
if (!GraphicsEnvironment.isHeadless()) {
// Target is not a Component/MenuComponent, use the private Map
// instead.
}
}
}
/*
* Post an AWTEvent to the Java EventQueue, using the PostEventQueue
* to avoid possibly calling client code (EventQueueSubclass.postEvent())
* on the toolkit (AWT-Windows/AWT-Motif) thread. This function should
* not be called under another lock since it locks the EventQueue.
* See bugids 4632918, 4526597.
*/
throw new NullPointerException();
}
nested instanceof TimedWindowEvent)
{
}
}
// All events posted via this method are system-generated.
// Placing the following call here reduces considerably the
// number of places throughout the toolkit that would
// otherwise have to be modified to precisely identify
// system-generated events.
if (postEventQueue != null) {
}
}
/*
* Post AWTEvent of high priority.
*/
public void run() {
}
}
private static boolean isFlushingPendingEvents = false;
/*
* Flush any pending events which haven't been posted to the AWT
* EventQueue yet.
*/
public static void flushPendingEvents() {
}
try {
// Don't call flushPendingEvents() recursively
if (!isFlushingPendingEvents) {
isFlushingPendingEvents = true;
try {
if (postEventQueue != null) {
}
}
finally {
isFlushingPendingEvents = false;
}
}
} finally {
}
}
public static boolean isPostEventQueueEmpty() {
if (postEventQueue != null) {
return postEventQueue.noEvents();
} else {
return true;
}
}
/*
* Execute a chunk of code on the Java event handler thread for the
* given target. Does not wait for the execution to occur before
* returning to the caller.
*/
}
/*
* Fixed 5064013: the InvocationEvent time should be equals
* the time of the ActionEvent
*/
final long when) {
public long getWhen(){
return when;
}
});
}
/*
* Execute a chunk of code on the Java event handler thread for the
* given target. Does not wait for the execution to occur before
* returning to the caller.
*/
}
/*
* Execute a chunk of code on the Java event handler thread. The
* method takes into account provided AppContext and sets
* <code>SunToolkit.getDefaultToolkit()</code> as a target of the
* event. See 6451487 for detailes.
* Does not wait for the execution to occur before returning to
* the caller.
*/
public static void invokeLaterOnAppContext(
{
}
/*
* Execute a chunk of code on the Java event handler thread for the
* given target. Waits for the execution to occur before returning
* to the caller.
*/
{
if (EventQueue.isDispatchThread()) {
throw new Error("Cannot call executeOnEDTAndWait from any event dispatcher thread");
}
class AWTInvocationLock {}
synchronized (lock) {
while(!event.isDispatched()) {
}
}
if (eventThrowable != null) {
throw new InvocationTargetException(eventThrowable);
}
}
/*
* Returns true if the calling thread is the event dispatch thread
* contained within AppContext which associated with the given target.
* Use this call to ensure that a given task is being executed
* (or not being) on the event dispatch thread for the given target.
*/
}
}
protected abstract int getScreenWidth();
protected abstract int getScreenHeight();
}
String[] hardwiredFontList = {
// -- Obsolete font names from 1.0.2. It was decided that
// -- getFontList should not return these old names:
// "Helvetica", "TimesRoman", "Courier", "ZapfDingbats"
};
return hardwiredFontList;
}
}
}
/**
* Disables erasing of background on the canvas before painting if
* this is supported by the current toolkit. It is recommended to
* call this method early, before the Canvas becomes displayable,
* because some Toolkit implementations do not support changing
* this property once the Canvas becomes displayable.
*/
}
/**
* Disables the native erasing of the background on the given
* component before painting if this is supported by the current
* toolkit. This only has an effect for certain components such as
* Canvas, Panel and Window. It is recommended to call this method
* early, before the Component becomes displayable, because some
* Toolkit implementations do not support changing this property
* once the Component becomes displayable.
*/
}
}
/**
* Returns the value of "sun.awt.noerasebackground" property. Default
* value is {@code false}.
*/
public static boolean getSunAwtNoerasebackground() {
}
/**
* Returns the value of "sun.awt.erasebackgroundonresize" property. Default
* value is {@code false}.
*/
public static boolean getSunAwtErasebackgroundonresize() {
}
try {
try {
} catch (SecurityException se) {
// fallback to checkRead/checkConnect for pre 1.2
// security managers
} else if ((perm instanceof
} else {
throw se;
}
}
}
}
}
synchronized (imgCache) {
try {
} catch (Exception e) {
}
}
return img;
}
}
}
synchronized (imgCache) {
try {
} catch (Exception e) {
}
}
return img;
}
}
return getImageFromHash(this, filename);
}
return getImageFromHash(this, url);
}
}
}
try {
try {
} catch (SecurityException se) {
// fallback to checkRead/checkConnect for pre 1.2
// security managers
} else if ((perm instanceof
} else {
throw se;
}
}
}
}
}
}
}
return new ToolkitImage(producer);
}
if (!(img instanceof ToolkitImage)) {
return ImageObserver.ALLBITS;
}
int repbits;
if (w == 0 || h == 0) {
} else {
}
}
if (w == 0 || h == 0) {
return true;
}
// Must be a ToolkitImage
if (!(img instanceof ToolkitImage)) {
return true;
}
if (o != null) {
-1, -1, -1, -1);
}
return false;
}
}
/**
* Scans {@code imageList} for best-looking image of specified dimensions.
*/
public static BufferedImage getScaledIconImage(java.util.List<Image> imageList, int width, int height) {
return null;
}
int bestWidth = 0;
int bestHeight = 0;
double bestScaleFactor = 0;
//Iterate imageList looking for best matching image.
//'Similarity' measure is defined as good scale factor and small insets.
//best possible similarity is 0 (no scale, no insets).
//It's found while the experiments that good-looking result is achieved
//with scale factors x1, x3/4, x2/3, xN, x1/N.
continue;
}
if (im instanceof ToolkitImage) {
}
int iw;
int ih;
try {
} catch (Exception e){
continue;
}
//Calc scale factor
//Calculate scaled image dimensions
//adjusting scale factor to nearest "good" value
int adjw = 0;
int adjh = 0;
if (scaleFactor >= 2) {
//Need to enlarge image more than twice
//Round down scale factor to multiply by integer value
} else if (scaleFactor >= 1) {
//Don't scale
scaleFactor = 1.0;
scaleMeasure = 0;
} else if (scaleFactor >= 0.75) {
//Multiply by 3/4
scaleFactor = 0.75;
scaleMeasure = 0.3;
} else if (scaleFactor >= 0.6666) {
//Multiply by 2/3
scaleFactor = 0.6666;
scaleMeasure = 0.33;
} else {
//Multiply size by 1/scaleDivider
//where scaleDivider is minimum possible integer
//larger than 1/scaleFactor
}
scaleMeasure; //Large rescale is bad
if (similarity < bestSimilarity) {
bestHeight = adjh;
}
if (similarity == 0) break;
}
}
//No images were found, possibly all are broken
return null;
}
try {
} finally {
g.dispose();
}
return bimage;
}
public static DataBufferInt getScaledIconData(java.util.List<Image> imageList, int width, int height) {
return null;
}
return (DataBufferInt)buffer;
}
return getSystemEventQueueImplPP();
}
// Package private implementation
}
return theEventQueue;
}
/**
* Give native peers the ability to query the native container
* given a native component (eg the direct parent may be lightweight).
*/
return Toolkit.getNativeContainer(c);
}
/**
* Gives native peers the ability to query the closest HW component.
* If the given component is heavyweight, then it returns this. Otherwise,
* it goes one level up in the hierarchy and tests next component.
*/
}
return c;
}
/**
* Returns key modifiers used by Swing to set up a focus accelerator key stroke.
*/
public int getFocusAcceleratorKeyMask() {
return InputEvent.ALT_MASK;
}
/**
* Tests whether specified key modifiers mask can be used to enter a printable
* character. This is a default implementation of this method, which reflects
* the way things work on Windows: here, pressing ctrl + alt allows user to enter
* characters from the extended character set (like euro sign or math symbols)
*/
}
/**
* Returns whether popup is allowed to be shown above the task bar.
* This is a default implementation of this method, which checks
* corresponding security permission.
*/
public boolean canPopupOverlapTaskBar() {
boolean result = true;
try {
}
} catch (SecurityException se) {
// There is no permission to show popups over the task bar
result = false;
}
return result;
}
/**
* Returns a new input method window, with behavior as specified in
* {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
* If the inputContext is not null, the window should return it from its
* getInputContext() method. The window needs to implement
* sun.awt.im.InputMethodWindow.
* <p>
* SunToolkit subclasses can override this method to return better input
* method windows.
*/
}
/**
* Returns whether enableInputMethods should be set to true for peered
* TextComponent instances on this platform. False by default.
*/
public boolean enableInputMethodsForTextComponent() {
return false;
}
/**
* Returns the locale in which the runtime was started.
*/
if (startupLocale == null) {
// for compatibility, check for old user.region property
new GetPropertyAction("user.region"));
// region can be of form country, country_variant, or _variant
if (i >= 0) {
} else {
variant = "";
}
} else {
}
}
return startupLocale;
}
/**
* Returns the default keyboard locale of the underlying operating system
*/
return getStartupLocale();
}
}
if (dataTransfererClassName == null) {
}
return dataTransfererClassName;
}
// Support for window closing event notifications
/**
* @see sun.awt.WindowClosingSupport#getWindowClosingListener
*/
return windowClosingListener;
}
/**
* @see sun.awt.WindowClosingSupport#setWindowClosingListener
*/
}
/**
* @see sun.awt.WindowClosingListener#windowClosingNotify
*/
if (windowClosingListener != null) {
} else {
return null;
}
}
/**
* @see sun.awt.WindowClosingListener#windowClosingDelivered
*/
if (windowClosingListener != null) {
} else {
return null;
}
}
mPeer = new DefaultMouseInfoPeer();
}
return mPeer;
}
/**
* Returns whether default toolkit needs the support of the xembed
* from embedding host(if any).
* @return <code>true</code>, if XEmbed is needed, <code>false</code> otherwise
*/
public static boolean needsXEmbed() {
return false;
}
if (tk instanceof SunToolkit) {
// SunToolkit descendants should override this method to specify
// concrete behavior
} else {
// Non-SunToolkit doubtly might support XEmbed
return false;
}
}
/**
* Returns whether this toolkit needs the support of the xembed
* from embedding host(if any).
* @return <code>true</code>, if XEmbed is needed, <code>false</code> otherwise
*/
protected boolean needsXEmbedImpl() {
return false;
}
/**
* Returns whether the XEmbed server feature is requested by
* developer. If true, Toolkit should return an
* XEmbed-server-enabled CanvasPeer instead of the ordinary CanvasPeer.
*/
protected final boolean isXEmbedServerRequested() {
}
/**
* Returns whether the modal exclusion API is supported by the current toolkit.
* When it isn't supported, calling <code>setModalExcluded</code> has no
* effect, and <code>isModalExcluded</code> returns false for all windows.
*
* @return true if modal exclusion is supported by the toolkit, false otherwise
*
* @see sun.awt.SunToolkit#setModalExcluded(java.awt.Window)
* @see sun.awt.SunToolkit#isModalExcluded(java.awt.Window)
*
* @since 1.5
*/
public static boolean isModalExcludedSupported()
{
}
/*
* Default implementation for isModalExcludedSupportedImpl(), returns false.
*
* @see sun.awt.windows.WToolkit#isModalExcludeSupportedImpl
* @see sun.awt.X11.XToolkit#isModalExcludeSupportedImpl
*
* @since 1.5
*/
protected boolean isModalExcludedSupportedImpl()
{
return false;
}
/*
* Sets this window to be excluded from being modally blocked. When the
* toolkit supports modal exclusion and this method is called, input
* events, focus transfer and z-order will continue to work for the
* window, it's owned windows and child components, even in the
* presence of a modal dialog.
* For details on which <code>Window</code>s are normally blocked
* by modal dialog, see {@link java.awt.Dialog}.
* Invoking this method when the modal exclusion API is not supported by
* the current toolkit has no effect.
* @param window Window to be marked as not modally blocked
* @see java.awt.Dialog
* @see java.awt.Dialog#setModal(boolean)
* @see sun.awt.SunToolkit#isModalExcludedSupported
* @see sun.awt.SunToolkit#isModalExcluded(java.awt.Window)
*/
{
if (DEFAULT_MODAL_EXCLUSION_TYPE == null) {
}
}
/*
* Returns whether the specified window is blocked by modal dialogs.
* If the modal exclusion API isn't supported by the current toolkit,
* it returns false for all windows.
*
* @param window Window to test for modal exclusion
*
* @return true if the window is modal excluded, false otherwise. If
* the modal exclusion isn't supported by the current Toolkit, false
* is returned
*
* @see sun.awt.SunToolkit#isModalExcludedSupported
* @see sun.awt.SunToolkit#setModalExcluded(java.awt.Window)
*
* @since 1.5
*/
{
if (DEFAULT_MODAL_EXCLUSION_TYPE == null) {
}
}
/**
* Overridden in XToolkit and WToolkit
*/
}
/**
* Overridden in XToolkit and WToolkit
*/
}
///////////////////////////////////////////////////////////////////////////
//
// The following is used by the Java Plug-in to coordinate dialog modality
// between containing applications (browsers, ActiveX containers etc) and
// the AWT.
//
///////////////////////////////////////////////////////////////////////////
}
}
}
}
}
}
}
}
}
}
}
} // end of class ModalityListenerList
///////////////////////////////////////////////////////////////////////////
// End Plug-in code
///////////////////////////////////////////////////////////////////////////
if (comp.isLightweight()
|| !(getDefaultToolkit() instanceof SunToolkit))
{
return true;
}
|| comp instanceof ScrollPane
}
super(msg);
}
public OperationTimedOut() {
}
}
}
super(msg);
}
public IllegalThreadException() {
}
}
/**
* Parameterless version of realsync which uses default timout (see DEFAUL_WAIT_TIME).
*/
}
/**
* Forces toolkit to synchronize with the native windowing
* sub-system, flushing all pending work and waiting for all the
* events to be processed. This method guarantees that after
* return no additional Java events will be generated, unless
* cause by user. Obviously, the method cannot be used on the
* event dispatch thread (EDT). In case it nevertheless gets
* invoked on this thread, the method throws the
* IllegalThreadException runtime exception.
*
* <p> This method allows to write tests without explicit timeouts
* or wait for some event. Example:
* <code>
* Frame f = ...;
* f.setVisible(true);
* ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
* </code>
*
* <p> After realSync, <code>f</code> will be completely visible
* on the screen, its getLocationOnScreen will be returning the
* right result and it will be the focus owner.
*
* <p> Another example:
* <code>
* b.requestFocus();
* ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
* </code>
*
* <p> After realSync, <code>b</code> will be focus owner.
*
* <p> Notice that realSync isn't guaranteed to work if recurring
* actions occur, such as if during processing of some event
* another request which may generate some events occurs. By
* default, sync tries to perform as much as {@value MAX_ITERS}
* cycles of event processing, allowing for roughly {@value
* MAX_ITERS} additional requests.
*
* <p> For example, requestFocus() generates native request, which
* generates one or two Java focus events, which then generate a
* serie of paint events, a serie of Java focus events, which then
* generate a serie of paint events which then are processed -
* three cycles, minimum.
*
* @param timeout the maximum time to wait in milliseconds, negative means "forever".
*/
{
if (EventQueue.isDispatchThread()) {
throw new IllegalThreadException("The SunToolkit.realSync() method cannot be used on the event dispatch thread (EDT).");
}
int bigLoop = 0;
do {
// Let's do sync first
sync();
// During the wait process, when we were processing incoming
// events, we could have made some new request, which can
// generate new events. Example: MapNotify/XSetInputFocus.
// Therefore, we dispatch them as long as there is something
// to dispatch.
int iters = 0;
iters++;
}
iters++;
}
throw new InfiniteLoop();
}
// Moreover, we processed them all on Toolkit thread
// Now wait while EDT processes them.
//
// During processing of some events (focus, for example),
// some other events could have been generated. So, after
// waitForIdle, we may end up with full EventQueue
iters = 0;
iters++;
}
iters++;
}
throw new InfiniteLoop();
}
bigLoop++;
// Again, for Java events, it was simple to check for new Java
// events by checking event queue, but what if Java events
// resulted in native requests? Therefor, check native events again.
}
/**
* Platform toolkits need to implement this method to perform the
* sync of the native queue. The method should wait until native
* requests are processed, all native events are processed and
* corresponding Java events are generated. Should return
* <code>true</code> if some events were processed,
* <code>false</code> otherwise.
*/
private boolean eventDispatched = false;
private boolean queueEmpty = false;
private boolean isEQEmpty() {
}
/**
* Waits for the Java event queue to empty. Ensures that all
* events are processed (including paint events), and that if
* recursive events were generated, they are also processed.
* Should return <code>true</code> if more processing is
* necessary, <code>false</code> otherwise.
*/
boolean queueWasEmpty = isEQEmpty();
queueEmpty = false;
eventDispatched = false;
synchronized(waitLock) {
public void dispatch() {
// Here we block EDT. It could have some
// events, it should have dispatched them by
// now. So native requests could have been
// generated. First, dispatch them. Then,
// flush Java events again.
int iters = 0;
iters++;
}
iters++;
}
synchronized(waitLock) {
queueEmpty = isEQEmpty();
eventDispatched = true;
}
}
});
try {
while (!eventDispatched) {
}
} catch (InterruptedException ie) {
return false;
}
}
try {
} catch (InterruptedException ie) {
throw new RuntimeException("Interrupted");
}
// Lock to force write-cache flush for queueEmpty.
synchronized (waitLock) {
}
}
/**
* Grabs the mouse input for the given window. The window must be
* visible. The window or its children do not receive any
* additional mouse events besides those targeted to them. All
* other events will be dispatched as before - to the respective
* targets. This Window will receive UngrabEvent when automatic
* ungrab is about to happen. The event can be listened to by
* installing AWTEventListener with WINDOW_EVENT_MASK. See
* UngrabEvent class for the list of conditions when ungrab is
* about to happen.
* @see UngrabEvent
*/
/**
* Forces ungrab. No event will be sent.
*/
/**
* Locates the splash screen library in a platform dependent way and closes
* the splash screen. Should be invoked on first top-level frame display.
* @see java.awt.SplashScreen
* @since 1.6
*/
public static native void closeSplashScreen();
/* The following methods and variables are to support retrieving
* desktop text anti-aliasing settings
*/
/* Need an instance method because setDesktopProperty(..) is protected. */
private void fireDesktopFontPropertyChanges() {
}
private static boolean checkedSystemAAFontSettings;
private static boolean useSystemAAFontSettings;
private static boolean lastExtraCondition = true;
/* Since Swing is the reason for this "extra condition" logic its
* worth documenting it in some detail.
* First, a goal is for Swing and applications to both retrieve and
* use the same desktop property value so that there is complete
* consistency between the settings used by JDK's Swing implementation
* and 3rd party custom Swing components, custom L&Fs and any general
* text rendering that wants to be consistent with these.
* But by default on Solaris & Linux Swing will not use AA text over
* remote X11 display (unless Xrender can be used which is TBD and may not
* always be available anyway) as that is a noticeable performance hit.
* So there needs to be a way to express that extra condition so that
* it is seen by all clients of the desktop property API.
* If this were the only condition it could be handled here as it would
* be the same for any L&F and could reasonably be considered to be
* a static behaviour of those systems.
* But GTK currently has an additional test based on locale which is
* not applied by Metal. So mixing GTK in a few locales with Metal
* would mean the last one wins.
* This could be stored per-app context which would work
* for different applets, but wouldn't help for a single application
* using GTK and some other L&F concurrently.
* But it is expected this will be addressed within GTK and the font
* system so is a temporary and somewhat unlikely harmless corner case.
*/
if (extraCondition != lastExtraCondition) {
if (checkedSystemAAFontSettings) {
/* Someone already asked for this info, under a different
* condition.
* We'll force re-evaluation instead of replicating the
* logic, then notify any listeners of any change.
*/
checkedSystemAAFontSettings = false;
if (tk instanceof SunToolkit) {
}
}
}
}
/* "false", "off", ""default" aren't explicitly tested, they
* just fall through to produce a null return which all are equated to
* "false".
*/
}
return map;
} else {
return null;
}
}
/* This method determines whether to use the system font settings,
* or ignore them if a L&F has specified they should be ignored, or
* to override both of these with a system property specified value.
* If the toolkit isn't a SunToolkit, (eg may be headless) then that
* system property isn't applied as desktop properties are considered
* to be inapplicable in that case. In that headless case although
* this method will return "true" the toolkit will return a null map.
*/
private static boolean useSystemAAFontSettings() {
if (!checkedSystemAAFontSettings) {
useSystemAAFontSettings = true; /* initially set this true */
if (tk instanceof SunToolkit) {
new GetPropertyAction("awt.useSystemAAFontSettings"));
}
if (systemAAFonts != null) {
/* If it is anything other than "true", then it may be
* a hint name , or it may be "off, "default", etc.
*/
if (!useSystemAAFontSettings) {
}
}
/* If its still true, apply the extra condition */
if (useSystemAAFontSettings) {
}
checkedSystemAAFontSettings = true;
}
return useSystemAAFontSettings;
}
/* A variable defined for the convenience of JDK code */
return null;
}
/* Subclass desktop property loading methods call this which
* in turn calls the appropriate subclass implementation of
* getDesktopAAHints() when system settings are being used.
* Its public rather than protected because subclasses may delegate
* to a helper class.
*/
if (useSystemAAFontSettings()) {
if (tk instanceof SunToolkit) {
return (RenderingHints)map;
} else { /* Headless Toolkit */
return null;
}
} else if (desktopFontHints != null) {
/* cloning not necessary as the return value is cloned later, but
* its harmless.
*/
} else {
return null;
}
}
public abstract boolean isDesktopSupported();
/*
* consumeNextKeyTyped() method is not currently used,
* however Swing could use it in the future.
*/
try {
keyEvent);
} catch (ClassCastException cce) {
}
}
}
/**
* Returns the <code>Window</code> ancestor of the component <code>comp</code>.
* @return Window ancestor of the component or component by itself if it is Window;
* null, if component is not a part of window hierarchy
*/
}
}
/**
* Returns the value of "sun.awt.disableMixing" property. Default
* value is {@code false}.
*/
public synchronized static boolean getSunAwtDisableMixing() {
if (sunAwtDisableMixing == null) {
new GetBooleanAction("sun.awt.disableMixing"));
}
return sunAwtDisableMixing.booleanValue();
}
/**
* Returns true if the native GTK libraries are available. The
* default implementation returns false, but UNIXToolkit overrides this
* method to provide a more specific answer.
*/
public boolean isNativeGTKAvailable() {
return false;
}
}
}
return -1;
}
}
// Cosntant alpha
public boolean isWindowOpacitySupported() {
return false;
}
// Shaping
public boolean isWindowShapingSupported() {
return false;
}
// Per-pixel alpha
public boolean isWindowTranslucencySupported() {
return false;
}
return false;
}
/**
* Returns true if swing backbuffer should be translucent.
*/
public boolean isSwingBackbufferTranslucencySupported() {
return false;
}
/**
* Returns whether or not a containing top level window for the passed
* component is
* {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}.
*
* @param c a Component which toplevel's to check
* @return {@code true} if the passed component is not null and has a
* containing toplevel window which is opaque (so per-pixel translucency
* is not enabled), {@code false} otherwise
* @see GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
*/
Window w = getContainingWindow(c);
}
/**
* Returns whether or not a containing top level window for the passed
* component is
* {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}.
*
* @param c a Component which toplevel's to check
* @return {@code true} if the passed component is not null and has a
* containing toplevel window which has opacity less than
* 1.0f (which means that it is translucent), {@code false} otherwise
* @see GraphicsDevice.WindowTranslucency#TRANSLUCENT
*/
Window w = getContainingWindow(c);
}
/**
* Returns whether the native system requires using the peer.updateWindow()
* method to update the contents of a non-opaque window, or if usual
* painting procedures are sufficient. The default return value covers
* the X11 systems. On MS Windows this method is overriden in WToolkit
* to return true.
*/
public boolean needUpdateWindow() {
return false;
}
/**
* Descendants of the SunToolkit should override and put their own logic here.
*/
public int getNumberOfButtons(){
return 3;
}
/**
* Checks that the given object implements/extends the given
*
* Note that using the instanceof operator causes a class to be loaded.
* Using this method doesn't load a class and it can be used instead of
* the instanceof operator for performance reasons.
*
* @param obj Object to be checked
* @return true, if this object implements/extends the given
*/
}
return true;
}
return true;
}
}
}
///////////////////////////////////////////////////////////////////////////
//
// The following methods help set and identify whether a particular
// AWTEvent object was produced by the system or by user code. As of this
// writing the only consumer is the Java Plug-In, although this information
// could be useful to more clients and probably should be formalized in
// the public API.
//
///////////////////////////////////////////////////////////////////////////
}
}
} // class SunToolkit
/*
* PostEventQueue is a Thread that runs in the same AppContext as the
* Java EventQueue. It is a queue of AWTEvents to be posted to the
* Java EventQueue. The toolkit Thread (AWT-Windows/AWT-Motif) posts
* events to this queue, which then calls EventQueue.postEvent().
*
* We do this because EventQueue.postEvent() may be overridden by client
* code, and we mustn't ever call client code from the toolkit thread.
*/
class PostEventQueue {
// For the case when queue is cleared but events are not posted
private volatile boolean isFlushing = false;
eventQueue = eq;
}
public synchronized boolean noEvents() {
}
/*
* Continually post pending AWTEvents to the Java EventQueue. The method
* is synchronized to ensure the flush is completed before a new event
* can be posted to this queue.
*
* 7177040: The method couldn't be wholly synchronized because of calls
* of EventQueue.postEvent() that uses pushPopLock, otherwise it could
* potentially lead to deadlock
*/
public void flush() {
synchronized (this) {
}
try {
}
}
finally {
isFlushing = false;
}
}
/*
* Enqueue an AWTEvent to be posted to the Java EventQueue.
*/
synchronized (this) {
} else {
}
}
}
} // class PostEventQueue