JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.nativewindow.swt.SWTAccessor Class Reference
Collaboration diagram for com.jogamp.nativewindow.swt.SWTAccessor:

Static Public Member Functions

static void initSingleton ()
 Call this method, if this class shall be initialized before any other of its methods are called within the regular workflow. More...
 
static boolean isUsingLongHandles ()
 
static boolean useX11GTK ()
 
static VersionNumber GTK_VERSION ()
 
static long gdk_widget_get_window (final long handle)
 
static long gdk_window_get_xdisplay (final long window)
 
static long gdk_window_get_xwindow (final long window)
 
static void printInfo (final PrintStream out, final Display d)
 
static float getAutoScalingFactor () throws NativeWindowException
 Returns SWT compatible auto scale-factor, used by DPIUtil. More...
 
static int autoScaleUp (final int v)
 Returns SWT auto scaled-up value v, compatible with DPIUtil#autoScaleUp(int). More...
 
static int autoScaleDown (final int v)
 Returns SWT auto scaled-down value v, compatible with DPIUtil#autoScaleDown(int). More...
 
static float getDeviceZoomScalingFactor ()
 Returns SWT derived scale-factor based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale(). More...
 
static int deviceZoomScaleUp (final int v)
 Returns SWT derived scaled-up value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale(). More...
 
static int deviceZoomScaleDown (final int v)
 Returns SWT derived scaled-down value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale(). More...
 
static com.jogamp.nativewindow.util.Point deviceZoomScaleUp (final com.jogamp.nativewindow.util.Point v)
 Returns SWT derived scaled-up value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale(). More...
 
static com.jogamp.nativewindow.util.Point deviceZoomScaleDown (final com.jogamp.nativewindow.util.Point v)
 Returns SWT derived scaled-down value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale(). More...
 
static Rectangle getClientAreaInPixels (final Scrollable s) throws NativeWindowException
 Returns the unscaled Scrollable#getClientArea() in pixels. More...
 
static Point getLocationInPixels (final Control c) throws NativeWindowException
 
static Point getSizeInPixels (final Control c) throws NativeWindowException
 
static long getHandle (final Control swtControl) throws NativeWindowException
 
static void setRealized (final Control swtControl, final boolean realize) throws NativeWindowException
 
static AbstractGraphicsDevice getDevice (final Control swtControl) throws NativeWindowException, UnsupportedOperationException
 
static AbstractGraphicsScreen getScreen (final AbstractGraphicsDevice device, final int screen)
 
static int getNativeVisualID (final AbstractGraphicsDevice device, final long windowHandle)
 
static long getWindowHandle (final Control swtControl) throws NativeWindowException, UnsupportedOperationException
 
static long newGC (final Control swtControl, final GCData gcData)
 
static void disposeGC (final Control swtControl, final long gc, final GCData gcData)
 
static void invokeOnOSTKThread (final boolean blocking, final Runnable runnable)
 Runs the specified action in an SWT compatible OS toolkit thread, which is: More...
 
static void invokeOnSWTThread (final org.eclipse.swt.widgets.Display display, final boolean blocking, final Runnable runnable)
 Runs the specified action on the SWT UI thread. More...
 
static boolean isOnSWTThread (final org.eclipse.swt.widgets.Display display)
 Return true if the current thread is the SWT UI thread, otherwise false. More...
 
static long createCompatibleX11ChildWindow (final AbstractGraphicsScreen screen, final Control swtControl, final int visualID, final int width, final int height)
 
static void resizeX11Window (final AbstractGraphicsDevice device, final Rectangle clientArea, final long x11Window)
 
static void destroyX11Window (final AbstractGraphicsDevice device, final long x11Window)
 
static long createCompatibleGDKChildWindow (final Control swtControl, final int visualID, final int width, final int height)
 
static void showGDKWindow (final long gdkWindow)
 
static void focusGDKWindow (final long gdkWindow)
 
static void resizeGDKWindow (final Rectangle clientArea, final long gdkWindow)
 
static void destroyGDKWindow (final long gdkWindow)
 

Static Public Attributes

static final boolean isOSX
 
static final boolean isWindows
 
static final boolean isX11
 
static final boolean isX11GTK
 
static final boolean useCairoAutoScale
 
static final Class<?> OS_gtk_class
 
static final VersionNumber OS_gtk_version
 

Detailed Description

Definition at line 62 of file SWTAccessor.java.

Member Function Documentation

◆ autoScaleDown()

static int com.jogamp.nativewindow.swt.SWTAccessor.autoScaleDown ( final int  v)
static

Returns SWT auto scaled-down value v, compatible with DPIUtil#autoScaleDown(int).

