APIdia Launch Partner
Top Inners Fields Constructors Methods
sun.awt

public abstract Class UNIXToolkit

extends SunToolkit
Class Inheritance
Known Direct Subclasses
sun.awt.X11.XToolkit
Imports
java.awt.RenderingHints, .Window, java.awt.color.ColorSpace, java.awt.event.WindowAdapter, .WindowEvent, .WindowFocusListener, java.awt.image.BufferedImage, .ColorModel, .ComponentColorModel, .DataBuffer, .DataBufferByte, .Raster, .WritableRaster, java.io.BufferedReader, .IOException, sun.awt.X11.XBaseWindow, com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection, sun.java2d.opengl.OGLRenderQueue

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private static final int[]
private static final int[]
private static final int
public static final String
public static final Object
GTK_LOCK

All calls into GTK should be synchronized on this lock

private static volatile Boolean
private Boolean
private Boolean
private static volatile Boolean
private BufferedImage
private static final WindowFocusListener
Inherited from sun.awt.SunToolkit:
currentEventQueueDEFAULT_WAIT_TIMEDESKTOPFONTHINTSfileImgCacheGRAB_EVENT_MASKMAX_BUTTONS_SUPPORTEDnumberOfButtonsurlImgCache

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
private static native boolean
check_gtk(int version)

public boolean

Returns:

true if the GTK+ library is compatible with the given version.
checkGtkVersion
(int
The required major version.
major
,
int
The required minor version.
minor
,
int
The required micro version.
micro
)

Returns true if the GTK+ library is compatible with the given version.

private static boolean
public void
public void
private static native int
public static int
public String
protected RenderingHints
public static UNIXToolkit.GtkVersions
public Integer
public BufferedImage

Returns:

The icon or null if it was not found or loaded.
getGTKIcon
(final String filename)

Returns a BufferedImage which contains the Gtk icon requested.

public static UNIXToolkit.GtkVersions
public BufferedImage

Returns:

The stock icon or null if it was not found or loaded.
getStockIcon
(final int
one of WidgetType values defined in GTKNativeEngine or -1 for system default stock icon.
widgetType
,
final String
String which defines the stock id of the gtk item. For a complete list reference the API at www.gtk.org for StockItems.
stockId
,
final int
One of the GtkIconSize values defined in GTKConstants
iconSize
,
final int
One of the TextDirection values defined in GTKConstants
direction
,
final String
Render detail that is passed to the native engine (feel free to pass null)
detail
)

Returns a BufferedImage which contains the Gtk stock icon requested.

private native boolean
gtkCheckVersionImpl(int major, int minor, int micro)

public static boolean
public boolean
isNativeGTKAvailable()

Overrides sun.awt.SunToolkit.isNativeGTKAvailable.

Returns true if the native GTK libraries are capable of being loaded and are expected to work properly, false otherwise.

public static boolean
public boolean
isRunningOnWayland()

Overrides sun.awt.SunToolkit.isRunningOnWayland.

Checks if the system is running Linux with the Wayland server.

protected Object
lazilyLoadDesktopProperty(String name)

Overrides java.awt.Toolkit.lazilyLoadDesktopProperty.

Overridden to handle GTK icon loading

protected Object

Returns:

an Image for the icon, or null if the icon could not be loaded
lazilyLoadGTKIcon
(String
a desktop property name. This contains icon name, size and orientation, e.g. "gtk.icon.gtk-add.4.rtl"
longname
)

Load a native Gtk stock icon.

private static native boolean
load_gtk(int version, boolean verbose)

private native boolean
private native boolean
load_stock_icon(int widget_type, String stock_id, int iconSize, int textDirection, String detail)

public boolean
loadGTK()

Loads the GTK libraries, if necessary.

public void
loadIconCallback(byte[] data, int width, int height, int rowStride, int bps, int channels, boolean alpha)

This method is used by JNI as a callback from load_stock_icon.

private native void
public boolean

Returns:

