aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
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 1470 - NEWT/JNI: Perform exception check and rethrow for all Java ↵Sven Gothel2023-10-026-7/+67
| | | | Callbacks as recommended
* Bug 1468 - SIGSEGV on use after free when destroying NEWT Window/Display via ↵Sven Gothel2023-10-0219-376/+550
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-292-4/+20
| | | | | | | | | | 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 1431: Fix NewtCanvasAWT resize on X11, broken since commit ↵Sven Gothel2023-09-293-12/+19
| | | | | | | | | | | | | | | | | | | | | ad38d1559854985b1131e5b6c7274a392b5bc265 Commit ad38d1559854985b1131e5b6c7274a392b5bc265 introduced XTranslateCoordinates(..) to savely validate the client-space window position against the parent (root). Totally missing in this change was the NEWT child window case since it always used the root-window as the destination. This change tracks the parent-window (valid parent Window or NULL) within the JavaWindow struct and either uses the parent-window if available or the root-window for XTranslateCoordinates(..). This results in the proper client-space position. Validated against - TestGearsES2NewtCanvasAWT - TestBug1431NewtCanvasAWT on Debian 12 w/ Java17.
* 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-162-3/+7
| | | | certain debug output to keep most silence for debugAll()
* Animator*: Add ctor variants passing modeBits directly, i.e. enable/disable ↵Sven Gothel2023-08-131-2/+1
| | | | AWT rendering thread support. Adopt it in tests and demos
* HiDPI: Revise AWT GLCanvas/GLJPanel ScalableSurface: No setSurfaceScale(), ↵Sven Gothel2023-05-153-1/+19
| | | | | | | | | | | 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-144-47/+21
| | | | 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*)
* Graph FontScale: Simplify names, fix API doc and add unit testSven Gothel2023-03-281-1/+1
|
* NEWTEvent*.getEventTypeString(): Like MouseEvent, drop redundant leading ↵Sven Gothel2023-03-213-11/+11
| | | | type in returned string
* NEWT MouseEvent.getEventTypeString(): Shorten by removing leading 'EVENT_MOUSE_'Sven Gothel2023-03-191-8/+8
|
* Move png assets (NEWT icons + GLMediaPlayer dummy/test) to simple classpath, ↵Sven Gothel2023-03-1310-8/+11
| | | | allowing access w/o jars. TODO: Test Android.
* Misc: Add MonitorDevice.perMMToPerInch(..); Drop unused ↵Sven Gothel2023-03-092-2/+14
| | | | RegionRenderer.init(..) renderModes argument
* Clock: Use Clock.currentNanos() instead of System.nanoTime(); Enhancing ↵Sven Gothel2023-03-073-9/+11
| | | | | | 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
|
* Font/Graph, {Font, Glyph}/Typecast: Add kerning and expose values in ↵Sven Gothel2023-02-101-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | original font-units (FU) to have them scaled later ( fu * pixelScale / unitsPerEM ) Scaling from font-units (funits, or FU) is now performed by the renderer itself, i.e. applying the scale-factor 'fontPixelSize / font.getMetrics().getUnitsPerEM()' to the PMV matrix to render the whole graph GLRegion. This finally provides proper device and resolution independent font utilization. Further, preliminary kerning has been added. +++ Also ... TypecastFont: - getGlyphID(..) getGlyph(..) enforce symbol mapping to Glyph.ID_SPACE Glyph.ID_CR, as some fonts ave an erroneous cmap (FreeSerif-Regular) - add getKerning(..) TODO: Add binary search - Set TypecastFont.USE_PRESCALED_ADVANCE := false, i.e. dropping all prescaled pixel-sized advance values mapped to font pixel-size as we utilize font-units only for later uniform scaling. - Drop virtual getPixelSize() and add static FontScale.toPixels(..) - Add fullString() for debugging purposed, including some font tables
* 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 X11: Fix positionChanged: We need to translate the 0/0 client position ↵Sven Gothel2023-01-311-1/+22
| | | | | | to the root window (global screen) .. .. otherwise, we might end up receiving a client position of 0/0, while being positioned in a different absolute place within root.
* NEWT MonitorDevice: Fix pixelScale storage, own float[2], don't reuse given ↵Sven Gothel2023-01-311-1/+5
| | | | object
* NEWT Screen: Cleanup get*Monitor*() methodsSven Gothel2023-01-311-15/+25
|
* NEWT: MonitorDevice: Add monitor-name, maybe an empty string. Implemented ↵Sven Gothel2023-01-3121-45/+144
| | | | 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 (p2): MonitorDevice: Add getOrientationTo(..) to ↵Sven Gothel2023-01-311-0/+54
| | | | | | | | | | | | determine the orientation of this monitor to the other incl. the 'move_diff' move_diff int[2] to store the move delta for each axis from this-monitor to the other This will be utilized when a NEWT window moved across monitors to signal the move_diff, which helps to properly adjust the new position. Tested: All 4 monitor crossings right_of, left_of, above and below. TODO: Test and support a 'diagonal' move, i.e. move_diff on both axis.
* NEWT Soft-PixelScale (p1): WindowImpl: Separate window and pixel units for ↵Sven Gothel2023-01-3122-252/+405
| | | | | | | | | | | | | | | 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-314-4/+18
| | | | | | | | | | 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-315-33/+58
|
* GDIUtil: Add GetMonitor*() variants incl. PixelScale; NEWT MonitorDevice: ↵Sven Gothel2023-01-2917-57/+157
| | | | 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)
* NewtCanvasSWT: Drop all newtChild.getDelegatedWindow() debug output due to: ↵Sven Gothel2023-01-171-10/+10
| | | | null com.jogamp.newt.swt.NewtCanvasSWT.access$200(com.jogamp.newt.swt.NewtCanvasSWT)
* NewtCanvasSWT: Remove certain DEBUG output causing an exceptionSven Gothel2023-01-161-2/+4
| | | | Cannot invoke "com.jogamp.newt.Window.getDelegatedWindow()" because the return value of "com.jogamp.newt.swt.NewtCanvasSWT.access$200(com.jogamp.newt.swt.NewtCanvasSWT)" is null
* Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged()Sven Gothel2023-01-145-12/+13
|
* MacOS: NEWT: Remove keySymbol mapping using 'HIToolbox' ↵Sven Gothel2023-01-141-8/+53
| | | | | | | TSMGetInputSourceProperty(), crashing on MacOS >= 13 Perhaps we want a replacement? Fallback code uses keyCode, i.e. dropping the current keyboard layout (-> US).
* Bug 1398: Expose NativeSurface implementation's RecursiveLock if utilizedSven Gothel2020-03-054-0/+19
| | | | 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-042-3/+34
| | | | | | | | | | | | | | | | | | | 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-172-0/+18
| | | | | | | | | | | | | | | 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-162-2/+10
| | | | input if not visible.