We need to keep track of SWT's implementation in this regard!

Definition at line 476 of file SWTAccessor.java.

◆ autoScaleUp()

static int com.jogamp.nativewindow.swt.SWTAccessor.autoScaleUp ( final int  v)
static

Returns SWT auto scaled-up value v, compatible with DPIUtil#autoScaleUp(int).

We need to keep track of SWT's implementation in this regard!

Definition at line 462 of file SWTAccessor.java.

◆ createCompatibleGDKChildWindow()

static long com.jogamp.nativewindow.swt.SWTAccessor.createCompatibleGDKChildWindow ( final Control  swtControl,
final int  visualID,
final int  width,
final int  height 
)
static

Definition at line 868 of file SWTAccessor.java.

◆ createCompatibleX11ChildWindow()

static long com.jogamp.nativewindow.swt.SWTAccessor.createCompatibleX11ChildWindow ( final AbstractGraphicsScreen  screen,
final Control  swtControl,
final int  visualID,
final int  width,
final int  height 
)
static

Definition at line 841 of file SWTAccessor.java.

Here is the call graph for this function:

◆ destroyGDKWindow()

static void com.jogamp.nativewindow.swt.SWTAccessor.destroyGDKWindow ( final long  gdkWindow)
static

Definition at line 915 of file SWTAccessor.java.

◆ destroyX11Window()

static void com.jogamp.nativewindow.swt.SWTAccessor.destroyX11Window ( final AbstractGraphicsDevice  device,
final long  x11Window 
)
static

Definition at line 855 of file SWTAccessor.java.

Here is the call graph for this function:

◆ deviceZoomScaleDown() [1/2]

static com.jogamp.nativewindow.util.Point com.jogamp.nativewindow.swt.SWTAccessor.deviceZoomScaleDown ( final com.jogamp.nativewindow.util.Point  v)
static

Returns SWT derived scaled-down value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale().

This method should be used instead of autoScaleDown(com.jogamp.nativewindow.util.Point) for native toolkits not caring about DPI scaling like X11 or GDI.

We need to keep track of SWT's implementation in this regard!

Definition at line 575 of file SWTAccessor.java.

◆ deviceZoomScaleDown() [2/2]

static int com.jogamp.nativewindow.swt.SWTAccessor.deviceZoomScaleDown ( final int  v)
static

Returns SWT derived scaled-down value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale().

This method should be used instead of autoScaleDown(int) for native toolkits not caring about DPI scaling like X11 or GDI.

We need to keep track of SWT's implementation in this regard!

Definition at line 537 of file SWTAccessor.java.

◆ deviceZoomScaleUp() [1/2]

static com.jogamp.nativewindow.util.Point com.jogamp.nativewindow.swt.SWTAccessor.deviceZoomScaleUp ( final com.jogamp.nativewindow.util.Point  v)
static

Returns SWT derived scaled-up value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale().

This method should be used instead of autoScaleUp(com.jogamp.nativewindow.util.Point) for native toolkits not caring about DPI scaling like X11 or GDI.

We need to keep track of SWT's implementation in this regard!

Definition at line 556 of file SWTAccessor.java.

◆ deviceZoomScaleUp() [2/2]

static int com.jogamp.nativewindow.swt.SWTAccessor.deviceZoomScaleUp ( final int  v)
static

Returns SWT derived scaled-up value v, based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale().

This method should be used instead of autoScaleUp(int) for native toolkits not caring about DPI scaling like X11 or GDI.

We need to keep track of SWT's implementation in this regard!

Definition at line 518 of file SWTAccessor.java.

◆ disposeGC()

static void com.jogamp.nativewindow.swt.SWTAccessor.disposeGC ( final Control  swtControl,
final long  gc,
final GCData  gcData 
)
static

Definition at line 775 of file SWTAccessor.java.

Here is the call graph for this function:

◆ focusGDKWindow()

static void com.jogamp.nativewindow.swt.SWTAccessor.focusGDKWindow ( final long  gdkWindow)
static

Definition at line 902 of file SWTAccessor.java.

◆ gdk_widget_get_window()

static long com.jogamp.nativewindow.swt.SWTAccessor.gdk_widget_get_window ( final long  handle)
static

Definition at line 375 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ gdk_window_get_xdisplay()

static long com.jogamp.nativewindow.swt.SWTAccessor.gdk_window_get_xdisplay ( final long  window)
static

Definition at line 388 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ gdk_window_get_xwindow()

static long com.jogamp.nativewindow.swt.SWTAccessor.gdk_window_get_xwindow ( final long  window)
static

Definition at line 405 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getAutoScalingFactor()