true if system tray should be disabled
shouldDisableSystemTray
()

There is an issue displaying the xembed icons in appIndicators area with certain Gnome Shell versions.

public void
sync()

Implements abstract java.awt.Toolkit.sync.

Synchronizes this toolkit's graphics state.

private static native boolean
Inherited from sun.awt.SunToolkit:
addModalityListenerawtLockawtLockNotifyawtLockNotifyAllawtLockWaitawtLockWaitawtTryLockawtUnlockcanPopupOverlapTaskBarcheckAndSetPolicycheckImagecloseSplashScreenconsumeNextKeyTypedcreateImagecreateImagecreateImagecreateImagecreateImageWithResolutionVariantcreateInputMethodWindowcreateLightweightFramecreateSystemTraycreateTrayIcondisableBackgroundErasedisableBackgroundErasedumpPeersenableInputMethodsForTextComponentexecuteOnEDTAndWaitexecuteOnEventHandlerThreadexecuteOnEventHandlerThreadexecuteOnEventHandlerThreadflushPendingEventsgetColorModelgetContainingWindowgetDefaultKeyboardLocalegetDesktopFontHintsgetFocusAcceleratorKeyMaskgetFontListgetFontMetricsgetHeavyweightComponentgetImagegetImagegetImageFromHashgetImageFromHashgetImageWithResolutionVariantgetImageWithResolutionVariantgetKeyboardFocusManagerPeergetLightweightFramegetNativeContainergetNumberOfButtonsgetScaledIconDatagetScaledIconImagegetScreenSizegetStartupLocalegetSunAwtDisableMixinggetSunAwtErasebackgroundonresizegetSunAwtNoerasebackgroundgetSystemEventQueueImplgetSystemEventQueueImplPPgetWindowDeactivationTimegrabimageCachedimageCachedimageExistsimageExistsinvokeLaterisAWTLockHeldByCurrentThreadisContainingTopLevelOpaqueisContainingTopLevelTranslucentisDesktopSupportedisInstanceOfisLightweightOrUnknownisModalExcludedisModalExcludedSupportedisModalExcludedSupportedImplisModalExclusionTypeSupportedisModalityTypeSupportedisPrintableCharacterModifiersMaskisSwingBackbufferTranslucencySupportedisSystemGeneratedisTaskbarSupportedisTouchKeyboardAutoShowEnabledisTranslucencyCapableisTraySupportedisWindowOpacitySupportedisWindowShapingSupportedisWindowTranslucencySupportedisXEmbedServerRequestedneedsXEmbedneedsXEmbedImplneedUpdateWindownotifyModalityChangenotifyModalityPoppednotifyModalityPushedpostEventpostPriorityEventprepareImagerealSyncrealSyncremoveModalityListenersetAAFontSettingsConditionsetLWRequestStatussetModalExcludedsetSystemGeneratedsetWindowDeactivationTimeshowOrHideTouchKeyboardsyncNativeQueuetargetCreatedPeertargetDisposedPeertargetToPeertimeoutungrabupdateScreenMenuBarUIuseBufferPerWindowwakeupEventQueue

Field Detail

BAND_OFFSETSback to summary
private static final int[] BAND_OFFSETS
BAND_OFFSETS_ALPHAback to summary
private static final int[] BAND_OFFSETS_ALPHA
DEFAULT_DATATRANSFER_TIMEOUTback to summary
private static final int DEFAULT_DATATRANSFER_TIMEOUT
FONTCONFIGAAHINTback to summary
public static final String FONTCONFIGAAHINT
GTK_LOCKback to summary
public static final Object GTK_LOCK

All calls into GTK should be synchronized on this lock

isOnWaylandback to summary
private static volatile Boolean isOnWayland
nativeGTKAvailableback to summary
private Boolean nativeGTKAvailable
nativeGTKLoadedback to summary
private Boolean nativeGTKLoaded
shouldDisableSystemTrayback to summary
private static volatile Boolean shouldDisableSystemTray
tmpImageback to summary
private BufferedImage tmpImage
waylandWindowFocusListenerback to summary
private static final WindowFocusListener waylandWindowFocusListener

