aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
Commit message (Collapse)AuthorAgeFilesLines
* Use FloatUtil.isZero(a) w/ build-in FloatUtil.EPSILON directly instead of ↵Sven Göthel2024-02-146-8/+8
| | | | passing FloatUtil.EPSILON to explicit isZero(a, epsilon)
* Bug 1468 - SIGSEGV on use after free when destroying NEWT Window/Display via ↵Sven Gothel2023-10-029-137/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a native dispatch'ed event like key/mouse/touch input SIGSEGV on use after free of native X11 Display* at XEventsQueued in DisplayDriver.DispatchMessages0. This potentially happens when an application destroys the NEWT Window/Display from an action being called directly from DisplayDriver.DispatchMessages0 (itself), i.e. keyboard or mouse input. DisplayDriver.DispatchMessages0 stays in the event loop and the next XEventsQueued call causes a SIGSEGV due to already deleted display driver connection and hence invalid native X11 Display*. This issue also exist for other Windowing System drivers, where the native (dispatch) method sticks to a loop and still (re)uses the window or display handle. One is WindowsWindow, where touch events are looped, but such handler could have closed the window. Querying the status of a window / display instance before dispatching is not be good enough - resource could already be GC'ed, so we also would need to query jobject status - would imply an addition Java callback +++ This fix: Having the Java callbacks return a boolean with the value Window.isNativeValid(). This way the dispatch logic - can bail out right away w/o using the resource anymore - must be reviewed by myself due to changed Call{Void->Boolean}*(..) invocation change. This review shall resolve potential similar issues. +++ Tested on X11/Linux/GNU, Windows and MacOS with new TestDestroyGLAutoDrawableNewtAWT, which tests all destruction invocation variants.
* Bug 1430 - Fix Background erase not disabled with AWT GLCanvas and NewtCanvasAWTSven Gothel2023-09-291-2/+10
| | | | | | | | | | Commit c5431f46b7bf64f109315ec78461859dd88f202a reduced the disableBackgroundErase(..) to SunToolkit's variation which doesn't work on Windows as it does not act upon the java.awt.Canvas peer post addNotify(). This re-introduces the java.awt.Canvas method via class JAWTUtil.BackgroundEraseControl and its called only after addNotify() on Windows and ASAP for everyone else. Method also calles the SunTookit variation just to be sure.
* Bug 1452 - Decouple math functionality to 'com.jogamp.math' to be toolkit ↵Sven Gothel2023-09-206-6/+6
| | | | | | | | | | | | | | | | | | | | agnostic (PMVMatrix, Matrix4f, Vec4f, ..) Math functionality (PMVMatrix, Matrix4f, Vec4f, ..) - shall be used toolkit agnostic, e.g. independent from OpenGL - shall be reused within our upcoming Vulkan implementation - may also move outside of JOGL, i.e. GlueGen or within its own package to be reused for other purposed. The 'com.jogamp.opengl.util.PMVMatrix' currently also used to feed in GLUniformData via the toolkit agnostic SyncAction and SyncBuffer shall also be split to a toolkit agnostic variant. An OpenGL PMVMatrix specialization implementing GLMatrixFunc can still exist, being derived from the toolkit agnostic base implementation. +++ Initial commit .. compile clean, passing most unit tests.
* Debug.debugExplicit(): Define and use explicit symbol debug flag; Use it for ↵Sven Gothel2023-09-161-1/+5
| | | | certain debug output to keep most silence for debugAll()
* HiDPI: Revise AWT GLCanvas/GLJPanel ScalableSurface: No setSurfaceScale(), ↵Sven Gothel2023-05-151-0/+9
| | | | | | | | | | | have AWT toolkit define pixelScale only (simplification) This aligns with Glenn's initial AWT patch commit e5e7514d649cd7dd28bbb8e04b72338dc09c2c83, i.e. removing redundancies... Tested on Linux, Windows and MacOS w/ GLCanvas, GLJPanel and GLWindow using pixelScale values: - Linux: 1, 2 - Windows: 1, 1.25, 2 - MacOS: 1, 2
* HiDPI: Revert WindowImpl.applySoftPixelScale()'s if( DEBUG...) { ..; ↵Sven Gothel2023-05-141-1/+1
| | | | dumpStack(); }
* HiDPI AWT/NEWT: Propagate AWT enforced pixelScale via setSurfaceScale() ↵Sven Gothel2023-05-143-30/+12
| | | | blocking native change by monitor-pixelScale (Windows, X11)
* HiDPI: NEWT/MacOS: WindowDriver.sizeScreenPosInsetsChanged() is called w/ ↵Sven Gothel2023-05-131-1/+1
| | | | client-area in windowUnits (*fix regression*)
* Move png assets (NEWT icons + GLMediaPlayer dummy/test) to simple classpath, ↵Sven Gothel2023-03-137-2/+5
| | | | allowing access w/o jars. TODO: Test Android.
* Clock: Use Clock.currentNanos() instead of System.nanoTime(); Enhancing ↵Sven Gothel2023-03-072-7/+8
| | | | | | FPSCounterImpl accuracy by maintaining timestamps in [ns] Idea: Perhaps we want to use [ns] for FPSCounter's method types by now?
* NEWT DRM EGL/GBM: WindowDriver: Don't issue glFinish() here, as ↵Sven Gothel2023-03-061-2/+2
| | | | eglSwapBuffers(..) already performs this task (TODO: More Tests!)
* NEWT Screen: Allow injection of global (single) monitor size in [mm] via ↵Sven Gothel2023-03-058-26/+68
| | | | | | | | newt.ws.mmwidth and newt.ws.mmheight property This is essential on bare-metal devices where the screen DRM/GBM driver does not provide the screen-size (in mm). Otherwise we would have resolution/(size_mm=0) infinity density and none of our graph font demos would work, as we compute pixel-em-size based using dpi and pixel-pt-size.
* EGLGraphicsDevice: Cleanup and enhance API doc for clarity ...Sven Gothel2023-03-041-4/+1
|
* NEWT Soft-PixelScale (p7): get{Global->}PixelScaleEnv(..): Support per ↵v2.4.0Sven Gothel2023-01-312-8/+27
| | | | | | | | | | | | | | | | | monitor values w/ QT_SCREEN_SCALE_FACTORS syntax, use for X11 Per-monitor values are parsed if value is not a float and stored in a given Map<String,float[2]>, parallel to a detected global_pixel_scale_xy. The per-monitor value syntax matches QT_SCREEN_SCALE_FACTORS, i.e. the regular expression '(<string>=<float>;)+', e.g. QT_SCREEN_SCALE_FACTORS='DP-1=1.25;DP-2=1.25;HDMI-1=1.25;' The per-monitor value is preferred and on X11 stored within the MonitorDevice, matching the MonitorDevice's name. The following env-var names are searched on X11: "QT_SCREEN_SCALE_FACTORS", "QT_SCALE_FACTOR", "GDK_SCALE", "SOFT_SCALE"
* NEWT: MonitorDevice: Add monitor-name, maybe an empty string. Implemented ↵Sven Gothel2023-01-3118-38/+64
| | | | for X11 and Windows for now.
* NEWT WindowImpl: Bring back DEBUG output on positionChanged(..)Sven Gothel2023-01-311-1/+1
|
* NEWT Regression: Move superSizeChangedOffThread() back to iOS/MacOS ↵Sven Gothel2023-01-313-15/+27
| | | | | | | | WindowDriver, used to call the super class method. Regression of commit cfc35549810d3a0fb5eeb866c9450417e48cd8a1 Note to myself: You can't enforce a 'this' method call overridden with a virtual from a subclass.
* Fix comment for WindowImpl.insets: value is in window unitsSven Gothel2023-01-311-1/+1
|
* NEWT Soft-PixelScale (p6): Implement Soft-PixelScale for X11 and Windows ... ↵Sven Gothel2023-01-3116-52/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (working state) Both: - Using Soft-PixelScale mode, i.e. converting all given window-units to pixel-units for native GDI/X11 ops - Using scaled pixel-sized surface - Adjusting NEWT's Monitor's window-unit viewport value to pixel-scale For X11: - Using global scale factor from environment variable, either: "GDK_SCALE", "QT_SCALE_FACTOR" or "SOFT_SCALE". The latter is for testing only. See https://wiki.archlinux.org/title/HiDPI For Windows: - Using actual monitor's pixel-scale via native SHC API (Shellscaling API, shcore.dll) Misc: - SurfaceScaleUtils.getGlobalPixelScaleEnv() reads a float value from given env names, first come, first serve - MonitorModeProps.streamInMonitorDevice(..): Add `invscale_wuviewport` argument to scale wuvieport for soft-pixel-scale - TestGearsNEWT: Enhance GL2 demo to be suitable for manual tests, this since my Windows KVM machine doesn't support ES2 - TestGLContextDrawableSwitch10NEWT: Add a few more test constraints .. working Tested: - Manually on a Windows virtual machine (KVM) using - 2 virtualized 'Video QXL' cards and - and 'remote-viewer' to see the 2 monitors since `Virtual Machine Manager` build-in doesn't support - remote-viewer spice://localhost:5917 - Manually on a Linux machine w/ SOFT_SCALE - Both, X11 and Windows - Place window on each monitor - Move window across monitors w/ pixel-scale change (or not) - TODO: Test and fix utilization with AWT, i.e. NewtCanvasAWT
* NEWT Soft-PixelScale (p5): Add WindowImpl.applySoftPixelScale(..) for ↵Sven Gothel2023-01-311-0/+107
| | | | | | | general usage See MonitorDevice.getOrientationTo(MonitorDevice, int[]) to setup the move_diff as added in commit 43dc472c4797f34e4079028a5eb04bc420c11c2a
* NEWT Soft-PixelScale (p4): WindowImpl: Change SetSizeAction to optionally ↵Sven Gothel2023-01-311-10/+35
| | | | | | set a custom position additionally to size This added functionality is desired when adjusting the window position and size when changing the soft-pixel-scale
* NEWT Soft-PixelScale (p3): WindowImpl.createNativeImpl(..): Add boolean ↵Sven Gothel2023-01-3112-18/+23
| | | | | | positionModified[] return value, allowing to not wait for the previous custom position This is required if createNativeImpl(..) modifies the target position, i.e. due to soft-pixel-scale.
* NEWT Soft-PixelScale (p1): WindowImpl: Separate window and pixel units for ↵Sven Gothel2023-01-3112-197/+365
| | | | | | | | | | | | | | | size and position via atomic-replacable int arrays NEWT's Soft-PixelScale supports software pixel-scale by multiplying the underlying surface pixel-size with the scale-factor and dividing the window position and size by same scale-factor. Hence the window position and size space is kept virtually steady at virtually assumed DPI 96 at higher actual screen DPI and the surface size is adjusted. +++ This window- and pixel-unit separation also includes all callbacks for the native driver implementations, hence the changes native code - allowing to determine whether window- or pixel-units were given.
* Fix NewtFactoryAWT: screen.getMonitor(..) -> screen.getMonitorById(..); Misc ↵Sven Gothel2023-01-311-1/+1
| | | | | | | | | | 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
* NativeWindow: Add getBounds() (moved from NEWT Window) and getSurfaceBounds()Sven Gothel2023-01-311-0/+5
|
* GDIUtil: Add GetMonitor*() variants incl. PixelScale; NEWT MonitorDevice: ↵Sven Gothel2023-01-2914-42/+77
| | | | Add 64-bit nativeHandle (Windows HMONITOR), add PixelScale for Windows
* WindowImpl: Reorder protected methods, groupd callbacks used for native ↵Sven Gothel2023-01-271-175/+202
| | | | callbacks ..
* Execute AWT's Frame.setTitle() on AWT-EDT if already visible (avoid rare ↵Sven Gothel2023-01-221-1/+6
| | | | deadlock)
* Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged()Sven Gothel2023-01-142-5/+5
|
* Bug 1398: Expose NativeSurface implementation's RecursiveLock if utilizedSven Gothel2020-03-051-0/+4
| | | | This prepares proper release of the acquired NativeSurface lock to cure the missing CGLContext lock, see followup commit.
* OSX/SWT Testing: Drop using 'com.jogamp.newt.util.MainThread' enforcing ↵Sven Gothel2020-03-041-1/+14
| | | | | | | | | | | | | | | | | | | default test behavior SWT and OSX's UI TK have their strict threading policy we require to comply with, e.g. see Bug 1398 lately. It doesn't help using our own MainThread vehicle to move the unit test on the OS main thread, as this removes potential causes of deadlocks - which we intend to find and resolve. This patch removed using MainThread altogether from our ant unit testing recipe as well from our manual test scripts. Unit tests are no more executed on the 'main thread'. SWT tests are patched to comply with SWT's UI threading policy. We also catch violations within NewtCanvasSWT and our SWT GLCanvas to provide same behavior on all platforms.
* Bug 1374: NEWT/AWT: Annotation regarding general High-DPI for even non ↵Sven Gothel2020-01-171-0/+15
| | | | | | | | | | | | | | | native DPI toolkit aware platforms (Linux, Windows) NEWT + NewtCanvasAWT: Maybe create "interface ScalableSurface.Upstream { void pixelScaleChangeNotify(final float[] curPixelScale, final float[] minPixelScale, final float[] maxPixelScale); }" to allow downstream to notify upstream ScalableSurface implementations like NEWT's Window to act accordingly. +++ AWT GLCanvas: Add remark where to add the potential pixel scale.
* Bug 1423: NEWT Child Window on OSX: Don't use parent derived location in ↵Sven Gothel2020-01-161-15/+20
| | | | | | fullscreen mode WindowDriver OSX: useParent(..) -> useParentLocation(..) and add !isFullscreen() as a criteria to use the parent derived location.
* NEWT: Enhance FullScreen.run DEBUG output a bit; NEWTDemoListener ignore ↵Sven Gothel2020-01-161-2/+6
| | | | input if not visible.
* NEWT.Window: Refine string representation, renamed append(StringBuilder) -> ↵Sven Gothel2020-01-161-68/+109
| | | | | | | toString(..), added toSimpleString(..) This also revised commit f56adf14deadd4ee8f434ea1293e27bcafdf2a90 Window API addition of 'append(StringBuilder)', which has been renamed to 'toString(StringBuilder)' as aligned to out other classes.
* Bug 1421: NEWT OSX Invisible: Refine 'Fake invisible child window' ↵Sven Gothel2020-01-151-1/+2
| | | | | | | off-viewport position Ensure it stays out of sight by moving it to 2x width/height of viewport. Otherwise one could see the child window moving from lower-right to upper-left ;-)
* NEWT.Window: Add 'StringBuilder append(StringBuilder sb)' supporting ↵Sven Gothel2020-01-151-4/+6
| | | | building custom efficient presentations
* Bug 1421: NEWT OSX Invisible: Implement 'Fake invisible child window'Sven Gothel2020-01-151-6/+26
| | | | | | | | | | | | | | | | | | | 'Fake invisible child window' is implemented by simply moving the window out of sight (viewport). - orderOut0 needs to use '[mWin orderWindow: NSWindowBelow relativeTo:..' parentWindow instead of '[mWin orderBack:..', otherwise the whole parent application gets invisible w/ SWT ;-) - NewtNSWindow may also needs to use parent's Screen instance if moved offscreen, as the own Screen is invalid (zero size) in this case. - WindowDriver: Adding special treatment for 'Fake invisible child window' (tagged as such): -- reconfigureWindowImpl: setWindowClientTopLeftPointAndSize0(..) will be called using the viewport's max position -> out of sight. -- screenPositionChanged: ignore the 'new' position -- sizeChanged: ignore the 'new' size This sensitive NEWT change set shall benefit other toolkits being used as parentWindow besides SWT, as this behavior is the same across MacOS.
* NEWT OSX/IOS WindowDriver: Minor cleanup of local var usage (prefer reuse); ↵Sven Gothel2020-01-142-19/+19
| | | | reconfig: Only orderOut w/ valid window-handle
* Bug 1421, Bug 1358, Bug 969, Bug 672: Fix NEWT's coordinate conversion on ↵Sven Gothel2020-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | MacOS (fixes NewtCanvasSWT on SWT positioning) Newt's OSX Window consist out of NSView wrapped up within its own NSWindow. It's position is being set via its NSWindow's client-area position on screen (frame), which we derive from NSView's client-area position. When NEWT reparents into a new 'window', on OSX it uses the parent's NSView and its NSWindow to attach its own NSView and NSWindow as a subview and childwindow. SWT's OSX implementation uses NSView's for each Compositor, but an individual NSWindow is only established for the Shell (Window). An oversight in Nativewindow and NEWT's coordinate translation: 'top-left view <-> top-left screen' by missing the 'view <-> window' translation caused this whole issue. The oversight occured as NEWT's 'view <-> window' translation had no impact due to its 1-view to 1-window mapping. Fixing the coordinate translation resolves the mess for SWT and for potential other toolkits on OSX. NewtCanvasSWT behaves same on OSX as on X11 etc finally.
* NativeWindow Point.set*(..): Return instance for scaling (chaining)Sven Gothel2020-01-121-2/+1
|
* Bug 1421: Minor commentingSven Gothel2020-01-061-2/+1
|
* Bug 1358: MacOS NEWT WindowDriver / NewtCanvasSWT High-DPI:Sven Gothel2020-01-041-7/+14
| | | | | | | | | | | | | | | | | Even w/ commit fb211581fefc994d1458a2a74801dfb937170f39, propagating the SWT pixelScale to NEWT-Child, hasPixelScale was never updated via updatePixelScale() through native callback [NSView viewDidChangeBackingProperties]! [NSView viewDidChangeBackingProperties] not being called on [created] child windows (NewtCanvasSWT) confused the overal pixelScale state, i.e. no hasPixelScale update via updatePixelScale(..). This change explicitly queries OSXUtil.GetWindowPixelScale(handle) (commit e6d53e29f05a6928192f6c4a988b2aa558be8d65)for: 1) updateMaxScreenPixelScaleByWindowHandle(..), which now updates the actual hasPixelScale after native creation and for 2) setSurfaceScale(..), which directly calls updatePixelScale(..) with the queried actual pixelScale instead of relying on the native callback [NSView viewDidChangeBackingProperties].
* Bug 1393: MacOS: getLocationOnScreen w/ JAWT Parent: Use parent's unblocking ↵Sven Gothel2020-01-021-1/+13
| | | | | | | | | | | | | | | specialization On MacOS, commit 12eed5d38616d23b6e8e2e5b497dfc2f54d90c90 replaced all parent.getLocationOnScreen(..) calls with OSXUtil.GetLocationOnScreen(parentHandle, ..) avoiding the EDT + Appkit Deadlock with native parenting. On MacOS AWT and JAWT are using offscreen CALayer since Java >= 1.7.0, therefor the MacOSXJAWTWindow's native window handle can't be used to gather the screen position via OSXUtil. However, the JAWT Window specialization MacOSXJAWTWindow implements a non-locking code-path and we can decide to use it by querying the general interface OffscreenLayerOption.
* Bug 1156: Seperate DRM/GBM NEWT native library from main head NEWT native ↵Sven Gothel2019-12-2511-12/+32
| | | | | | | | | | | | | | | | library DRM/GBM is enabled for Linux in general. Nativewindow's 'nativewindow_drm' DRM/GBM native library is already seperated. NEWT get its 'newt_drm' DRM/GBM native library. NEWT's main head native library is renamed from 'newt' -> 'newt_head' and is earmarked for further seperation similar to Nativewindow's. At least a 'newt_wayland' will probably followup when support is added. Goal is to remove DRM/GBM dependency for Linux X11 operation as well as removing X11 dependency for Linux DRM/GBM operation.
* Bug 1156: NEWT WindowDriver: Handle case with requested ↵Sven Gothel2019-12-091-2/+2
| | | | CapabilitiesImmutable not being GLCapabilitiesImmutable
* Bug 1156: NEWT Window: Better handling of fixed console case: Not resizable ↵Sven Gothel2019-12-0911-26/+68
| | | | | | | | | | | | | | | | | | | | | | | and not repositionable. Our two fixed size and position console cases 'bcm.egl' and 'egl.gbm' (drm.gbm) only operate in a console like fullscreen mode. We should earmark and expose this behavior, as well as handle it by not waiting for a position / size and not attempting to change position and size. Reducing WindowImpl.minimumReconfigStateMask to bare minimum values: STATE_MASK_VISIBLE | STATE_MASK_FOCUSED; New WindowImpl.mutableSizePosReconfigStateMask extends WindowImpl.minimumReconfigStateMask, representing previous values: STATE_MASK_VISIBLE | STATE_MASK_FOCUSED | STATE_MASK_FULLSCREEN | STATE_MASK_RESIZABLE | STATE_MASK_REPOSITIONABLE; All WindowDriver implementations previously using WindowImpl.minimumReconfigStateMask are now using WindowImpl.mutableSizePosReconfigStateMask but the explicit console driver named above. I would have liked to add the STATE_BIT_FULLSCREEN to the current stateMask to notify this semantics, however this would have lead to more code changes as our fullscreen mode assumes to be 'on top' of the normal mode. Here the normal mode is essentially fullscreen and no back/forth fullscreen setting is useful or allowed. Therefore, both fixed size & position console driver won't expose themselves as being in fullscreen mode.
* Bug 1393: Apply 12eed5d38616d23b6e8e2e5b497dfc2f54d90c90 to IOS, avoiding ↵Sven Gothel2019-12-081-4/+6
| | | | AppKit/EDT deadlock for parent screen location lookup
* Bug 1393: Resolve EDT + AppKit Deadlock with native parenting: Fetch parent ↵Sven Gothel2019-12-081-4/+6
| | | | screen position directly w/o locking.