static float com.jogamp.nativewindow.swt.SWTAccessor.getAutoScalingFactor ( ) throws NativeWindowException
static

Returns SWT compatible auto scale-factor, used by DPIUtil.

We need to keep track of SWT's implementation in this regard!

Definition at line 441 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getClientAreaInPixels()

static Rectangle com.jogamp.nativewindow.swt.SWTAccessor.getClientAreaInPixels ( final Scrollable  s) throws NativeWindowException
static

Returns the unscaled Scrollable#getClientArea() in pixels.

If the package restricted method Scrollable#getClientAreaInPixels() is implemented, we return its result.

Fallback is to return DPIUtil#autoScaleUp(Scrollable#getClientArea()), reverting Scrollable#getClientArea()'s DPIUtil#autoScaleDown(Rectangle).

Note to SWT's API spec writers: You need to allow access to the unscaled value, scale properties and define what is being scaled (fonts, images, ..). Further more the scale should be separate for x/y coordinates, as DPI differs here.

Note to Eclipse authors: Scaling up the fonts and images hardly works on GTK/SWT/Eclipse. GDK_SCALE, GDK_DPI_SCALE and swt.autoScale produce inconsistent results with Eclipse. Broken High-DPI for .. some years now. This is especially true for using native high-dpi w/ scaling-factor 1f.

Requires SWT >= 3.105 (DPIUtil)

Parameters
sthe Scrollable instance
Returns
unscaled client area in pixels, see above
Exceptions
NativeWindowExceptionduring invocation of the method, if any

Definition at line 611 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getDevice()

static AbstractGraphicsDevice com.jogamp.nativewindow.swt.SWTAccessor.getDevice ( final Control  swtControl) throws NativeWindowException, UnsupportedOperationException
static
Parameters
swtControlthe SWT Control to retrieve the native device handle from
Returns
the AbstractGraphicsDevice w/ the native device handle
Exceptions
NativeWindowExceptionif the widget handle is null
UnsupportedOperationExceptionif the windowing system is not supported

Definition at line 706 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeviceZoomScalingFactor()

static float com.jogamp.nativewindow.swt.SWTAccessor.getDeviceZoomScalingFactor ( )
static

Returns SWT derived scale-factor based on DPIUtil#getDeviceZoom() only, not considering higher-toolkit's compensation like DPIUtil#useCairoAutoScale().

This method should be used instead of getAutoScalingFactor() for native toolkits not caring about DPI scaling like X11 or GDI.

We need to keep track of SWT's implementation in this regard!

Definition at line 500 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getHandle()

static long com.jogamp.nativewindow.swt.SWTAccessor.getHandle ( final Control  swtControl) throws NativeWindowException
static
Parameters
swtControlthe SWT Control to retrieve the native widget-handle from
Returns
the native widget-handle
Exceptions
NativeWindowExceptionif the widget handle is null

Definition at line 648 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getLocationInPixels()

static Point com.jogamp.nativewindow.swt.SWTAccessor.getLocationInPixels ( final Control  c) throws NativeWindowException
static

Definition at line 622 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getNativeVisualID()

static int com.jogamp.nativewindow.swt.SWTAccessor.getNativeVisualID ( final AbstractGraphicsDevice  device,
final long  windowHandle 
)
static

Definition at line 730 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScreen()

static AbstractGraphicsScreen com.jogamp.nativewindow.swt.SWTAccessor.getScreen ( final AbstractGraphicsDevice  device,
final int  screen 
)
static
Parameters
device
screen-1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
Returns

Definition at line 726 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSizeInPixels()

static Point com.jogamp.nativewindow.swt.SWTAccessor.getSizeInPixels ( final Control  c) throws NativeWindowException
static

Definition at line 632 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ getWindowHandle()

static long com.jogamp.nativewindow.swt.SWTAccessor.getWindowHandle ( final Control  swtControl) throws NativeWindowException, UnsupportedOperationException
static
Parameters
swtControlthe SWT Control to retrieve the native window handle from
Returns
the native window handle
Exceptions
NativeWindowExceptionif the widget handle is null
UnsupportedOperationExceptionif the windowing system is not supported

Definition at line 746 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GTK_VERSION()

static VersionNumber com.jogamp.nativewindow.swt.SWTAccessor.GTK_VERSION ( )
static

Definition at line 369 of file SWTAccessor.java.

◆ initSingleton()

static void com.jogamp.nativewindow.swt.SWTAccessor.initSingleton ( )
static

Call this method, if this class shall be initialized before any other of its methods are called within the regular workflow.

This could be desired to ensure initialization before AWT.

This method does nothing, but initializes this class's static SWT accessors if using this class for the first time.