Constructor Detail

UNIXToolkitback to summary
public UNIXToolkit()

Method Detail

addWaylandWindowFocusListenerToWindowback to summary
private static void addWaylandWindowFocusListenerToWindow(Window window)
check_gtkback to summary
private static native boolean check_gtk(int version)
checkGtkVersionback to summary
public boolean checkGtkVersion(int major, int minor, int micro)

Returns true if the GTK+ library is compatible with the given version.

Parameters
major:int

The required major version.

minor:int

The required minor version.

micro:int

The required micro version.

Returns:boolean

true if the GTK+ library is compatible with the given version.

containsWaylandWindowFocusListenerback to summary
private static boolean containsWaylandWindowFocusListener(Window window)
dismissPopupOnFocusLostIfNeededback to summary
public void dismissPopupOnFocusLostIfNeeded(Window invoker)

Overrides sun.awt.SunToolkit.dismissPopupOnFocusLostIfNeeded.

Annotations
@Override
dismissPopupOnFocusLostIfNeededCleanUpback to summary
public void dismissPopupOnFocusLostIfNeededCleanUp(Window invoker)

Overrides sun.awt.SunToolkit.dismissPopupOnFocusLostIfNeededCleanUp.

Annotations
@Override
get_gtk_versionback to summary
private static native int get_gtk_version()
getDatatransferTimeoutback to summary
public static int getDatatransferTimeout()
getDesktopback to summary
public String getDesktop()

Overrides sun.awt.SunToolkit.getDesktop.

Annotations
@Override
getDesktopAAHintsback to summary
protected RenderingHints getDesktopAAHints()

Overrides sun.awt.SunToolkit.getDesktopAAHints.

Annotations
@Override
getEnabledGtkVersionback to summary
public static UNIXToolkit.GtkVersions getEnabledGtkVersion()
getGnomeShellMajorVersionback to summary
public Integer getGnomeShellMajorVersion()
getGTKIconback to summary
public BufferedImage getGTKIcon(final String filename)

Returns a BufferedImage which contains the Gtk icon requested. If no such icon exists or an error occurs loading the icon the result will be null.

Returns:BufferedImage

The icon or null if it was not found or loaded.

getGtkVersionback to summary
public static UNIXToolkit.GtkVersions getGtkVersion()
getStockIconback to summary
public BufferedImage getStockIcon(final int widgetType, final String stockId, final int iconSize, final int direction, final String detail)

Returns a BufferedImage which contains the Gtk stock icon requested. If no such stock icon exists the result will be null.

Parameters
widgetType:int

one of WidgetType values defined in GTKNativeEngine or -1 for system default stock icon.

stockId:String

String which defines the stock id of the gtk item. For a complete list reference the API at www.gtk.org for StockItems.

iconSize:int

One of the GtkIconSize values defined in GTKConstants

direction:int

One of the TextDirection values defined in GTKConstants

detail:String

Render detail that is passed to the native engine (feel free to pass null)

Returns:BufferedImage

The stock icon or null if it was not found or loaded.

gtkCheckVersionImplback to summary
private native boolean gtkCheckVersionImpl(int major, int minor, int micro)
isGtkVerboseback to summary
public static boolean isGtkVerbose()
isNativeGTKAvailableback to summary
public boolean isNativeGTKAvailable()

Overrides sun.awt.SunToolkit.isNativeGTKAvailable.

Returns true if the native GTK libraries are capable of being loaded and are expected to work properly, false otherwise. Note that this method will not leave the native GTK libraries loaded if they haven't already been loaded. This allows, for example, Swing's GTK L&F to test for the presence of native GTK support without leaving the native libraries loaded. To attempt long-term loading of the native GTK libraries, use the loadGTK() method instead.

Annotations
@Override
isOnWaylandback to summary
public static boolean isOnWayland()
isRunningOnWaylandback to summary
public boolean isRunningOnWayland()

Overrides sun.awt.SunToolkit.isRunningOnWayland.

Doc from sun.awt.SunToolkit.isRunningOnWayland.

Checks if the system is running Linux with the Wayland server.

Annotations
@Override
lazilyLoadDesktopPropertyback to summary
protected Object lazilyLoadDesktopProperty(String name)

Overrides java.awt.Toolkit.lazilyLoadDesktopProperty.

Overridden to handle GTK icon loading

Annotations
@Override
lazilyLoadGTKIconback to summary
protected Object lazilyLoadGTKIcon(String longname)

Load a native Gtk stock icon.

Parameters
longname:String

a desktop property name. This contains icon name, size and orientation, e.g. "gtk.icon.gtk-add.4.rtl"

Returns:Object

an Image for the icon, or null if the icon could not be loaded

load_gtkback to summary
private static native boolean load_gtk(int version, boolean verbose)
load_gtk_iconback to summary
private native boolean load_gtk_icon(String filename)
load_stock_iconback to summary
private native boolean load_stock_icon(int widget_type, String stock_id, int iconSize, int textDirection, String detail)
loadGTKback to summary
public boolean loadGTK()

Loads the GTK libraries, if necessary. The first time this method is called, it will attempt to load the native GTK library. If successful, it leaves the library open and returns true; otherwise, the library is left closed and returns false. On future calls to this method, the status of the first attempt is returned (a simple lightweight boolean check, no native calls required).

loadIconCallbackback to summary
public void loadIconCallback(byte[] data, int width, int height, int rowStride, int bps, int channels, boolean alpha)

This method is used by JNI as a callback from load_stock_icon. Image data is passed back to us via this method and loaded into the local BufferedImage and then returned via getStockIcon. Do NOT call this method directly.

nativeSyncback to summary
private native void nativeSync()
shouldDisableSystemTrayback to summary
public boolean shouldDisableSystemTray()

There is an issue displaying the xembed icons in appIndicators area with certain Gnome Shell versions. To avoid any loss of quality of service, we are disabling SystemTray support in such cases.

Returns:boolean

true if system tray should be disabled

syncback to summary
public void sync()

Implements abstract java.awt.Toolkit.sync.

Doc from java.awt.Toolkit.sync.

Synchronizes this toolkit's graphics state. Some window systems may do buffering of graphics events.

This method ensures that the display is up-to-date. It is useful for animation.

Annotations
@Override
unload_gtkback to summary
private static native boolean unload_gtk()
sun.awt back to summary

public final Enum UNIXToolkit.GtkVersions

extends Enum<UNIXToolkit.GtkVersions>
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
public static final UNIXToolkit.GtkVersions
public static final UNIXToolkit.GtkVersions
pack-priv final int

Constructor Summary

AccessConstructor and Description
private
GtkVersions(int number)

Method Summary

Modifier and TypeMethod and Description
public int
public static UNIXToolkit.GtkVersions
getVersion(int number)

public static UNIXToolkit.GtkVersions
public static UNIXToolkit.GtkVersions[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ANYback to summary
public static final UNIXToolkit.GtkVersions ANY
GTK3back to summary
public static final UNIXToolkit.GtkVersions GTK3
numberback to summary
pack-priv final int number

Constructor Detail

GtkVersionsback to summary
private GtkVersions(int number)

Method Detail

getNumberback to summary
public int getNumber()
getVersionback to summary
public static UNIXToolkit.GtkVersions getVersion(int number)
valueOfback to summary
public static UNIXToolkit.GtkVersions valueOf(String name)
valuesback to summary
public static UNIXToolkit.GtkVersions[] values()
sun.awt back to summary

pack-priv final Class UNIXToolkit.GtkVersions.Constants

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

GTK3_MAJOR_NUMBERback to summary
pack-priv static final int GTK3_MAJOR_NUMBER

Constructor Detail

Constantsback to summary
pack-priv Constants()