diff options
author | Sven Gothel <[email protected]> | 2023-01-31 04:27:30 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-31 04:27:30 +0100 |
commit | ef206c881a9fd462e52241fac506bee5441902ad (patch) | |
tree | 833a96490991b2ce1cb8fbbe3136a8d0d8a4e064 /src | |
parent | 50f07e601a9de0ccad0cdb393898dc01d147cadb (diff) |
Fix NewtFactoryAWT: screen.getMonitor(..) -> screen.getMonitorById(..); Misc left-over changes ..
GDIUtil: Remove uncommented GetMonitorPixelScale(..) point variant
JAWTUtil: Clarify Java version comment w/ spacing
NEWT Display.getThreadName(): Return 'Thread[0x<hash-value>, <name>]'
NEWT Screen: Add getFullyEnteredMonitor(..)
NewtCanvasAWT: @SuppressWarnings for determineIfApplet() and use FQN within method
Diffstat (limited to 'src')
6 files changed, 20 insertions, 10 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index 518abc491..86de6e30d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -664,7 +664,7 @@ public class JAWTUtil { boolean gotSXZ = false; if( !SKIP_AWT_HIDPI ) { if( null != gdGetCGDisplayIDMIDOnOSX ) { - // OSX specific for Java<9, preserving double type + // OSX specific for Java < 9, preserving double type try { final Object res = gdGetCGDisplayIDMIDOnOSX.invoke(device); if (res instanceof Integer) { @@ -676,7 +676,7 @@ public class JAWTUtil { } catch (final Throwable t) {} } if( !gotSXZ && null != gdGetScaleFactorMID ) { - // Generic for Java<9 + // Generic for Java < 9 try { final Object res = gdGetScaleFactorMID.invoke(device); if (res instanceof Integer) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java index 9201c9881..c266fd3f3 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java @@ -250,10 +250,6 @@ public class GDIUtil implements ToolkitProperties { public static boolean GetMonitorPixelScale(final long hmon, final float[] pixel_scale_xy) { return GDI.ShcGetMonitorPixelScale1(hmon, pixel_scale_xy, 0); } - /** - public static boolean GetMonitorPixelScale(final int x, final int y, final float[] pixel_scale_xy) { - return GDI.ShcGetMonitorPixelScale2(x, y, pixel_scale_xy, 0); - } */ public static void SetProcessThreadsAffinityMask(final long affinityMask, final boolean verbose) { SetProcessThreadsAffinityMask0(affinityMask, verbose); diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index de2f698c9..b6e33d619 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -105,6 +105,7 @@ public abstract class Display { * {@inheritDoc} * </p> */ + @Override boolean isGLOriented(); /** @@ -455,7 +456,8 @@ public abstract class Display { } public static String getThreadName() { - return Thread.currentThread().getName(); + final Thread ct = Thread.currentThread(); + return "Thread["+toHexString(ct.hashCode()) + ", " + ct.getName()+"]"; } public static String toHexString(final int hex) { diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index 4c4faef8d..c5c1ee230 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -245,6 +245,18 @@ public abstract class Screen { return monitors.get(0); } + public final MonitorDevice getFullyEnteredMonitor(final RectangleImmutable r) { + final List<MonitorDevice> monitors = getMonitorDevices(); + final int monitorCount = monitors.size(); + for(int i=0; i<monitorCount; i++) { + final MonitorDevice monitor = monitors.get(i); + if( !monitor.isClone() && monitor.getViewportInWindowUnits().contains(r) ) { + return monitor; + } + } + return null; + } + public final MonitorDevice getMonitorById(final int monitorId) { final List<MonitorDevice> monitors = getMonitorDevices(); final int monitorCount = monitors.size(); diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index ae692a2be..7ccab3336 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -29,7 +29,6 @@ package com.jogamp.newt.awt; -import java.applet.Applet; import java.awt.AWTKeyStroke; import java.awt.Component; import java.awt.EventQueue; @@ -458,11 +457,12 @@ public class NewtCanvasAWT extends java.awt.Canvas implements NativeWindowHolder /** See {@link #setSkipJAWTDestroy(boolean)}. */ public final boolean getSkipJAWTDestroy() { return skipJAWTDestroy; } + @SuppressWarnings("removal") private final void determineIfApplet() { isApplet = false; Component c = this; while(!isApplet && null != c) { - isApplet = c instanceof Applet; + isApplet = c instanceof java.applet.Applet; c = c.getParent(); } } diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java index 97625c8aa..6147b3dc0 100644 --- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java @@ -175,7 +175,7 @@ public class NewtFactoryAWT extends NewtFactory { try { final Integer dispID = JAWTUtil.getMonitorDisplayID( gc.getDevice() ); if( null != dispID ) { - res = screen.getMonitor( dispID.intValue() ); + res = screen.getMonitorById( dispID.intValue() ); } if( null == res ) { // Fallback, use AWT component coverage |