28package com.jogamp.nativewindow.swt;
30import com.jogamp.common.os.Platform;
32import java.io.PrintStream;
33import java.lang.reflect.Field;
34import java.lang.reflect.Method;
35import java.security.PrivilegedAction;
37import org.eclipse.swt.SWT;
38import org.eclipse.swt.graphics.GCData;
39import org.eclipse.swt.graphics.Point;
40import org.eclipse.swt.graphics.Rectangle;
41import org.eclipse.swt.internal.DPIUtil;
42import org.eclipse.swt.widgets.Control;
43import org.eclipse.swt.widgets.Display;
44import org.eclipse.swt.widgets.Scrollable;
46import com.jogamp.nativewindow.AbstractGraphicsScreen;
47import com.jogamp.nativewindow.NativeWindowException;
48import com.jogamp.nativewindow.AbstractGraphicsDevice;
49import com.jogamp.nativewindow.NativeWindowFactory;
50import com.jogamp.nativewindow.VisualIDHolder;
51import com.jogamp.common.util.ReflectionUtil;
52import com.jogamp.common.util.SecurityUtil;
53import com.jogamp.common.util.VersionNumber;
54import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice;
55import com.jogamp.nativewindow.windows.WindowsGraphicsDevice;
56import com.jogamp.nativewindow.x11.X11GraphicsDevice;
58import jogamp.nativewindow.macosx.OSXUtil;
59import jogamp.nativewindow.x11.X11Lib;
60import jogamp.nativewindow.Debug;
63 private static final boolean DEBUG = Debug.debug(
"SWT");
65 private static final Method swt_scrollable_clientAreaInPixels;
66 private static final Method swt_control_locationInPixels;
67 private static final Method swt_control_sizeInPixels;
68 private static final Method swt_dpiutil_getScalingFactor;
70 private static final Field swt_control_handle;
71 private static final boolean swt_uses_long_handles;
73 private static Object swt_osx_init =
new Object();
74 private static Field swt_osx_control_view =
null;
75 private static Field swt_osx_view_id =
null;
77 private static final String nwt;
78 public static final boolean isOSX;
80 public static final boolean isX11;
84 private static final String str_handle =
"handle";
87 private static final String str_osx_view =
"view";
88 private static final String str_osx_id =
"id";
91 private static final Method swt_control_internal_new_GC;
92 private static final Method swt_control_internal_dispose_GC;
93 private static final String str_internal_new_GC =
"internal_new_GC";
94 private static final String str_internal_dispose_GC =
"internal_dispose_GC";
96 private static final String str_OS_gtk_class =
"org.eclipse.swt.internal.gtk.OS";
97 private static final String str_GTK_gtk_class =
"org.eclipse.swt.internal.gtk.GTK";
98 private static final String str_GTK3_gtk_class =
"org.eclipse.swt.internal.gtk3.GTK3";
99 private static final String str_GDK_gtk_class =
"org.eclipse.swt.internal.gtk.GDK";
101 private static final String str_OS_gtk_version =
"GTK_VERSION";
104 private static final Method OS_gtk_widget_realize;
105 private static final Method OS_gtk_widget_unrealize;
106 private static final Method OS_GTK_WIDGET_WINDOW;
107 private static final Method OS_gtk_widget_get_window;
108 private static final Method OS_gdk_x11_drawable_get_xdisplay;
109 private static final Method OS_gdk_x11_display_get_xdisplay;
110 private static final Method OS_gdk_window_get_display;
111 private static final Method OS_gdk_x11_drawable_get_xid;
112 private static final Method OS_gdk_x11_window_get_xid;
114 private static final String str_gtk_widget_realize =
"gtk_widget_realize";
115 private static final String str_gtk_widget_unrealize =
"gtk_widget_unrealize";
116 private static final String str_GTK_WIDGET_WINDOW =
"GTK_WIDGET_WINDOW";
117 private static final String str_gtk_widget_get_window =
"gtk_widget_get_window";
118 private static final String str_gdk_x11_drawable_get_xdisplay =
"gdk_x11_drawable_get_xdisplay";
119 private static final String str_gdk_x11_display_get_xdisplay =
"gdk_x11_display_get_xdisplay";
120 private static final String str_gdk_window_get_display =
"gdk_window_get_display";
121 private static final String str_gdk_x11_drawable_get_xid =
"gdk_x11_drawable_get_xid";
122 private static final String str_gdk_x11_window_get_xid =
"gdk_x11_window_get_xid";
124 private static final VersionNumber GTK_VERSION_2_14_0 =
new VersionNumber(2, 14, 0);
125 private static final VersionNumber GTK_VERSION_2_24_0 =
new VersionNumber(2, 24, 0);
127 private static final VersionNumber GTK_VERSION_3_0_0 =
new VersionNumber(3, 0, 0);
130 private static VersionNumber
GTK_VERSION(
final int version) {
132 final int micro = ( version ) & 0xff;
133 final int minor = ( version >> 8 ) & 0xff;
134 final int major = ( version >> 16 ) & 0xff;
135 return new VersionNumber(major, minor, micro);
139 final int SWT_VERSION_4_20 = 4944;
143 SecurityUtil.doPrivileged(
new PrivilegedAction<Object>() {
145 public Object run() {
150 nwt = NativeWindowFactory.getNativeWindowType(
false);
151 isOSX = NativeWindowFactory.TYPE_MACOSX == nwt;
152 isWindows = NativeWindowFactory.TYPE_WINDOWS == nwt;
153 isX11 = NativeWindowFactory.TYPE_X11 == nwt;
154 final int swt_version = SWT.getVersion();
157 System.err.println(
"SWT: Platform: "+SWT.getPlatform()+
", Version: "+swt_version);
162 m = Control.class.getDeclaredMethod(
"getLocationInPixels");
163 m.setAccessible(
true);
164 }
catch (
final Exception ex) {
167 System.err.println(
"SWT: getLocationInPixels not implemented: "+ex.getMessage());
170 swt_control_locationInPixels = m;
174 m = Control.class.getDeclaredMethod(
"getSizeInPixels");
175 m.setAccessible(
true);
176 }
catch (
final Exception ex) {
179 System.err.println(
"SWT: getSizeInPixels not implemented: "+ex.getMessage());
182 swt_control_sizeInPixels = m;
186 m = Scrollable.class.getDeclaredMethod(
"getClientAreaInPixels");
187 m.setAccessible(
true);
188 }
catch (
final Exception ex) {
191 System.err.println(
"SWT: getClientAreaInPixels not implemented: "+ex.getMessage());
194 swt_scrollable_clientAreaInPixels = m;
198 m = DPIUtil.class.getDeclaredMethod(
"getScalingFactor");
199 m.setAccessible(
true);
200 }
catch (
final Exception ex) {
203 System.err.println(
"SWT: getScalingFactor not implemented: "+ex.getMessage());
206 swt_dpiutil_getScalingFactor = m;
211 f = Control.class.getField(str_handle);
212 }
catch (
final Exception ex) {
213 throw new NativeWindowException(ex);
216 swt_control_handle = f;
219 if (
null != swt_control_handle) {
220 ulh = swt_control_handle.getGenericType().toString().equals(
long.
class.toString());
222 ulh = Platform.is64Bit();
224 swt_uses_long_handles = ulh;
230 m = ReflectionUtil.getMethod(Control.class, str_internal_new_GC,
new Class[] { GCData.class });
231 }
catch (
final Exception ex) {
232 throw new NativeWindowException(ex);
234 swt_control_internal_new_GC = m;
238 if(swt_uses_long_handles) {
239 m = Control.class.getDeclaredMethod(str_internal_dispose_GC,
new Class[] {
long.class, GCData.class });
241 m = Control.class.getDeclaredMethod(str_internal_dispose_GC,
new Class[] {
int.class, GCData.class });
243 }
catch (
final NoSuchMethodException ex) {
244 throw new NativeWindowException(ex);
246 swt_control_internal_dispose_GC = m;
249 VersionNumber _gtk_version =
new VersionNumber(0, 0, 0);
250 Method m1=
null, m2=
null, m3=
null, m4=
null, m5=
null, m6=
null, m7=
null, m8=
null, m9=
null;
251 final Class<?> handleType = swt_uses_long_handles ? long.class : int.class ;
255 final ClassLoader cl = SWTAccessor.class.getClassLoader();
256 cGTK = ReflectionUtil.getClass(str_OS_gtk_class,
false, cl);
257 Field field_OS_gtk_version;
260 field_OS_gtk_version = cGTK.getField(str_OS_gtk_version);
261 }
catch (
final NoSuchFieldException ex) {
264 cGTK = ReflectionUtil.getClass(str_GTK_gtk_class,
false, cl);
265 field_OS_gtk_version = cGTK.getField(str_OS_gtk_version);
266 cGDK = ReflectionUtil.getClass(str_GDK_gtk_class,
false, cl);
268 _gtk_version =
GTK_VERSION(field_OS_gtk_version.getInt(
null));
270 System.err.println(
"SWT: GTK Version: "+_gtk_version.toString());
272 m1 = cGTK.getDeclaredMethod(str_gtk_widget_realize, handleType);
273 if (_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) {
274 if (swt_version < SWT_VERSION_4_20) {
275 m4 = cGTK.getDeclaredMethod(str_gtk_widget_get_window, handleType);
277 final Class<?> cGTK3 = ReflectionUtil.getClass(str_GTK3_gtk_class,
false, cl);
278 m4 = cGTK3.getDeclaredMethod(str_gtk_widget_get_window, handleType);
281 m3 = cGTK.getDeclaredMethod(str_GTK_WIDGET_WINDOW, handleType);
283 if (_gtk_version.compareTo(GTK_VERSION_2_24_0) >= 0) {
284 m6 = cGDK.getDeclaredMethod(str_gdk_x11_display_get_xdisplay, handleType);
285 m7 = cGDK.getDeclaredMethod(str_gdk_window_get_display, handleType);
287 m5 = cGTK.getDeclaredMethod(str_gdk_x11_drawable_get_xdisplay, handleType);
289 if (_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) {
290 m9 = cGDK.getDeclaredMethod(str_gdk_x11_window_get_xid, handleType);
292 m8 = cGTK.getDeclaredMethod(str_gdk_x11_drawable_get_xid, handleType);
294 }
catch (
final Exception ex) {
throw new NativeWindowException(ex); }
297 m2 = cGTK.getDeclaredMethod(str_gtk_widget_unrealize, handleType);
298 }
catch (
final Exception ex) { }
302 OS_gtk_widget_realize = m1;
303 OS_gtk_widget_unrealize = m2;
304 OS_GTK_WIDGET_WINDOW = m3;
305 OS_gtk_widget_get_window = m4;
306 OS_gdk_x11_drawable_get_xdisplay = m5;
307 OS_gdk_x11_display_get_xdisplay = m6;
308 OS_gdk_window_get_display = m7;
309 OS_gdk_x11_drawable_get_xid = m8;
310 OS_gdk_x11_window_get_xid = m9;
328 private static Number getIntOrLong(
final long arg) {
329 if(swt_uses_long_handles) {
330 return Long.valueOf(arg);
332 return Integer.valueOf((
int) arg);
335 private static void callStaticMethodL2V(
final Method m,
final long arg) {
336 ReflectionUtil.callMethod(
null, m,
new Object[] { getIntOrLong(arg) });
339 @SuppressWarnings(
"unused")
340 private static
void callStaticMethodLL2V(final Method m, final
long arg0, final
long arg1) {
341 ReflectionUtil.callMethod(
null, m,
new Object[] { getIntOrLong(arg0), getIntOrLong(arg1) });
344 @SuppressWarnings(
"unused")
345 private static
void callStaticMethodLLZ2V(final Method m, final
long arg0, final
long arg1, final
boolean arg3) {
346 ReflectionUtil.callMethod(
null, m,
new Object[] { getIntOrLong(arg0), getIntOrLong(arg1), Boolean.valueOf(arg3) });
349 private static long callStaticMethodL2L(
final Method m,
final long arg) {
350 final Object o = ReflectionUtil.callMethod(
null, m,
new Object[] { getIntOrLong(arg) });
351 if(o instanceof Number) {
352 return ((Number)o).longValue();
354 throw new InternalError(
"SWT method "+m.getName()+
" didn't return int or long but "+o.getClass());
363 return swt_uses_long_handles;
376 window = callStaticMethodL2L(OS_gtk_widget_get_window, handle);
378 window = callStaticMethodL2L(OS_GTK_WIDGET_WINDOW, handle);
389 final long display = callStaticMethodL2L(OS_gdk_window_get_display, window);
391 throw new NativeWindowException(
"Null display-handle of gtk-window-handle 0x"+Long.toHexString(window));
393 xdisplay = callStaticMethodL2L(OS_gdk_x11_display_get_xdisplay, display);
395 xdisplay = callStaticMethodL2L(OS_gdk_x11_drawable_get_xdisplay, window);
398 throw new NativeWindowException(
"Null x11-display-handle of gtk-window-handle 0x"+Long.toHexString(window));
406 xWindow = callStaticMethodL2L(OS_gdk_x11_window_get_xid, window);
408 xWindow = callStaticMethodL2L(OS_gdk_x11_drawable_get_xid, window);
411 throw new NativeWindowException(
"Null x11-window-handle of gtk-window-handle 0x"+Long.toHexString(window));
419 public static void printInfo(
final PrintStream out,
final Display d) {
420 out.println(
"SWT: Platform: "+SWT.getPlatform()+
", Version "+SWT.getVersion());
423 out.println(
"SWT: deviceZoom "+DPIUtil.getDeviceZoom()+
", deviceScalingFactor "+
getDeviceScalingFactor());
424 final Point dpi =
null != d ? d.getDPI() :
null;
425 out.println(
"SWT: Display.DPI "+dpi);
426 out.println(
"SWT: swt_dpiutil_getScalingFactor "+(
null != swt_dpiutil_getScalingFactor));
427 out.println(
"SWT: swt_scrollable_clientAreaInPixels "+(
null != swt_scrollable_clientAreaInPixels));
442 final int deviceZoom = DPIUtil.getDeviceZoom();
443 if (100 == deviceZoom) {
446 final float scaleFactor = deviceZoom/100f;
447 return Math.round (v * scaleFactor);
456 final int deviceZoom = DPIUtil.getDeviceZoom();
457 if (100 == deviceZoom) {
460 final float scaleFactor = deviceZoom/100f;
461 return Math.round (v / scaleFactor);
464 public static Rectangle
autoScaleUp(
final Rectangle rect) {
return scaleUp(rect, DPIUtil.getDeviceZoom() ); }
465 public static Rectangle
scaleUp(
final Rectangle rect,
final int zoom) {
466 if (zoom == 100 || rect ==
null)
return rect;
467 final Rectangle scaledRect =
new Rectangle(0,0,0,0);
468 final Point scaledTopLeft =
scaleUp (
new Point(rect.x, rect.y), zoom);
469 final Point scaledBottomRight =
scaleUp (
new Point(rect.x + rect.width, rect.y + rect.height), zoom);
471 scaledRect.x = scaledTopLeft.x;
472 scaledRect.y = scaledTopLeft.y;
473 scaledRect.width = scaledBottomRight.x - scaledTopLeft.x;
474 scaledRect.height = scaledBottomRight.y - scaledTopLeft.y;
478 public static Point
autoScaleUp(
final Point point) {
return scaleUp(point, DPIUtil.getDeviceZoom() ); }
479 public static Point
scaleUp(
final Point point,
final int zoom) {
480 if (zoom == 100 || point ==
null)
return point;
482 final Point scaledPoint =
new Point(0,0);
483 scaledPoint.x = Math.round (point.x * scaleFactor);
484 scaledPoint.y = Math.round (point.y * scaleFactor);
500 final int deviceZoom = DPIUtil.getDeviceZoom();
501 if ( 100 == deviceZoom ) {
504 return deviceZoom/100f;
519 final int deviceZoom = DPIUtil.getDeviceZoom();
520 if (100 == deviceZoom) {
523 final float scaleFactor = deviceZoom/100f;
524 return Math.round (v * scaleFactor);
538 final int deviceZoom = DPIUtil.getDeviceZoom();
539 if (100 == deviceZoom) {
542 final float scaleFactor = deviceZoom/100f;
543 return Math.round (v / scaleFactor);
557 final int deviceZoom = DPIUtil.getDeviceZoom();
558 if (100 == deviceZoom ||
null == v) {
561 final float scaleFactor = deviceZoom/100f;
562 return v.set(Math.round(v.getX() * scaleFactor), Math.round(v.getY() * scaleFactor));
576 final int deviceZoom = DPIUtil.getDeviceZoom();
577 if (100 == deviceZoom ||
null == v) {
580 final float scaleFactor = deviceZoom/100f;
581 return v.set(Math.round(v.getX() / scaleFactor), Math.round(v.getY() / scaleFactor));
612 if(
null == swt_scrollable_clientAreaInPixels ) {
616 final Rectangle r = (Rectangle) swt_scrollable_clientAreaInPixels.invoke(s);
621 }
catch (
final Throwable e) {
627 if(
null == swt_control_locationInPixels ) {
631 return (Point) swt_control_locationInPixels.invoke(c);
632 }
catch (
final Throwable e) {
637 if(
null == swt_control_sizeInPixels ) {
641 return (Point) swt_control_sizeInPixels.invoke(c);
642 }
catch (
final Throwable e) {
655 synchronized(swt_osx_init) {
657 if(
null == swt_osx_view_id) {
658 swt_osx_control_view = Control.class.getField(str_osx_view);
659 final Object view = swt_osx_control_view.get(swtControl);
660 swt_osx_view_id = view.getClass().getField(str_osx_id);
661 h = swt_osx_view_id.getLong(view);
663 h = swt_osx_view_id.getLong( swt_osx_control_view.get(swtControl) );
665 }
catch (
final Exception ex) {
671 h = swt_control_handle.getLong(swtControl);
672 }
catch (
final Exception ex) {
677 throw new NativeWindowException(
"Null widget-handle of SWT "+swtControl.getClass().getName()+
": "+swtControl.toString());
682 public static void setRealized(
final Control swtControl,
final boolean realize)
685 if(!realize && swtControl.isDisposed()) {
688 final long handle =
getHandle(swtControl);
695 callStaticMethodL2V(OS_gtk_widget_realize, handle);
696 }
else if(
null != OS_gtk_widget_unrealize) {
697 callStaticMethodL2V(OS_gtk_widget_unrealize, handle);
711 final long handle =
getHandle(swtControl);
722 throw new UnsupportedOperationException(
"n/a for this windowing system: "+nwt);
736 return X11Lib.GetVisualIDFromWindow(device.
getHandle(), windowHandle);
741 throw new UnsupportedOperationException(
"n/a for this windowing system: "+nwt);
751 final long handle =
getHandle(swtControl);
761 throw new UnsupportedOperationException(
"n/a for this windowing system: "+nwt);
764 public static long newGC(
final Control swtControl,
final GCData gcData) {
765 final Object[] o =
new Object[1];
769 o[0] = ReflectionUtil.callMethod(swtControl, swt_control_internal_new_GC,
new Object[] { gcData });
772 if(o[0] instanceof Number) {
773 return ((Number)o[0]).longValue();
775 throw new InternalError(
"SWT internal_new_GC did not return int or long but "+o[0].getClass());
779 public static void disposeGC(
final Control swtControl,
final long gc,
final GCData gcData) {
783 if(swt_uses_long_handles) {
784 ReflectionUtil.callMethod(swtControl, swt_control_internal_dispose_GC,
new Object[] { Long.valueOf(gc), gcData });
786 ReflectionUtil.callMethod(swtControl, swt_control_internal_dispose_GC,
new Object[] { Integer.valueOf((
int)gc), gcData });
810 OSXUtil.RunOnMainThread(blocking,
false, runnable);
826 public static void invokeOnSWTThread(
final org.eclipse.swt.widgets.Display display,
final boolean blocking,
final Runnable runnable) {
827 if(
null == display || display.isDisposed() || Thread.currentThread() == display.getThread() ) {
829 }
else if( blocking ) {
830 display.syncExec(runnable);
832 display.asyncExec(runnable);
837 public static boolean isOnSWTThread(
final org.eclipse.swt.widgets.Display display) {
838 return null != display && Thread.currentThread() == display.getThread();
846 final long handle =
getHandle(swtControl);
851 final long x11WindowHandle = X11Lib.CreateWindow(x11ParentHandle, screen.
getDevice().
getHandle(), screen.
getIndex(), visualID, width, height,
true,
true);
853 return x11WindowHandle;
857 X11Lib.SetWindowPosSize(device.
getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height);
860 X11Lib.DestroyWindow(device.
getHandle(), x11Window);
912 public static void resizeGDKWindow(
final Rectangle clientArea,
final long gdkWindow) {
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeW...
static synchronized void initSingleton()
Static one time initialization of this factory.
static AbstractGraphicsScreen createScreen(final AbstractGraphicsDevice device, int screen)
Encapsulates a graphics device on MacOSX platforms.
static boolean isOnSWTThread(final org.eclipse.swt.widgets.Display display)
Return true if the current thread is the SWT UI thread, otherwise false.
static final boolean isOSX
static void showGDKWindow(final long gdkWindow)
static void destroyGDKWindow(final long gdkWindow)
static long createCompatibleGDKChildWindow(final Control swtControl, final int visualID, final int width, final int height)
static int autoScaleUp(final int v)
Returns SWT auto scaled-up value v, compatible with DPIUtil#autoScaleUp(int).
static long createCompatibleX11ChildWindow(final AbstractGraphicsScreen screen, final Control swtControl, final int visualID, final int width, final int height)
static Point scaleUp(final Point point, final int zoom)
static void invokeOnOSTKThread(final boolean blocking, final Runnable runnable)
Runs the specified action in an SWT compatible OS toolkit thread, which is:
static void initSingleton()
Call this method, if this class shall be initialized before any other of its methods are called withi...
static long newGC(final Control swtControl, final GCData gcData)
static long getWindowHandle(final Control swtControl)
static long getHandle(final Control swtControl)
static void resizeGDKWindow(final Rectangle clientArea, final long gdkWindow)
static VersionNumber GTK_VERSION()
static int deviceZoomScaleDown(final int v)
Returns SWT derived scaled-down value v, based on DPIUtil#getDeviceZoom() only, not considering highe...
static final boolean isX11GTK
static void destroyX11Window(final AbstractGraphicsDevice device, final long x11Window)
static Rectangle getClientAreaInPixels(final Scrollable s)
Returns the unscaled Scrollable#getClientArea() in pixels.
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.
static int deviceZoomScaleUp(final int v)
Returns SWT derived scaled-up value v, based on DPIUtil#getDeviceZoom() only, not considering higher-...
static Rectangle scaleUp(final Rectangle rect, final int zoom)
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 highe...
static Point getLocationInPixels(final Control c)
static Point getSizeInPixels(final Control c)
static void focusGDKWindow(final long gdkWindow)
static final boolean isWindows
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-...
static float getDeviceScalingFactor()
Returns SWT derived scale-factor based on DPIUtil#getDeviceZoom() only, not considering higher-toolki...
static final boolean isX11
static void disposeGC(final Control swtControl, final long gc, final GCData gcData)
static AbstractGraphicsDevice getDevice(final Control swtControl)
static AbstractGraphicsScreen getScreen(final AbstractGraphicsDevice device, final int screen)
static void printInfo(final PrintStream out, final Display d)
static void resizeX11Window(final AbstractGraphicsDevice device, final Rectangle clientArea, final long x11Window)
static final Class<?> OS_gtk_class
static long gdk_widget_get_window(final long handle)
static int getNativeVisualID(final AbstractGraphicsDevice device, final long windowHandle)
static long gdk_window_get_xdisplay(final long window)
static void setRealized(final Control swtControl, final boolean realize)
static Point autoScaleUp(final Point point)
static boolean useX11GTK()
static long gdk_window_get_xwindow(final long window)
static int autoScaleDown(final int v)
Returns SWT auto scaled-down value v, compatible with DPIUtil#autoScaleDown(int).
static final VersionNumber OS_gtk_version
static Rectangle autoScaleUp(final Rectangle rect)
static boolean isUsingLongHandles()
Encapsulates a graphics device on Windows platforms.
Encapsulates a graphics device on X11 platforms.
A interface describing a graphics device in a toolkit-independent manner.
long getHandle()
Returns the native handle of the underlying native device, if such thing exist.
static int DEFAULT_UNIT
Default unit id for the 1st device: 0.
A interface describing a graphics screen in a toolkit-independent manner.
int getIndex()
Returns the screen index this graphics screen is valid for.
AbstractGraphicsDevice getDevice()
Return the device this graphics configuration is valid for.
Visual ID holder interface.
static final int VID_UNDEFINED
getVisualID(VIDType) result indicating an undefined value, which could be cause by an unsupported que...