aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/X11Window.c
Commit message (Collapse)AuthorAgeFilesLines
* Bug 1468 - SIGSEGV on use after free when destroying NEWT Window/Display via ↵Sven Gothel2023-10-021-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 1431: Fix NewtCanvasAWT resize on X11, broken since commit ↵Sven Gothel2023-09-291-7/+10
| | | | | | | | | | | | | | | | | | | | | 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.
* NEWT Soft-PixelScale (p1): WindowImpl: Separate window and pixel units for ↵Sven Gothel2023-01-311-1/+1
| | | | | | | | | | | | | | | 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.
* Bug 1156: NEWT Window: Better handling of fixed console case: Not resizable ↵Sven Gothel2019-12-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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 1413 - NEWT X11Window: NewtWindows_getFrameExtends(..) may hang on ↵Sven Gothel2019-12-061-16/+26
| | | | | | | | | | | XPeekEvent(..) The wait loop uses XPeekEvent(dpy, &e), which can block indefinite if queue is empty. Replace with timeout only _and_ only wait on CreateWindow0(..) not when queried via X11Display dispatch loop on events when it is assumed the information has been propagated already.
* Bug 1412 - JNI: NEWT Check & Handle Exception after calling back into Java ↵Sven Gothel2019-12-061-0/+2
| | | | (X11Display + X11Window)
* Bug 1394 - NEWT X11Window didn't gather inset at window creation (properly)Sven Gothel2019-09-111-16/+46
| | | | | | | | | | | | | | X11Window.c's 'NewtWindows_getFrameExtends(..)' retrieves the insets via XGetWindowProperty on _NET_FRAME_EXTENTS. Right after window creation this method fails as the WM did not yet provide the information as the window has not yet been mapped. Implementation needs to retry for a certain amount of time (250ms) and maximum number of attempts (96 XEvent). This issue surfaced while validating fix for Bug 1393, testing TestDisplayLifecycle02NEWT also on X11.
* NEWT Cleanup: WindowImpl: Drop unused 'defer' argument (state change only): ↵Sven Gothel2019-09-101-1/+1
| | | | insetsChanged + insetsVisibleChanged
* NEWT Cleanup: WindowImpl::visibleChanged(ZZ): Remove unused 'defer' ↵Sven Gothel2019-09-101-1/+1
| | | | argument. Method only changes state.
* Bug 1348: Fix X11 XI MultitouchSven Gothel2019-03-271-57/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I got access to a touchscreen laptop w/ Debian 9, hence I could fix and test the implementation. X11 DisplayDriver.java: - Store and pass through xi_opcode of XI extension, queried at initialization stage X11Window.c Fixes: - Initialize JavaWindow's xiTouchCoords[].id w/ -1, as required to track the pointer - Pass through xi_opcode as stored in X11 DisplayDriver X11Display.c Fixes: - sendTouchScreenEvent: Throw RuntimeException if 0 > actionId (Internal Error: based on xiTouchCoords[].id tracking) - DispatchMessages's windowPointer determination: -- Query potenial XI Event first: IF XI Event, must use XIDeviceEvent's event Window -- Only IF not an XI Event, we can use evt.xany.window as the event window - DispatchMessages's XI Event Handling: -- Always break deviceid search loop if id found, preserving index and time spend Works on my Debian 9 device, tested w/ com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT: - One pointer (finger) press, drag and release (click) - PinchToZoomGesture works - DoubleTabScrollGesture works +++ Potential Issues: JavaWindow's xiTouchCoords[].id accuracy is crucial to pointer tracking during XI_TouchBegin -> XI_TouchUpdate -> XI_TouchEnd. In the normal course of action: - XI_TouchBegin sets the id, assuming it is yet set - XI_TouchUpdate assumes it is set - XI_TouchEnd clears the id, assuming it is set This field in the JavaWindow array only gets reset to -1 once at native window creation. We may need to figure out when to reset this field to -1. If the XI_TouchEnd events would get lost for whatever reason, the above tracking state would be broken.
* Bug 1348: X11 XI Multitouch: Refine commit ↵Sven Gothel2019-03-271-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 746383476aa449e9cab4a25df27be85b61aa074b Add more verbose DBG_PRINT - @ CreateWindow: extension, scanning device/class, registered deviceid - @ DispatchMessage: XI_TouchBegin, XI_TouchUpdate and XI_TouchEnd On my test machine w/o a touchscreen I correctly: - detected extension - detected no XITouchClass device, hence no deviceid registered X11: [CreateWindow]: XI: Window 0x6600016, Extension 131 X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[2/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[3/13].class[1/3]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[3/13].class[2/3]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[3/13].class[3/3]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[4/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[5/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[6/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[7/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[10/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[11/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[13/13].class[1/1]: type 0 (is XITouchClass 0)
* Bug 1348: X11 XI Multitouch: Fixes of previous commit ↵Sven Gothel2019-03-271-37/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 92006e4baef57f1f3fb647dd307aed5989fd4c8d Previous commit 92006e4baef57f1f3fb647dd307aed5989fd4c8d (Note to Danny: I cannot test this now - please re-test and/or review) X11Common::JavaWindow - Owns XI extension's xiOpcode, selected xiTouchDeviceId and tracked XITouchPosition array X11Window::CreateWindow - Query XI extension only once @ window creation and earmark xiOpcode in JavaWindow instance - Fix: Device selection code was "class->type != XITouchClass", but shouldn't it be 'XITouchClass == class->type' (as patched here) - Fix: Free XIQueryDevice returned XIDeviceInfo array via XIFreeDeviceInfo - Earmark deviceid in JavaWindow instance X11Display - Moved global static touch_coordinates to JavaWindow::xiTouchCoords instance X11Display::DispatchMessage - Changed event handling structure similar to https://keithp.com/blogs/Cursor_tracking/ - Fix: Free XGetEventData's optional memory allocation via XFreeEventData - Reuse JavaWindow's queried xiOpcode - Fix: Don't overrise windowPointer, instead validate and require a match. JavaWindow must match! - Fix: Also validate chosen deviceid with JavaWindow's registered device Newt Build: - Added libXi in build recipe and doc
* add touch event support for x11 serverDanny Koernig2016-11-171-0/+44
|
* Bug 1249: NEWT/X11 Visibility: Listening to more events for updated state; ↵Sven Gothel2015-10-101-0/+1
| | | | | | | | | | | | | | | | | Adding QUIRK_BIT_VISIBILITY 1) More visibility detection on post ConfigureNotify events, since the latter may not yet contain the updated visibility state as it whould (WM bug!): - EnterNotify - LeaveNotify - Disabled - Expose - VisibilityNotify 2) Introducing quirks. Setting QUIRK_BIT_VISIBILITY to handle the issue where visibility -> false could not even be set.
* Bug 1249 - NEWT X11: setVisible(*) _NET_WM_STATE_HIDDEN update not received ↵Sven Gothel2015-10-091-15/+22
| | | | | | | | | | | | | | | | | | | | | | at ConfigureNotify event (2) On gnome shell WM, sometimes KDE WM, it has been observed that the _NET_WM_STATE_HIDDEN update (visible or invisible) is not received at ConfigureNotify event. Turns out the state is finally updated at FocusOut! This change tests _NET_WM_STATE_HIDDEN visibility hint for mapped window also for FocusIn and FocusOut events, besides the ConfigureNotify event. Further more, NormalState to restore a hidden but mapped window did not work, so it is no more being sent. We limit us here to _NET_ACTIVE_WINDOW. 2 unit tests are prepared to test this issue: - TestGLWindows00NEWT - TestParenting01NEWT
* Bug 1249 - NEWT X11: setVisible(false) IconicState not listening to ↵Sven Gothel2015-10-081-89/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _NET_WM_STATE_HIDDEN; setVisible(true) not restoring from _NET_WM_STATE_HIDDEN Using Gnome Shell 3.14.4-1~deb8u1 disclosed an issue w/ our newly utilized IconicState/_NET_WM_STATE_HIDDEN, i.e. visibleChanged(false) was never received. This is a regression of commit 2d837a7a7130702ad36b694875613fae77c7ef06, which utilizes WM_CHANGE_STATE_IDX + IconicState for visibility on top-level windows. This bug consist out of _two_ isssue: 1) setVisible(false) IconicState not listening to _NET_WM_STATE_HIDDEN Here, we 'listen' to _NET_WM_STATE_HIDDEN when receiving ConfigureNotify if supported _and_ XMapWindow has been issued. In such case existence/non-existence of _NET_WM_STATE_HIDDEN determines visibility. Otherwise, we have wait for MapNotify/UnmapNotify. The 'XMapWindow has been issued' criteria is tracked by new field 'JavaWindow.isMapped' and set/cleared when we actually issue XMapWindow/XUnmapWindow! 2) setVisible(true) not restoring from _NET_WM_STATE_HIDDEN It has been observed that restoring IconicState/_NET_WM_STATE_HIDDEN via XMapWindow or even NormalState may not work reliably on WMs. See <https://stackoverflow.com/questions/30192347/how-to-restore-a-window-with-xlib> Hence we restore from this WM state via NormalState _and_ _NET_ACTIVE_WINDOW. Both strategies seem to work well on KDE as well as on Gnome.
* Bug 1205 - NEWT Security: Clear framebuffer after creation and before ↵Sven Gothel2015-08-311-10/+9
| | | | | | | | | | | | | | | | visibility (X11 Onscreen) X11Window.c: Adding CWBackPixel BlackPixel(..) resulting in an initial black window (zero). com.jogamp.opengl.test.junit.newt.TestWindows02NEWT shows the content w/ opaque background and transparent one. Note: To be able to receive a transparent background, one needs to utilize a compositor WM (e.g. KWin w/ effects enabled). Due to commit cf9e2f2cb8ead7efd7751dcbfaecb36ed06cf9d6 (Bug 1210) this works in pure NEWT mode w/o utilizing GLX.
* Bug 1188: Introduce getSupportedStateMask() implemented via WindowDriver's ↵Sven Gothel2015-08-211-2/+30
| | | | | | | | | | | | | getSupportedReconfigMaskImpl() - See getSupportedStateMask() for semantics - getSupportedReconfigMaskImpl() result now used for isReconfigureMaskSupported() - getSupportedReconfigMaskImpl() implementations: - Full featured: X11, Windows and OSX - X11: Use WindowManager Atoms for certain features (dynamic) - Others: Use fixed features. - TODO: Consider avoiding actions if not supported.
* Bug 1188: Refine Maximized on X11 / Impl. Maximized and Iconify on WindowsSven Gothel2015-08-121-46/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | WindowImpl - remove updateMinMaxSize(..) - unused info - fix appendStateToString: show all maximized state changes if reconfig - add sizePosMaxInsetsChanged(..) and sendMouseEventRequestFocus(..) accumulating multiple callbacks from impl. - add: maximizedChanged(..) notification from native impl. - refine manual maximized mode used for OSX and Windows (single extent) - reconfigMaximizedManual(..) - resetMaximizedManual(..) X11 WindowDriver: - Update maximized at xreconfig, read from _NET_WM_STATE - Use less Java callbacks from JNI Windows WindowDriver: - Use native maximized, if HORZ && VERT, otherwise use manual maximized for single extent. - Invisible of top-window -> MINIMIZED/ICONIFY showing the app in task-bar.
* Bug 1188: Fix regression on X11 setVisible: in-visibility never reached on ↵Sven Gothel2015-08-111-5/+8
| | | | | | | | | child windows It has been experienced that UnmapNotify is not sent for child windows when using IconicState! Hence the visible:=false event never reaches the Window, causing an error. This patch only uses IconicState for top-level windows and if requested.
* Bug 1188, Bug 1186: NEWT Window: Support non-resizable, minimize, maximize, ↵Sven Gothel2015-08-101-303/+617
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | alwaysOnBottom and sticky/all-desktop (Part 1) Change also implements Bug 1186: 'NEWT Window: Use a Bitfield holding all state flags and expose it accordingly', since it is essential for an efficient implementation. Part 1: - Bug 1186 - Using Bitfield, holding public (Window) and private state bits/mask - Bug 1188 - Window adds: - [is|set]AlwaysOnBottom(..), - [is|set]Resizable(..), - [is|set]Sticky(..), - [is|set]Maximized(..), - isChildWindow(), - Full implementation for X11 - TODO: Implement for OSX and Windows - Manual tests: - TestGearsES2NEWT, TestGearsES2NEWTSimple and TestGearsES2NewtCanvasAWT utilize new NewtDemoListener, which has a key-listener to perform all [new] actions. See source code of NewtDemoListener.
* Bug 1147 - Fix XRandR13 Usage: Rotate / Change-Mode, use unique CRTC/Mode ↵Sven Gothel2015-03-201-2/+4
| | | | | | | | | | | | | | | | | | | | | ids, .. RandR 1.3 XRRSetCrtcConfig related: - X11RandR13 now sets the new screen size via XRRSetScreenSize(..) - X11RandR13 now propagates RRScreenChangeNotify events via XRRUpdateConfiguration(event). Hence reporting virtual desktop size now. - X11RandR13 now disables the CRTC before XRRSetCrtcConfig(..) to avoid invalid configuration (see spec)! RandR 1.3 General: - Uses unique id named instead of unstable index for modes and CRTC. This allows proper identification even for 'swizzled' devices.
* Bug 1135 - Cleanup: Fix native code WarningSven Gothel2015-03-061-1/+1
|
* X11: Harden usage of 'XGetWindowProperty(..)' and 'XGetVisualInfo' - Add ↵Sven Gothel2014-01-111-28/+38
| | | | missing XFree(..) calls and argument checks.
* Bug 935: NEWT PointerIcon: Utilize Toolkit Agnostic PixelFormat and ↵Sven Gothel2014-01-081-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conversion Utilities (Allowing 'arbitrary' PointerIcon data input) Commit fe28bc125429b38cdcd016746081f4a6d521c6fd added the notion of toolkit agnostic PixelFormat and conversion utilities, utilized and further tested by this patch. +++ - PointerIcon is a PixelRectangle and hence holds the decoded data. This allows on-the-fly conversion if required as well as recreation w/o PNG re-decoding. - Using array-backed PointerIcon data where possible, allowing better performance when converting PixelFormat etc. - NEWT Display adds 'createPointerIcon(final IOUtil.ClassResources pngResource...' method to support agnostic PointerIcon creation. - NEWT Display adds methods to allow users to avoid PixelFormat and Buffer NIO type forced conversion: - PixelFormat getNativePointerIconPixelFormat() - boolean getNativePointerIconForceDirectNIO() +++ PNGImage -> PNGPixelRect Deleted: com.jogamp.opengl.util.texture.spi.PNGImage Added: com.jogamp.opengl.util.PNGPixelRect (We hope nobody was using PNGImage directly since it was a service-plugin for TextureIO) PNGPixelRect is a PixelRectangle PNGPixelRect actually is implemented OpenGL agnostic, however - since our PNGJ support lives under package 'jogamp.opengl.util.pngj' it cannot be moved up (yet). PNGPixelRect now handles all PixelFormat for the target format and also added support for grayscale+alpha (2 channels). The latter is force-converted to RGB* - similar to paletted. Further more, PNGPixelRect allows simply passing an OutputStream to write the PNG data. Used by: TextureIO and NEWT +++ - OffscreenSurfaceLayer's setCursor(..) uses the agnostic PixelRectangle instead of a PNG resource. - AWTMisc uses the PixelRectangle to produce the AWT Cursor and converts it to the required format. Hence same pixels are used for NEWT and AWT pointer/cursor icon. - TestGearsES2Newt and NewtAWTReparentingKeyAdapter 'tests' iterate over 3 custom PointerIcon when pressed 'c'. - JOGLNewtAppletBase uses the new custom PointerIcon 'newt/data/crosshair-lumina-trans-32x32.png', which is included in NEWT (213 bytes only). -
* Bug 934, Bug 935: NEWT: Add support for custom Application/Window and ↵Sven Gothel2013-12-311-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pointer Icons - Utilizing JOGL's PNG decoder for all icons, if available. - Application/window icons: - Providing default application/window icons in 16x16 and 32x32 size - NewtFactory.setWindowIcons(..) or property 'newt.window.icons' maybe used to override default icons. - Using icons at application/window instantiation - Display.PointerIcons: - NativeWindow Win32 WindowClass no more references a default cursor in favor of fine grained cursor control [in NEWT] - Display provides create/destroy methods, where display destruction also releases open PointerIcon references. - Window.setPointerIcon(..) sets custom PointerIcon - Implemented Platforms - X11 - Windows - OSX - Manual Test: TestGearsES2NEWT (Press 'c')
* Bug 924: Make ALWAYS_ON_TOP Persistent when Reparenting (child -> top) (2nd ↵Sven Gothel2013-12-201-4/+0
| | | | | | | | | | | | attempt) Commit c8726ef04b94ad8e66e1191a06ff793b908d130c reinforced ALWAYS_ON_TOP in native reconfig code issued at reparenting call, which might be too early for the WM. Perform ALWAYS_ON_TOP reinforcement from java side when reparenting CHILD -> TOP was successful and visibility is reached. X11 only! NewtAWTReparentingKeyAdapter: Add 'a' alwaysOnTop toggle to test w/o applet code.
* Refine commit c9fcc8cd510abc0cbebb872dc3e457327655e778 (NEWT X11Window.c ↵Sven Gothel2013-12-201-8/+8
| | | | comments)
* Bug 924: Fix X11 Fullscreen ALT-TAB Regression ; Make ALWAYS_ON_TOP ↵Sven Gothel2013-12-191-1/+14
| | | | | | | | | | | | | | | | | | Persistent when Reparenting (child -> top) - X11 Fullscreen ALT-TAB regression (no task-switcher visible) We still need the fast reconfigure path for ALWAYSONTOP only toggle. It was removed w/ commit c9fcc8cd510abc0cbebb872dc3e457327655e778, which disabled toggling FULLSCREEN and ALWAYSONTOP. Note: Another bug in Unity WM's Compiz: 'Unredirect Fullscreen Windows := True' disables the ALT-TAB taskbar/launcher HUD rendering and subsequent task-switch. Hence it shall be disabled .. nothing we can do here. - ALWAYS_ON_TOP not persistent when child -> top WM removes ALWAYS_ON_TOP state when reparenting, hence reinforce it when Child -> Top.
* Bug 924: Fix 'Unity WM' issue w/ sticky _NET_WM_STATE after Fullscreen ↵Sven Gothel2013-12-191-4/+12
| | | | | | | | | On/Off Cycle Unity WM keeps the _NET_WM_STATE (_NET_WM_STATE_FULLSCREEN, ..) after fullscreen-exit even though _NET_WM_STATE_REMOVE was issued. Add remedy: Reparent Child -> TOP: Reset _NET_WM_STATE (! _NET_WM_STATE_FULLSCREEN, ..).
* NEWT X11Window.c: Cleanup Code - No changes.Sven Gothel2013-12-191-8/+25
|
* NEWT Reparent/Fullscreen: Fixes X11 unsuccessful return to parent window; ↵Sven Gothel2013-10-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add reparentWindow(..) top-level position arguments; Misc - Fixes X11 unsuccessful return to parent window On X11 when returning to parent window (-> CHILD), we have to set the window invisible and wait for the result. Otherwise it sometimes happens that the WM's reparent operation fails, i.e. the window won't become a child of desired parent and is positioned randomly. - Add reparentWindow(..) top-level position arguments .. allows bringing the child-window to top-level w/ a desired position. Otherwise the window would be positioned elsewhere as a top-level as the plain reparenting operation. X11 needs to set position and size _after_ making the window visible, otherwise WM may ignore the XConfigureWindow request. - Reparent recreate shall always store the desired position and size On OSX/CALayer when recreation is being used, we need to store the pos/size for later creation. - Tests: Use 'NewtAWTReparentingKeyAdapter' where possible (reparent/fullscreen) instead of duplicating such code. NewtAWTReparentingKeyAdapter: Performs reparenting and fullscreen operations off-thread (i.e. not on AWT/NEW EDT) while decorating the action w/ revoking/restoring the ExclusiveContextThread (ECT). Manually tested 'TestGearsES2NewtCanvasAWT' reparenting and fullscreen on X11, Windows and OSX/CALayer w/ JDK 7u40 successful.
* X11Window FullScreen: Toggle _NET_WM_BYPASS_COMPOSITOR not only for ABOVE .. ↵Sven Gothel2013-07-041-2/+2
| | | | but also for FULLSCREEN WM state.
* Fix Bug 770 and 771Sven Gothel2013-07-021-98/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 770: X11Window.c: - Request focus _before_ enabling EWMH flags (fullscreen or above) after resize and temporary invisibility. This actually allows us to keep the focus after resize and repositioning! - Set _NET_WM_BYPASS_COMPOSITOR implicit analog to _NET_WM_STATE_FLAG_ABOVE - Clean up _NET_WM_* flag names, avoiding name space collisions, i.e. adding FLAG! - Remove dead _NET_WM_STATE setting via direct window property (not working anyways) - Remove dead code: FS_GRAB_KEYBOARD X11/WindowDriver.java: - Enable _NET_WM_STATE_FLAG_ABOVE temporarily if FLAG_IS_FULLSCREEN && !FLAG_IS_ALWAYSONTOP - Override focusChanged(..) to react on focus lost/gained in case of temporarily enabled _NET_WM_STATE_FLAG_ABOVE. If focus is lost, disable _NET_WM_STATE_FLAG_ABOVE, otherwise re-enable it. WindowImpl.java: - FullscreenAction.run: Always use 'FLAG_IS_FULLSCREEN_SPAN' +++ Bug 771: WindowImpl.java: - Keep fullscreenMonitors and fullscreenUseMainMonitor values intact, allowing them to be tracked. Remove duplicates in FullscreenAction class. - MonitorModeListenerImpl.monitorModeChanged: Add fullscreen path: If the changed monitor is part of fullscreenMonitors, recalculate the viewport union and reset position and fullscreen-size. - MonitorModeListenerImpl: Try to regain focus after successful mode change.
* Fix Bug 688: Removal of NEWT KeyEvent.EVENT_KEY_TYPED and ↵Sven Gothel2013-06-171-1/+0
| | | | KeyListener.keyTyped(KeyEvent)
* Fix Bug 750: Leaked X11 ColorMap for each created X11 Window in NativeWindow ↵Sven Gothel2013-06-121-0/+7
| | | | | | | (dummy) and NEWT Free the colormap at WindowDestroy, which we have created at WindowCreate w/ AllocNone. Due to the fact we used 'AllocNone' the leak is minimal though ..
* Fix Bug 600 and Bug 721: Adding support for multiple monitors w/ NEWTSven Gothel2013-05-061-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Support for all monitor devices and their available modes - X11: Use RandR 1.3 if available - Retrieve information - Changing a monitor device's mode - Support for dedicated and spannig fullscreen - See <http://jogamp.org/files/screenshots/newt-mmonitor/html/> - TODO: - X11 RandR does _not_ relayout the virtual screen size and neither the CRT's viewport. We may need to relayout them if they were covering a seamless region to achieve same experience! - OSX: No machine to attach a secondary CRT -> TEST! - Tested Manually for Regressions - Linux ARMv6hf (Rasp-Pi/BCM, Panda/X11) - Android (Huawei, Kindle) - Tested Manually and junit: - X11/Linux - NV, ATI-Catalyst w/ 2 CRTs - VBox w/ 4 CRTs - Win/Windows - NV, w/ 2 CRTs - VBox w/ 4 CRTs - X11/OpenIndiana, NV, 1 CRT
* Bug 641 NEWT: X11 Deliver keyCode layout independent, keySym layout ↵Sven Gothel2013-04-081-2/+2
| | | | | | | | | | dependent and UTF-16 keyChar value On X11, the layout dependent keySym was not delivered [1], as well as the UTF-8 to UTF-16 translation was missing [2]. [1] is solved using XLookupString w/o ShiftMask [2] is solved using JNI's NewStringUTF, which takes UTF-8.
* Relax Bug 613 workaround of commit 92398025abdabb2fdef0d78edd41e730991a6f94Sven Gothel2012-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Utilizing a GlobalToolkitLock in general to lock the display connection results in deadlock situations where locked surfaces signal other [offscreen] surfaces to render. We have to see whether we find a better solution, for now sporadic XCB assertion still happen. But it is preferrable to point to the root cause, then to jumping through hoops to complicate locking or even to deadlock. Locking: - X11GLXGraphicsConfigurationFactory add missing device locking in: - getAvailableCapabilities - chooseGraphicsConfigurationStatic - Newt/X11Window: Discard display events after window close. Relax ATI XCB/threading bug workaround: - ToolkitProperties: requiresGlobalToolkitLock() -> hasThreadingIssues() - NativeWindowFactory: Don't use GlobalToolkitLock in case of 'threadingIssues' the impact is too severe (see above) - NativeWindowFactory: Add getGlobalToolkitLockIfRequired(): To be used for small code blocks. If having 'threadingIssues' a GlobalToolkitLock is returned, otherwise NullToolkitLock. - X11GLXContext: [create/destroy]ContextARBImpl: Use 'NativeWindowFactory.getGlobalToolkitLockIfRequired()' for extra locking Misc Cleanup: - *DrawableFactory createMutableSurface: Also create new device if type is not suitable - *DrawableFactory createDummySurfaceImpl: Pass chosenCaps and use it (preserves orig. requested user caps)
* Fix Bug 616: X11: Remove XInitThreads() dependency while cleaning up device ↵Sven Gothel2012-09-271-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | locking, resulting in a native-lock-free impl. The X11 implementation details of NativeWindow and NEWT used the X11 implicit locking facility XLockDisplay/XUnlockDisplay, enabled via XInitThreads(). The latter useage is complicated within an unsure environment where the initialization point of JOGL is unknown, but XInitThreads() requires to be called once and before any other X11 calls. The solution is simple and thorough, replace native X11 locking w/ 'application level' locking. Following this pattern actually cleans up a pretty messy part of X11 NativeWindow and NEWT, since the generalization of platform independent locking simplifies code. Simply using our RecursiveLock also speeds up locking, since it doesn't require JNI calls down to X11 anymore. It allows us to get rid of X11ToolkitLock and X11JAWTToolkitLock. Using the RecursiveLock also allows us to remove the shortcut of explicitly createing a NullToolkitLocked device for 'private' display connections. All devices use proper locking as claimed in their toolkit util 'requiresToolkitLock()' in X11Util, OSXUtil, .. Further more a bug has been fixed of X11ErrorHandler usage, i.e. we need to keep our handler alive at all times due to async X11 messaging behavior. This allows to remove the redundant code in X11/NEWT. The AbstractGraphicsDevice lifecycle has been fixed as well, i.e. called when closing NEWT's Display for all driver implementations. On the NEWT side the Display's AbstractGraphicsDevice semantics has been clarified, i.e. it's usage for EDT and lifecycle operations. Hence the X11 Display 2nd device for rendering operations has been moved to X11 Window where it belongs - and the X11 Display's default device used for EDT/lifecycle-ops as it should be. This allows running X11/NEWT properly with the default usage, where the Display instance and hence the EDT thread is shared with many Screen and Window. Rendering using NEWT Window is decoupled from it's shared Display lock via it's own native X11 display. Lock free AbstractGraphicsDevice impl. (Windows, OSX, ..) don't require any attention in this regard since they use NullToolkitLock. Tests: ====== This implementation has been tested manually with Mesa3d (soft, Intel), ATI and Nvidia on X11, Windows and OSX w/o any regressions found in any unit test. Issues on ATI: ============== Only on ATI w/o a composite renderer the unit tests expose a driver or WM bug where XCB claims a lack of locking. Setting env. var 'LIBXCB_ALLOW_SLOPPY_LOCK=true' is one workaround if users refuse to enable compositing. We may investigate this issue in more detail later on.
* NEWT Platform Driver: Uniform impl. class names [DisplayDriver, ↵Sven Gothel2012-08-181-21/+21
| | | | ScreenDriver, WindowDriver] to reduce complexity and programatic selection.
* NativeWindow/Newt X11ErrorHandler enhancement / unification - don't throw ↵Sven Gothel2012-07-051-4/+8
| | | | | | | | | | | | exceptions. Handles also XAWT BadMatch X_SetInputFocus. X11ErrorHandler code now dumps proper information about the opcode and error message and the running Java thread. Having propery "nativewindow.debug.X11Util.XErrorStackDump" or "nativewindow.debug=all' set, a stack trace is dumped. Since the X11ErrorHandler may catch an XAWT error: BadMatch X_SetInputFocus, we cannot throw an exception and better keep running.
* Fix Bug 560 and NEWT window closing behavior in general for all platforms.Sven Gothel2012-05-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | - NEWT/WindowImpl: - 'void windowDestroyNotify()' -> 'boolean windowDestroyNotify(boolean force)', allowing to signal a forced close, as well as replying whether the window has been closed. (called by native code) - destroy(): set states before releasing the window lock - NEWT/X11: Pass windowDeleteAtom for reconfigure window, in case of reparenting child to top-level - NEWT/OSX: - Add 'BOOL windowShouldClose()' impl., ie. having a chance to reject the close attempt - Common impl. for 'windowShouldClose' and 'windowWillClose' -> 'windowClosingImpl' utilizing new 'windowDestroyNotify' code (see above). Fixes bug 560. - NEWT/JOGLNewtApplet1Run: Refine out-of browser window behavior for window-close button - default: move NEWT window back to browser parent - closeable: close NEWT window - jogl-test-applets: Add NApplet-Closeable test (Applet out-of browser window is closable)
* Bug 570: NEWT General/X11: Decouple setFullscreen() and setAlwaysOnTop(); ↵Sven Gothel2012-04-271-5/+8
| | | | | | | | | | | | | | Use window-static instances for runnable actions NEWT General/X11: Decouple setFullscreen() and setAlwaysOnTop() - X11 fullscreen/above: Don't assume 'always-on-top' if switch to fullscreen. - WindowImpl: Remove relation between 'always-on-top' and fullscreen when quering and switching. Use window-static instances for runnable actions - Removes temp objects for EDT runnables - Uses synchronization on action instance to avoid concurrency
* Complete LOCK_SURFACE_CHANGED ; Introduce NativeVisualID (Daisy chaining ↵Sven Gothel2012-03-051-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *GraphicsConfiguration) ; ... NativeVisualID: New interface for Capabilities implementations, allowing retrieval of the native 'visual id'. Impl. by WGL, X11 and EGL. JAWTWindow.lockSurface() - Detect surfaceHandle change an return LOCK_SURFACE_CHANGED (see: LOCK_SURFACE_CHANGED) EGLDrawable: - Impl. updateHandle() (see: LOCK_SURFACE_CHANGED) - use NativeVisualID for EGLGraphicsConfiguration selection to respect a native 'visual id' EGLContext.createContextImpl: Use NIO for attributes EGLDisplayUtil: Enhance eglGetDisplay w/ DEBUG code and NativeSurface / EGL_DEFAULT_DISPLAY variation EGL, XGL, WGL GraphicsConfiguration: - Don't set ALPHA_SIZE and STENCIL_SIZE if not requested in attribute list for context creation. - toString() shows proper identification, eg.: egl, x11, win32 .. EGLGraphicsConfigurationFactory: Daisy chain GraphicsConfigurationFactory for native device type (currently only X11). This allows choosing the EGLGraphicsConfiguration and hence native visual id based on EGL when invoked via the factory model (generic). In case EGLGraphicsConfigurationFactory is not suitable or doesn't produce a native visual id, it falls back the the original one. X11AWTGraphicsConfigurationFactory and X11Window: Use generic NativeVisualID which allows EGLGraphicsConfiguration implicit. *GraphicsConfiguration's DEBUG flag is pushed up to DefaultGraphicsConfiguration LOCK_SURFACE_CHANGED: - commit 006e9fe402a0a47b45fd2c4af51296aef895e8b5 - commit a0177c8a1048683e5d43f4712f8f9e37091d4e85 Impact: - Fixes EGL/GLES (wrapper/native) usage on X11, proper Xvisual selection w/ EGL - Fixes EGL/GLES (wrapper/native) usage on Windows, ANGLE works w/ NEWT and forced ES2
* NEWT/X11: Fix Insets determination for undecorated / child window.Sven Gothel2012-01-181-53/+86
| | | | | | | | | | | | Due to latest changes, a bug is disposed where the native 'updateInsets' attempts to determine the window insets by it's parent window (fall-back). The latter works only in case of a top-level window. Adding query to the WM whether the window is decorated (top-level) or not. Attempt to use the fall-back parent window method in case of a decorated window. This whole inset code based on the parent window is probably completly redundant, nevertheless we keep it alive until further notice.
* Newt: Add fullscreen for offscreen windows (currently OSX only); Focus ↵Sven Gothel2012-01-181-1/+30
| | | | | | | | | | | | | | | | | | handling; Misc. - Add fullscreen for offscreen windows (currently OSX only), - Focus handling - requestFocus() @ creation - remove requestFocus() delay in setFullscreen() since focus loss in fullscreen mode is caused by a KDE 'misbehavior' in general. See X11Common.c FS_GRAB_KEYBOARD, an experimental focus loss prevention, disabled due to it's behavioral impact of removing the ability to use WM keyboard commands (task switcher). - Remove pending events waiting longer than TO (1200ms)
* NEWTWindow Focus: Skip requestFocus() if already owning focus; ↵Sven Gothel2012-01-161-1/+1
| | | | | | | | | | | setFullscreen() requests focus 'later'. We shall rely on the focus state, hence we can skip 'requestFocus()' if we already own the focus. This allows a fast-path especially when called from native code (mouse click). Request focus 'later' on setFullscreen() allowing native WM to complete event handling, this is required especially on X11 to guarantee a focused fullscreen window.
* NEWT Windows/X11: Remove missed negative coordinate restrictions.Sven Gothel2011-12-241-6/+4
|
* NEWT/X11: Fix regressions of commit ↵Sven Gothel2011-12-231-5/+5
| | | | f3f794fe37a7e33a771a4a702f3f46ead4dc6d03: Unresolved symbols. Disable VERBOSE.