summaryrefslogtreecommitdiffstats
path: root/src/nativewindow
Commit message (Collapse)AuthorAgeFilesLines
* Nativewindow Rectangle*: Add contains, scale*(float..) and make ↵Sven Gothel2023-01-312-17/+71
| | | | union(List<Rectangle*>) public; Fix union/intersection 'off-by-1' for pos2.
* GDIUtil: Add GetMonitor*() variants incl. PixelScale (Part-2, adding missing ↵Sven Gothel2023-01-312-0/+106
| | | | | | native header and code files) Part-1 in commit e96aeb6e9acd2b1435f5fad244a1488e74a3a6d6
* GDIUtil: Add GetMonitor*() variants incl. PixelScale; NEWT MonitorDevice: ↵Sven Gothel2023-01-291-0/+22
| | | | Add 64-bit nativeHandle (Windows HMONITOR), add PixelScale for Windows
* SWTAccessor.invokeOnOSTKThread(): Fix comment ..Sven Gothel2023-01-221-2/+1
|
* MacOS: JAWTWindow: Complete MacOS 12+ SIGSEGV JAW Crash Fix; This: Destroy ↵Sven Gothel2023-01-221-5/+12
| | | | | | | | | | | | | | | NSWindow on MacOS main-thread Destroy NSWindow on MacOS main-thread, avoiding spurious more rare SIGSEGV on MacOS 13/aarch64 This closes the MacOS 12+ SIGSEGV JAWT (CALayer) crash fix, see commits: - 4009198e34b50bba9582be24f33eaf83b94a2cb8 - 3c4cf1f37dc27d8d527804d195361a2287575147 - d969f473fdc72c6ca95f1796ff5af3f0c8bd51b6 - 81f395975c06a66183ad36cc43e8dc9bc7f4545b - b8977465b2fb8452c2560a5d2561b2561472edf0 - 470a0ff3a2efbe43404d5f80a403efb38005598a - 9829550f5bcb586f94f98f6d3c39f4d78fd78f3b
* MacOS: JAWTWindow.invalidateNative(): Use copied references in off-thread ↵Sven Gothel2023-01-221-10/+12
| | | | | | operations and zero source references upfront. Have user being aware of disposal then triggered and not later when performed on MacOS main-thread
* MacOS: JAWTWindow's OffscreeLayer: Show semantics in argument names and ↵Sven Gothel2023-01-222-17/+19
| | | | complete null checks in detachSurfaceLayerImpl(), setSurfaceScale()
* MacOS: JAWTWindow.layoutSurfaceLayerImpl(): Perform ↵Sven Gothel2023-01-222-6/+14
| | | | OSXUtil.FixCALayerLayout() on main thread and hence fetch and validate getAttachedSurfaceLayer() when needed
* OSXMisc.m: Show semantics: caLayer -> rootCALayerSven Gothel2023-01-221-15/+14
|
* JAWTWindow.ctor: Initialize offscreenSurfaceLayer before useSven Gothel2023-01-211-1/+1
|
* JAWTWindow.invalidateNative() and .detachSurfaceLayerImpl(): Pass copy of ↵Sven Gothel2023-01-214-15/+17
| | | | offscreenSurfaceLayer for pending off-thread operation and immediately zero reference marking its future destruction.
* Don't import conditional platform specific 'static' code but fully qualify ↵Sven Gothel2023-01-201-32/+18
| | | | names when in use, make Android d8 (Dex'ing) happy
* JAWTWindow: Constrain AppContextInfo creation where offscreen layer is ↵Sven Gothel2023-01-182-2/+13
| | | | supported (MacOS only)
* JAWTWindow: Remove java.applet.Applet detection .. it's gone :-(Sven Gothel2023-01-181-8/+12
|
* SWT+AWT: Ensure SWTAccessor gets called before AWT initialization on GTK/X11 ↵Sven Gothel2023-01-161-0/+12
| | | | to avoid "cannot register existing type 'GdkDisplayManager'" and subsequent SIGSEGV
* SWTAccessor: Adopt to SWT 4.26Sven Gothel2023-01-161-32/+27
|
* Merge pull request #108 from PeterC-DLS/swt-420-fixSven Gothel2023-01-161-1/+9
|\ | | | | Add new class location of SWT's gtk_widget_get_window
| * Add new class location of SWT's gtk_widget_get_windowPeter Chang2022-04-141-1/+9
| | | | | | | | | | | | | | In SWT version 4.20, some gtk methods moved to a new gtk3 subpackage so add check and find it in there. Note, this new package was not exported until SWT 4.23 (aka 3.119.0 or v4950) so intervening versions will not work when using OSGi class loading.
* | JAWTUtil: Cleanup MacOS JVM and OS version flags: Private and store ↵Sven Gothel2023-01-151-14/+16
| | | | | | | | comparison result
* | Replace AccessController.doPrivileged() w/ SecurityUtil.doPrivileged()Sven Gothel2023-01-1413-28/+30
|/
* Bug 1398: Expose NativeSurface implementation's RecursiveLock if utilizedSven Gothel2020-03-052-0/+24
| | | | 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-13/+21
| | | | | | | | | | | | | | | | | | | 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.
* IOSUtil.IsMainThread(): Utilize caching ThreadLocal<Boolean> like OSXUtil's ↵Sven Gothel2020-02-241-1/+17
| | | | variant.
* Bug 1422: Use own deviceZoomScaleUp(..) disregarding higher-toolkit's ↵Sven Gothel2020-01-161-10/+144
| | | | | | | | | | | | | | | | | | | compensation like 'DPIUtil.useCairoAutoScale()' We can't use DPIUtil's 'autoScaleUp(..)' method on non-native DPI scaling platforms as it uses a scale-factor of 1f if the higher toolkit compensates, i.e. 'DPIUtil.useCairoAutoScale()'. Since NEWT uses X11 and GDI directly, which are not DPI scale-aware, we have to drop the semnatics of 'DPIUtil.useCairoAutoScale()' and merely use the actual 'deviceZoom'. This was proposed by Marcel Au in the first place. At least I understand these semantics by now. +++ Additionally NewtCanvasSWT.SWTNativeWindow needs to return the 'deviceZoomScaleUp(..)' values for returning its size in window- and pixel-units (surface).
* Bug 1422: Emulate DPI Scaling on non-native DPI autoscale platforms (!MacOS)Sven Gothel2020-01-151-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | Bug 1422 shows that it seems to be desired to emulate DPI scaling where the native toolkit does not implmement the same. On GTK, DPIUtil.mapDPIToZoom (int dpi) reads: double zoom = (double) dpi * 100 / 96; int roundedZoom = (int) Math.round (zoom); return roundedZoom; While having dpi calculated as: dpi = 96 * GDK.gdk_monitor_get_scale_factor(monitor); Well, this seems to exist to allow 96 dpi fixed layout to 'look' OK on high-dpi screens. However, you get in trouble if you layout high-dpi aware, i.e. using percentages etc. There is one exception: If DPIUtil.useCairoAutoScale() is true, scalingFactor is 1f and hence the scaling emulation dropped. 'DPIUtil.setUseCairoAutoScale((sx[0]*100) == scaleFactor || OS.isGNOME);'
* Nativewindow Rectangle*: Cleanup up union(..), intersection(..): Return a ↵Sven Gothel2020-01-152-26/+21
| | | | | | new Rectangle instance (mutable) Also return 'this' for setter methods for chaining.
* Bug 1421, Bug 1358, Bug 969, Bug 672: Fix NEWT's coordinate conversion on ↵Sven Gothel2020-01-133-74/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+19
|
* Bug 1421: OSXUtil: Add GetLocation(..), simply returning the view's frame ↵Sven Gothel2020-01-062-0/+44
| | | | position
* Bug 1358: GLCanvas: Call new OSXUtil.SetWindowPixelScale(..) when GLCanvas ↵Sven Gothel2020-01-052-3/+43
| | | | | | gets realized on MacOS This fixes GLCanvas's High-DPI scaled size issue on MacOS of Bug 1358.
* Bug 1421, Bug 1358, Bug 969, Bug 672: SWTAccessor: Add ↵Sven Gothel2020-01-051-1/+74
| | | | get[Location|Size]InPixels(..) and getLocationOnScreen()
* Bug 1358: Add OSXUtil.GetWindowPixelScale(..)Sven Gothel2020-01-042-1/+52
| | | | | It is now possible to retrieve the pixel scale [NSWindow backingScaleFactor] after native creation by NEWT - as we have changed the lifecycly (all-in-one native method on AppKit)
* Merge remote-tracking branch 'xranby/master'Sven Gothel2019-12-041-4/+14
|\
| * VC4: Only load Broadcom EGL driver when guessVCIVUsedXerxes Rånby2019-12-041-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Broadcom VC IV can be used from both console and from inside X11 When used from inside X11 rendering is done on an DispmanX overlay surface while keeping an X11 nativewindow under as input. When Broadcom VC IV is guessed only the Broadcom DispmanX EGL driver is loaded. Therefore standard TYPE_X11 EGL can not be used.
* | Bug 1406: DRMUtil: Probe DRM device whether it has resources attached (and ↵Sven Gothel2019-12-041-2/+41
|/ | | | | | | | | | | | | | | | | | | | is the desired one) First issue was that the proper DRM file had to be queries, as Raspberry 4 may have two of them: <-- /dev/dri/dri0 /dev/dri/dri0 /dev/dri/by-path/platform-fec00000.v3d-card -> ../card0 /dev/dri/by-path/platform-soc:gpu-card -> ../card1 --> This patch attempts to probe all /dev/dri/card[0..99] using this arbitrary range. The test loop ends if: - drmOpenFile succeeds and drmModeGetResources delivers non-null value - the iterated probed file doesn't even exist - 100 files has been tested ;-)
* Bug 1156 - Implement DRM/GBM Support for JOGL(EGL) and NEWTSven Gothel2019-11-288-7/+684
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding new classes DRMLib (gluegen of drm + gbm), DRMUtil and DRMMode GBMDummyUpstreamSurfaceHook to new package jogamp.nativewindow.drm, allowing full awareness of DRM + GBM within NativeWindow for JOGL + NEWT. DRMMode replaces the previous native code of collecting drmMode* attributes: active connector, used mode, encoder etc and also supports multiple active connectors. DRMUtil handles the global static drmFd (file descriptor), currently only the GNU/Linux DRM device is supported. GBMDummyUpstreamSurfaceHook provides a simple dummy GBM surface. NativeWindow provides the new nativewindow_drm.so and nativewindow-os-drm.jar, which are included in most 'all' jar packages. build property: setup.addNativeEGLGBM -> setup.addNativeDRMGBM Changes NativeWindowFactory: - TYPE_EGL_GBM -> TYPE_DRM_GBM while keeping the package ID of '.egl.gbm' for NEWT (using EGL) - Initializing DRMUtil at initialization Changes EGLDrawableFactory: - Using native GBM device for the default EGL display creation instead of EGL_DEFAULT_DISPLAY. This resolves issues as seen in Bug 1402, as well in cases w/o surfaceless support. - GL profile mapping uses surfaceless when available for GBM, otherwise uses createDummySurfaceImpl (dummy GBM surface via GBMDummyUpstreamSurfaceHook) - createDummySurfaceImpl uses a dummy GBM surface via GBMDummyUpstreamSurfaceHook - DesktopGL not available with GBM, see Bug 1401 NEWT's DRM + GBM + EGL Driver - Using DRMLib, DRMUtil and DRMMode, removed most native code but WindowDriver swapBuffer - ScreenDriver uses DRMMode, however currently only first connected CRT. - WindowDriver aligns position and size to screen, positions other than 0/0 causes DRM failure - WindowDriver reconfigure n/a NEWT TODO: - DRM Cursor support (mouse pointer) - Pointer event handling
* Bug 1156: GBM: Bring up incl GL rendering (TODO: GBM working page flip / sync)Sven Gothel2019-11-231-0/+4
| | | | | | | | | | | | | | | | | - EGLSurface: Factor out 'eglCreate[Platform]WindowSurface' NEWT egl.gbm.WindowDriver -- Properly use GBM fourcc format and use as visualID for GBM surface creation and EGL config selection -- Create eglSurface within this class -- Hook up GBM/DRM page flip (not working yet, no visible artifacts - no swap) - ProxySurfaceImpl.surfaceSwap() call upstreamSurface's implementation if available TODO: 'Permission denied' calling: - drmSetMaster (optional) - drmModeSetCrtc - drmModePageFlip
* Bug 1156: EGL-GBM: Fix NativeWindowFactory native-window-type query ↵Sven Gothel2019-11-222-58/+72
| | | | | | | | | | | | | | | | | | according to Bug 1156 - Special files like '/dev/dri/card0' can't be tested via isFile(), use exists() Order for GNU/Linux (and other unices) IMHO is 1) Display Server (Vendor neutral) 1.1) running X11 display server (DISPLAY check enough?) 1.2) running WAYLAND display server (WAYLAND_DISPLAY check enough?) 2) Console Mode Vendor Neutral 2.1) GBM (how to check?) 3) Console Mode Vendor Specific 3.1) VCIV (how to check)
* Bug 1156: EGL-GBM: Fix Cleanup (Newt package relocation / hack default GBM)Sven Gothel2019-11-211-8/+8
| | | | Now: TYPE_EGL_GBM == ".egl.gbm"
* gbm/WindowDriver: make it compile and linkXerxes Rånby2019-11-211-1/+1
|
* detect gbm platform on linux when no other display server is runningErik De Rijcke2019-11-211-5/+43
|
* MacOS: Add more debug log detailsSven Gothel2019-11-212-16/+49
|
* Bug 1393: OSXUtil: Optionally inject Apple's 'Main Thread Checker'java11iosSven Gothel2019-09-091-2/+21
| | | | | | | | To allow proper testing of whether all AppKit calls are performed on its Main-Thread where required, we inject the libMainThreadChecker.dylib when property 'nativewindow.debug.OSXUtil.MainThreadChecker' is set. See <https://developer.apple.com/documentation/code_diagnostics/main_thread_checker?language=objc> Lib-Name: /Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib
* OSXUtil::IsMainThread() Utilize ThreadLocal storage flag avoiding ↵Sven Gothel2019-09-081-24/+19
| | | | unnecessary JNI calls
* Buig 1389: Fix SIGSEGV on OpenJDK11 on [NSApplicationAWT sendEvent:]Sven Gothel2019-09-084-8/+18
| | | | | | | | | | | | | | | | | | | | | | Culprit of the crash and the non propagated action on NSApp main-thread was _simply_ our OSXUtil_KickNSApp() 'kick alive' NSApplicationDefined NSEvent sent to the NSApp. Java11's NSApp code overrides sendEvent and handles NSApplicationDefined + subtype=ExecuteBlockEvent using the given data1 as a function pointer. 8-O ExecuteBlockEvent defined as 0, which we have sent. Simply passing subtype=8888 avoids this side-effect. Whether it is still required to KickNSApp() is another question. +++ Further, make code a bit more robuts regarding the offscreenSurfaceLayer at JAWTWindow invalidate. I.e. if still not detached, do the late cleanup there. This just in case the OSX Context callback to disassociate the drawable has been missed.
* Bug 1392: Simplify CapabilitiesFilter: Criteria -> Test, remove ↵Sven Gothel2019-09-071-20/+17
| | | | RemovalCriteria as all Test definitions may be used for anything.
* Bug 1392: Add CapabilitiesFilter and GLCapabilitiesFilter supporting diverse ↵Sven Gothel2019-09-071-0/+164
| | | | | | | | reusable [GL]CapabilitiesImmutable list filter To implement fix for Bug 1392, we have to remove certain GLCapabilitiesImmutable from the availability list. These filter provide a a clean reusable utility for the fix.
* Bug 1363: Java 11: Utilize UnsafeUtil.doWithoutIllegalAccessLogger(..) ↵Sven Gothel2019-09-043-53/+84
| | | | | | | | | | avoiding further unnecessary warnings Access to said internal non-exported methods is essential. See commit c5431f46b7bf64f109315ec78461859dd88f202a. Further added verbose DEBUG output where applicable.
* Bug 1363: Java 11: JAWTUtil: Use sun.awt.SunToolkit.awtLock/Unlock and ↵Sven Gothel2019-09-041-65/+120
| | | | | | | | | | | | | | | disableBackgroundErase (impl. semantics) Commit 13c6bbbde5ea476d60e0a2f04a5172d3302d0edd simply removed the AWT commonly used SunToolkit lock/unlock methods, which was incorrect. It lead to certain resources access collisions as access has to be synchronized using the same reentry lock across AWT and NativeWindow/JOGL. We utilize the new com.jogamp.common.util.UnsafeUtil of GlueGen commit 07c1885e9a3d1f3a3853414648c06fb3864bc69f to disable the IllegalAccessLogger while fetching the methods/fields and making them accessible. JAWUtil also hosts access to SunToolkit's disableBackgroundAccess(Component) aligning the code for GLCanvas, NewtCanvasAWT and AWTCanvas.
* Bug 1363: Java 11: Resolve unsupported JAWTUtil.getMonitorDisplayID(..)Sven Gothel2019-08-191-5/+11
| | | | | | | | | | | | | | | | | Previous commits removed access to OSX's GraphicsDevice.getCGDisplayID() on Java9+, avoiding illegal reflective access. Here we JAWTUtil.getMonitorDisplayID(..) simply returns null if Java9 or !OSX, so the sole NewtFactory caller falls back to the alternative working solution. Orig patch Wade Walker: This was used on Mac OS only to create a MonitorDevice in NewtFactoryAWT. But there was a fallback method for creating MonitorDevice, and testing with TestGearsES2GLJPanelAWT shows that the fallback method seems to give identical results on Mac, so changed to just use the fallback method (which is now the only method) everywhere. This gets rid of an illegal reflective access.