Definition at line 328 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ invokeOnOSTKThread()

static void com.jogamp.nativewindow.swt.SWTAccessor.invokeOnOSTKThread ( final boolean  blocking,
final Runnable  runnable 
)
static

Runs the specified action in an SWT compatible OS toolkit thread, which is:

  • Mac OSX
    • Main Thread: Run on OSX UI main thread. 'wait' is implemented on Java site via lock/wait on RunnableTask to not freeze OSX main thread.
  • Linux, Windows, ..
    • Current thread.
See also
Platform::AWT_AVAILABLE
Platform::getOSType()

Definition at line 803 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ invokeOnSWTThread()

static void com.jogamp.nativewindow.swt.SWTAccessor.invokeOnSWTThread ( final org.eclipse.swt.widgets.Display  display,
final boolean  blocking,
final Runnable  runnable 
)
static

Runs the specified action on the SWT UI thread.

If blocking is true implementation uses org.eclipse.swt.widgets.Display#syncExec(Runnable), otherwise org.eclipse.swt.widgets.Display#asyncExec(Runnable).

If display is null or disposed or the current thread is the SWT UI thread invokeOnOSTKThread(boolean, Runnable) is being used.

See also
invokeOnOSTKThread(boolean, Runnable)

Definition at line 822 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOnSWTThread()

static boolean com.jogamp.nativewindow.swt.SWTAccessor.isOnSWTThread ( final org.eclipse.swt.widgets.Display  display)
static

Return true if the current thread is the SWT UI thread, otherwise false.

Definition at line 833 of file SWTAccessor.java.

Here is the caller graph for this function:

◆ isUsingLongHandles()

static boolean com.jogamp.nativewindow.swt.SWTAccessor.isUsingLongHandles ( )
static

Definition at line 364 of file SWTAccessor.java.

◆ newGC()

static long com.jogamp.nativewindow.swt.SWTAccessor.newGC ( final Control  swtControl,
final GCData  gcData 
)
static

Definition at line 760 of file SWTAccessor.java.

Here is the call graph for this function:

◆ printInfo()

static void com.jogamp.nativewindow.swt.SWTAccessor.printInfo ( final PrintStream  out,
final Display  d 
)
static

Definition at line 421 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resizeGDKWindow()

static void com.jogamp.nativewindow.swt.SWTAccessor.resizeGDKWindow ( final Rectangle  clientArea,
final long  gdkWindow 
)
static

Definition at line 908 of file SWTAccessor.java.

◆ resizeX11Window()

static void com.jogamp.nativewindow.swt.SWTAccessor.resizeX11Window ( final AbstractGraphicsDevice  device,
final Rectangle  clientArea,
final long  x11Window 
)
static

Definition at line 852 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRealized()

static void com.jogamp.nativewindow.swt.SWTAccessor.setRealized ( final Control  swtControl,
final boolean  realize 
) throws NativeWindowException
static

Definition at line 678 of file SWTAccessor.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showGDKWindow()

static void com.jogamp.nativewindow.swt.SWTAccessor.showGDKWindow ( final long  gdkWindow)
static

Definition at line 898 of file SWTAccessor.java.

◆ useX11GTK()

static boolean com.jogamp.nativewindow.swt.SWTAccessor.useX11GTK ( )
static

Definition at line 368 of file SWTAccessor.java.

Here is the caller graph for this function:

Member Data Documentation

◆ isOSX

final boolean com.jogamp.nativewindow.swt.SWTAccessor.isOSX
static

Definition at line 78 of file SWTAccessor.java.

◆ isWindows

final boolean com.jogamp.nativewindow.swt.SWTAccessor.isWindows
static

Definition at line 79 of file SWTAccessor.java.

◆ isX11

final boolean com.jogamp.nativewindow.swt.SWTAccessor.isX11
static

Definition at line 80 of file SWTAccessor.java.

◆ isX11GTK

final boolean com.jogamp.nativewindow.swt.SWTAccessor.isX11GTK
static

Definition at line 81 of file SWTAccessor.java.

◆ OS_gtk_class

final Class<?> com.jogamp.nativewindow.swt.SWTAccessor.OS_gtk_class
static

Definition at line 101 of file SWTAccessor.java.

◆ OS_gtk_version

final VersionNumber com.jogamp.nativewindow.swt.SWTAccessor.OS_gtk_version
static

Definition at line 103 of file SWTAccessor.java.

◆ useCairoAutoScale

final boolean com.jogamp.nativewindow.swt.SWTAccessor.useCairoAutoScale
static

Definition at line 82 of file SWTAccessor.java.


The documentation for this class was generated from the following file: