aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/X11Window.c
Commit message (Collapse)AuthorAgeFilesLines
* X11 Nativewindow/NEWT: X11 Error Handler (JNIEnv query for thread, stack ↵Sven Gothel2011-06-261-23/+38
| | | | | | | | | trace), cleanup - X11 Error Handler: if throwing JVM stack trace or fatal JVM error query proper JNIEnv for running thread and attach thread to JVM if necessary. - NEWT/X11: Proper XEvent polling documentation, cleanup window creation event mask
* Minor editing (compile script, X11Window.c - cleanups)Sven Gothel2011-06-121-3/+3
|
* Utilize GlueGen's platform independent header for stdin.h, gluegen_stdint.h, ↵Sven Gothel2011-06-111-6/+3
| | | | | | | .. (remove local copy) - Use them for gluegen code generation - Use them for native compilation (cc)
* NEWT/X11 WindowClosing: End dispatch loop since Display could be destroyed ↵Sven Gothel2011-04-261-3/+15
| | | | after Java callback
* Newt X11: keyPress/Release must use upper case XP_ values to match VK_ ; Set ↵Sven Gothel2011-03-301-50/+65
| | | | modifier properly.
* Move implementation private files from com.jogamp.<module>.impl. to ↵Sven Gothel2011-02-091-54/+54
| | | | | | | | | | | | | | | jogamp.<module> (2/2) - edit files - com.jogamp.opengl.impl -> jogamp.opengl - com.jogamp.opengl.util.glsl.fixedfunc.impl -> jogamp.opengl.util.glsl.fixedfunc - com.jogamp.nativewindow.impl -> jogamp.nativewindow - com.jogamp.newt.impl -> jogamp.newt This sorts implementation details from the top level, ie skipping the public 'com', allowing a better seperation of public classes and implementation details and also reduces strings. This approach of public/private seperation is also used in the OpenJDK.
* NEWT: Add WindowListener.windowDestroyed() ; Remove WindowImpl.windowDestroyed()Sven Gothel2010-12-231-6/+0
| | | | | | | | | | | | | Add WindowListener.windowDestroyed() To expose a proper window lifecycle, ie destroy-notify and destroyed, this notification is added. This will be used at least in unit tests, where we verify destruction. Remove WindowImpl.windowDestroyed(): This native hook (planned to be called by native destroy notification) is unreliable or not supported for all platforms. NEWT relies on the pre destroy native hooks and handles the final destroy notification itself.
* X11 DummyWindow: Pass size and set size in proxySven Gothel2010-12-041-1/+0
|
* NEWT/X11: Don't erase background with pixmap or pixelSven Gothel2010-11-281-2/+2
|
* Moving NEWT X11Window GetRelativeLocation() native implementation to ↵Sven Gothel2010-11-171-58/+0
| | | | NativeWindow X11.
* NEWT Window Lifecycle / ScreenMode:Sven Gothel2010-11-031-27/+57
| | | | | | | | | | Lifecycle.reparentActionPre()/reparentActionPost() -> pauseRenderingAction()/resumeRenderingAction() for a more generic use, ie reparenting and screen mode change. ScreenMode change: No more visibility/fullscreen changes, no more locking, just pause/resume animation. X11 ScreenMode set: move from thread/wait to simple polling over time (timeout)
* Minor cleanup: strings, unused vars, ..Sven Gothel2010-11-021-5/+4
| | | | | | | | | | DEBUG strings w/ thread name nativewindow.TraceLock -> nativewindow.debug.ToolkitLock.TraceLock Sync Xmisc (DummyWindow) with NEWT's creation test scripts: awt and non-awt usage
* Fix ScreenMode ; Add FatalError to NewtCommon.c ; Fix Windows BuildSven Gothel2010-10-291-29/+26
| | | | | | | | Fix ScreenMode - Avoid NPE/Out-of-memory: Return zero sized NewIntArrays instead of NULL. Fix Windows Build - ScreenMode still has a regression
* remove positive RANDR messageSven Gothel2010-10-291-2/+0
|
* NEWT: ScreenMode changesSven Gothel2010-10-261-197/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - New type definition: ScreenMode { MonitorMode { SurfaceSize { Resolution, bpp }, ScreenSizeMM, refreshRate }, rotation }, where Resolution and ScreenSizeMM are of type DimensionReadOnly - ScreenMute instance is - immutable - hashable - cloneable The above allows fast query and storage w/o redundancies. More than 300 modes via permutation could be expected. ScreenMode impl. changes: ScreenImpl: To be implemented methods by native specialization: - protected int[] getScreenModeFirstImpl() - protected int[] getScreenModeNextImpl() - protected ScreenMode getCurrentScreenModeImpl() - protected boolean setCurrentScreenModeImpl(ScreenMode screenMode) The data unification etc is implemented generic using ScreenModeUtil and the 'int[]' streaming. ScreenModeStatus holds all ScreenMode related data and provides a locking strategy. ScreenModeListener provides a callback facility for ScreenMode change events. - Screens listen to ScreenModeStatus, so all FQN referenced Screen's receive the change. - Windows listen to Screen, to take appropriate action for the event (fullscreen, reshape). Misc: - Screen/Display: promoting 'addReference'/'removeReference' to public interface, so a user may trigger construction/destruction (-> junit tests, plus other clients than WindowImpl). - Gears: 'setSwapInterval' at 'reshape' instead of 'init', so it's reset when ScreenMode is changing. -
* Merge branch 'master' of http://github.com/sgothel/joglRami Santina2010-10-211-222/+287
|\ | | | | | | | | | | | | | | | | | | | | 18bf27fa86da1f26fd085565f501736816d2f2e9 Conflicts resolved: src/newt/classes/com/jogamp/newt/impl/WindowImpl.java src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java src/newt/native/WindowsWindow.c src/newt/native/X11Window.c
| * NEWT: Fix / Stabilize Fullscreen/Decoration/Reparenting Mode ChangesSven Gothel2010-10-211-223/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - setSizeImpl/setPositionImpl/reparent -> reconfigureWindowImpl - setVisible(boolean) is state checked (500ms) for better reliability on resource creation. Guarantees valid surface. - reparentWindow: start pos of child -> top is current position on screen - reparentWindow: Recheck success (setVisible), if failed fall back to recreate, which gets rid of a lost child windows (1/20) .. - reparentWindow: if size failed, reconfigure for size again - add toggle decoration - unify nfs_ size/pos state - WindowsWindow.c/X11Window.c: Unify size/pos settings - X11Window.c: - NewtWindows_setFullscreen: use 'root of screen' instead of 'default root of display' - Adding SubstructureNotifyMask incl event semantics - Parse ReparentNotify (debugging of reparenting) Misc: - Add native getLocationOnScreen() impl to avoid possible AWT deadlock - setSize/setPosition/setFullScreen -> EDT - More documentation on expected native implementation semantics
| * Fix: X11 Fullscreen mode behaviourRami Santina2010-10-111-26/+23
| | | | | | | | | | | | | | | | | | Event of fullscreen is sent to the display root and properties of fullscreen are set on our window/screen defined source attachment of data sent using XSendEvent to be normal application (required) cleaned up the code. replaced tabs with spaces
| * Added Fullscreen WM Hit to the X11 windowRami Santina2010-10-111-4/+56
| | | | | | | | | | when true the request is send after configuring the window otherwize before decoration. needs tweeking to ensure that the fullscreen is on-off
* | Added Screen Rotation manipulation API (with X11 impl)Rami Santina2010-10-181-4/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added screen rotation change capability with impl for X11 (using Xrandr) com.jogamp.newt.Screen: added 2 methods which cover screen roation lifecycle setScreenRotation(int rot): Change the Screen Rotation to one of the rotations defined in ScreenMode, namely: ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 int getCurrentScreenRotation(): Get the Current screen rotation returns -1 if not implemented natively. +++++++++++++++++++++++++ Notes: 1- At init the original rotation is called natively and cached, when screen is destroyed the rotation is reverted. 2- On X11 with Nvidia: you need to edit /etc/X11/xorg.conf: Add the following line: Option "RandRRotation" "on" in Section "Device" after BoardName. +++++++++++++++ Added TestScreenMode02NEWT which includes 4 tests 1- Rotate 90 2- Rotate 180 3- Rotate 270 4- Rotate with screen mode change should fail if screen rotation not implemented natively. (4) withh fail if screen mode not impl natively as well.
* | Screen Mode manipulation API (with X11 impl) ; X11 Fullscreen implRami Santina2010-10-171-5/+210
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added screen mode change capability with impl for X11 (using Xrandr) com.jogamp.newt.Screen: added 4 methods which cover screen mode lifecycle ScreenMode[] getScreenModes(): Get list of available screen modes returns null if not natively implemented. On first call will fetch the list thru a set of native calls and stores them in the ScreenModeState. Consequent calls will retreive the data from the ScreenModeStatus object. Native calls are done on creation stage, so subsequent API calls will return cached data. int getDesktopScreenModeIndex(): Get the Current Desktop Screen mode index returns -1 if functionality not natively implemented. The index returned refers to the screen mode location in the ScreenMode array. Used to get initial mode for reverting back. Initial call will retreive the mode thru a native call (done on initialization), subsequent API calls will retreive it from the ScreenModeStatus object. Note: If Window is closed without reverting back and screen is set to unreachable. The api will revert the screen. A call to destoy(unreachable) is needed for revert to take place on close windowDestroyNotify(WindowEvent e) { ... window.destroy(true); } short getCurrentScreenRate(): Get the current screen rate returns -1 if not natively implemented. Used along with getDesktopScreenModeIndex You can identify the current screen mode (w x h) and the rate. Initial call will retreive the mode thru a native call (done on initialization), subsequent API calls will retreive it from the ScreenModeStatus object. void setScreenMode(int modeIndex, short rate): change the screen mode to the mode index which refers to one of the screen modes retreived by getScreenModes() and a rate which can be one of screenModes.getRates(). If the rate provided doesnt belong to the list of available rates the first rate is chosen. build-newt.xml: Added header files generation for Screen and Display Added Xrandr syslink to x11 based builds. +++++++++++++ Fullscreen for X11Window: Added Fullscreen WM Hint for X11Window. Event of Fullscreen is sent to the display root. When changing to fullscreen the request is send after configuring the window otherwize before decoration. Not Stable yet, needs tweeking on other Linux dist. Window looses focus after switching to fullscreen mode. +++++++++++++++ Added TestScreenMode01NEWT which includes 4 tests 1- Fullscreen change mode 2- Screen mode change 3- Screen change with fullscreen (revert screenmode then revert fullscreen) 4- Screen change with fullscreen (revert fullscreen then revert screenmode) should fail if not screenmode not implemented on platform. +++++++++++++++ Cleaned up some unused imports
* NativeWindow/NativeSurface Refactoring ; Added mouseClick NEWT/AWT unit testSven Gothel2010-10-061-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | NativeWindow/NativeSurface Refactoring - Using NativeSurface interface - NativeWindow extends NativeSurface, adds getLocationOnScreen(Point) - NativeWindow add: getParent() - NativeWindow/Surface: Removed 'invalidate()', use 'destroy()' if you must. - NullWindow -> ProxySurface impl NativeSurface - JOGL: Uses NativeSurface only. - GLDrawable.getNativeWindow() -> GLDrawable.getNativeSurface() Added mouseClick NEWT/AWT unit test JOGL: - GLAnimatorControl add: resetCounter() - NEWT: - GLWindow counters: return GLWindow counters always - WindowImpl - requestFocus() wait until done - reparent: readded requestFocusImpl(true), native impl skips java focusAction if reparented - X11Window: Add XRaiseWindow() in requestFocus()
* NEWT: Fix Display/Window/Screen OO Identity, Reparenting and requestFocusSven Gothel2010-09-231-20/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NativeWindow: Interface NativeWindow changes: - Remove 'throws' qualifier in lockSurface(), since it is not - Adding convenient 'one call' isSurfaceLockedByOtherThread() - Adding getSurfaceLockOwner() NEWT Window/GLWindow: - Unclutter Window/GLWindow relationship - save Window's indentity GLWindow's role is a GLAutoDrawable implementation aggregating (maybe even compositioning) a Window. The previous implementation just derived from the Window implementation, overwriting methods and fields - impossible to ensure sanity / completness. It was also not ensured that the added functionality of GLWindow (setVisible, destroy, ..) has been issued in case of handling the aggregated Window alone (window callbacks, ..). To solve this issue in a 1st attempt without changing the GLWindow API, Window is just an interface, being implemented by their specializations, hence sanity is intrinsic. GLWindow's added functionality is ensured by a Window.LifecycleHook interfaced implementation, registered at the aggregated Window. - Screen and Window are interfaces now (new files) - Display is an abstract class. - Their (abstract) implementations resides in impl/<BaseName>Impl - GLWindow implements Window as well - Remove Screen reference handled by setScreen(Screen) method. - Lock native parentWindow if used (createNative/reparenting) - Move lockSurface/unlockSurface from unchecked override pattern to an callback style using abstract methods lockSurfaceImpl/... - Sorting all methods to semantic sections, abstract, superinterface, .. - Reparenting: Handling different reparenting situations: - Unchanged - No change - Native Reparenting - Compatible Display/Screen, try native reparenting - Native (Re)Creation - Use destroy/create pattern - Native Creation Pending - Create later - setUndecorated() calls reconfigure Window now, ie tries to change the window actually - Don't issue 'requestFocus()' directly from the native implementation anymore, call it from the Java code. - Window/GLWindow/NewtFactory: Constructor simplification Avoid explosion of constructor overloading, ie removing the 'undecorated' variant, since this is redundant due to the 'setUndecorated(boolean)' method. - Fixed/added API documentation
* NEWT: Focus Fix + CleanupSven Gothel2010-09-031-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Issueing 'requestFocus' via the native EDT dispatch loop may cause a deadlock, due to a possible implicite AWT requestFocus call (NewtCanvasAWT). Approach: RequestFocus issued directly, by Window.requestFocus() and the native EDT dispatch loop, is queued for later execution by EDT. This shall decouple a possible native windowing TK resource collision. - X11Windows.c: Add missing 'reparented' param for requestFocus to force requestFocus after reparenting. - AWTWindow.java: Add requestFocusImpl() +++ NEWT: Cleanup - Remove Event Type Bits in: - EventListener.h - NEWTEventListener.java - Remove InputEvent 'consume' status -
* Newt: X11 ICC window properties ; Still bugs with composite manager and Newt ↵Sven Gothel2010-07-171-26/+27
| | | | | | | | | reparenting Set _NET_WM_WINDOW_TYPE to specify decoration etc. On KDE4 having compositing enabled the reparent window is sometimes made invisible (UnmapWindow happened). FIXME.
* Fix file modesSven Gothel2010-07-071-0/+0
|
* GLAutoDrawable: setAnimator/getAnimator/invoke/display changes; NEWT: Adding ↵Sven Gothel2010-07-071-13/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | native repaint; Fix reparent/fullscreen New: NEWT Native Repaint ========================= Support for native repaint, which shall call display() in case no animator is running. GLAutoDrawable invoke(GLRunnable) impl. handles case if invoked on animator thread, or no animator thread is running (issueing a display() call). The impl resides in GLDrawableHelper. The Animator un-/registers itself at the GLAutoDrawable via setAnimator. New: NEWT AWT/NEWT Parenting Focus Handling ============================================ Introducing Window.FocusRunnable, to be registered at the NEWT Window, which will be executed before the native focus claim. Window.FocusRunnable's run method returns a boolean, which determines whether the native implementation shall proceed claiming the native focus. This API focus hook is necessary to allow an optional underlying windowing toolkit, ie AWT (see usage NewtCanvasAWT), to make the focus traversal transparent. Fix: GLEventListener / GLDrawableHelper ======================================== GLEventListener's init() and glViewport()/reshape() method must be called before the 1st display() and after a dispose() call. It could miss the 1st display() call if added after the setVisible(true) call - due to the native repainting. The impl resides in GLDrawableHelper. Fix: Misc NEWT ============== Window reparent issues a resize() and display() call, if it is visible. native Window uses direct send.*Event for input events (again), instead of enqueueing it for performance. Window impl all status change native event Java callbacks, instead of having duplicated code in all implementations. Fullscreen, reposition at zero. Reparent/Fullscreen repaint if visible. Native reparent/fullscreen, fix glitches on Windows (visibility while reparenting)
* GLAutoDrawable: setAnimator/getAnimator/invoke/display changes; NEWT: Adding ↵Sven Gothel2010-06-261-38/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | native repaint; NewtCanvasAWT focus fix Support for native repaint, which shall call display() in case no animator is running. GLAutoDrawable invoke(GLRunnable) impl. handles case if invoked on animator thread, or no animator thread is running (issueing a display() call). The impl resides in GLDrawableHelper. GLEventListener's init() and glViewport()/reshape() method must be called before the 1st display() and after a dispose() call. It could miss the 1st display() call if added after the setVisible(true) call - due to the native repainting. The impl resides in GLDrawableHelper. The Animator un-/registers itself at the GLAutoDrawable via setAnimator. NEWT Window reparent always issues a resize() and display() call. NEWT native Window uses direct send.*Event for input events (again), instead of enqueueing it for performance. NEWT Window implements all status change and Java native event callbacks, instead of having duplicated code in all implementations. NewtCanvasAWT if the Newt window is focused, the AWT/Swing component[s] will loose the focus.
* Fix: Locking/Threading; Common IntIntHashMap and Buffers; Fix: ↵Sven Gothel2010-06-101-122/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glMap*Buffer*; GLX/WGL/CgGL: All runtime dynamic; Misc .. TODO: Compile and test on MacOSX .. Fix: ===== Multithreading/Locking: See jogl/doc/Implementation/MultiThreading.txt - Locking layer is not platform agnostic, ie GLContextImpl, GLDrawableImpl, .. and NEWT: Window/Display - No more use of JAWT global lock necessary, removed. - No need for X11 Display lock, on the contrary, this made the NV driver hang. - Use common window/surface lock - All NativeWindow surfaceLock's are recursive now glMapBuffer: If size is 0, don't do cont with the native call. glMapBufferRange: Fix capacity. glNamedBufferDataEXT: Track the size. glMapNamedBufferEXT: Manual impl. - use the tracked size glXGetVisualFromFBConfig, glXChooseFBConfig, glXChooseVisual: Instead of ignoring and implement a renamed version (*Copied), we just use ManualImplementation for the proper copy-result code. DesktopGLDynamicLookupHelper: Initialize _hasGLBinding* attributes in the determing loadGLJNILibrary() method, which is called by super(). Otherwise static init will overwrite them after the super() call. X11GLXDrawableFactory: Don't release anything at shutdown (removed sharedContext.destroy()), since this caused a freeze/SEGV sometimes. Fixed NEWT's reparentWindow() functionality incl NewtCanvasAWT usage. - Native: if not visible, don't focus, etc - NewtCanvasAWT: Use the container size to start with - Run the command on the EDT Using GlueGen's new DynamicLibraryBundle utility: - X11, Windows and MacOSX OpenGL adapted to DynamicLibraryBundleInfo. - X11GLXDynamicLookupHelper -> X11GLXDynamicLibraryBundleInfo - Remove all path from lib names. - GL order: libGL.so.1, libGL.so, GL - shallLinkGlobal: true -> to server some 'old' DRI systems -> http://dri.sourceforge.net/doc/DRIuserguide.html - shallLookupGlobal: false - Try both : glXGetProcAddressARB and glXGetProcAddress - Using bootstrap: GLX.glXGetProcAddress(long glxGetProcAddressHandle, String glFuncName) Found the issue with LIBGL_DRIVERS_PATH, ie if not set no valid GL instance can be found (ie ATI fglrx/DRI). This may happen if using a differen user than the desktop user for whom the env var is set within some /etc/X11/Xsession.d/ script. Enhancements: ============= GLBufferSizeTracker: Use IntIntHashMap and add DirectState size tracking. GLBufferStateTracker: Use IntIntHashMap. GLStateTracker: Use IntIntHashMap. GLDynamicLookupHelper: More generic (global loading/lookup and GetProcAddress function name list), remove redundant code. FIXME: MacOSXCGLDynamicLookupHelper: - Not tested - Not using NSImage lookup anymore as recommended by OSX API Doc, so dlsym is used always (to be tested) WindowsWGLDynamicLookupHelper: - Not tested GLX/WGL/CgGL is all runtime-dynamic as now, ie loaded and looked-up at runtime, no compile time dependencies to GL anymore, nor a need to specify CgGL. Split up WGL in GDI and WGL, to allow proper dynamic runtime linkage of OpenGL32 while using static binding to GDI32 NEWT events generated by native code are enqueued and not send directly. This should ease locking mechanisms .. if any are necessary. NEWT: More platform specific code moved to *Impl method, simplifying the generic code of the superclass and impl protocol. Cleanup: ========= Replace all InternalBufferUtil's with com.jogamp.common.nio.Buffers Removed all InternalBufferUtil's from repository Removed GLContextImpl notion of 'optimized' surface locking, where the surface gets unlocked during makeCurrent/release. This just makes no sense and would impact multithreading in a horrible way.
* NEWT: Fix AWT Parenting ; Multithreading Issues ; Semantics: destroy(), .. ; ↵Sven Gothel2010-05-281-59/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Misc. Due to incapabilities of the previous AWT/NEWT reparenting the implementation and spec had to be changed to support this feature. See the first 2 comments below. - Tested on GNU/Linux (OK), Windows (a few bugs left) - TODO: - Clarify the size/layout issue, ie who is responsible etc In the test, incl AWT/NEWT, we set the size on the GLWindow and ie pack the AWT Frame. - Fix remaining [Windows] bugs .. - Fix/Implement MacOSX port .. Fix AWT/NEWT reparenting: =========================== - Now NewtFactory's createWindow() method for parenting handles NativeWindow only and is no more responsible for creating a child window upon an AWT Component. See class com.jogamp.newt.awt.NewtCanvasAWT for NEWT/AWT parenting. - New com.jogamp.newt.awt.NewtCanvasAWT, responsible for handling AWT's reparent events via addNotify/removeNotify. Reparenting is implemented via the new NEWT Window's reparentWindow() method. Also sets the background erase to false, if supported. - Fix zero size semantics in Window (setSize/setVisible) Since a zero size window is not supported by many compoenent (Windowing system, OpenGL, ..) we use the visibility methodology to not show a 0x0 window. See Javadoc. AWT components may start with zero size. - New NEWT Window: reparentWindow(NativeWindow newParent, Screen newScreen) Allowing to change the parent of a window. Similar with the fullscreen toggle, but without size/position change. Native reparenting allows to keep alive the native window while changing the container, hence it is preferred to a destroy/create cycle. To benefit from the native reparenting, a NEWT implementation has to implement 'protected boolean reparentWindowImpl(long newWindowHandle)' and return true, otherwise reparenting will be 'emulated' via the expensive destroy/create cycle. - NEWT's Window references all of it's children, if any - NEWT's Window propagates setVisible/destroy actions to it's children. - Fix NEWT's destroy() semantics. A call of destroy() or destroy(false) shall only result in the destruction of the native window (handle) nothing more. A subsequent setVisible(true) shall allow the complete recreation of the Window into a usable state. A call of destroy(true) destroys all resources the Window holds, may include Screen/Display and OpenGL resources in case of GLWindow. This is necessary to allow proper reparenting, where a native window may become destroyed, but should be recreated via setVisible(true) later on. - Fix NEWT set[Size|Position|Fullscreen|Visible] synchronization. Use a recursive lock instead of the Window instance, otherwise arbitrary Window access via AWT's EDT, NEWT's EDT or other threads can block. Also removed a use pattern like: key.lock() try { EDT.invoke(action()); } finally { key.unlock(); } Where action() itself uses the same lock object (here key), the result is a deadlock. NativeWindow Changes: ====================== - We can use XInitThreads() now (concurrent threading support) in combination with AWT. Might have been some async in our NEWT locking in regards to AWT (sync()), and the X11 Display changes made in c787f50d77e2491eb0d8201d534a6fa4885a929e. - NativeWindow's window handle is _not_ transient like surface handle, fixed documentation. JOGL Changes: ============= - New 'isRealized()' method in GLDrawable. - Misc Fixes ============ - Fix NEWT set[Size|Position|Fullscreen|Visible] duplicate code Due to pure abstract signatures, the set[Size|Position|Fullscreen|Visible] implementations of X11, OSX, .. contained duplicate code and state handling (size, pos, ..). These are now decoupled, ie generic set[Size|Position|Fullscreen|Visible] implementations calling simple set[Size|Position|Fullscreen|Visible]Impl implementations. - Fix NEWT: Renamed setAutoDrawableClient(boolean) to setHandleDestroyNotify(boolean) The semantic of setAutoDrawableClient(boolean) defaults to false was too complicated and specific, hence changed to setHandleDestroyNotify(boolean) defaults to true since its more clear and the name refers the window itself.. - Fix NEWT: Removed GLWindow's unused global window list - Fix NEWT: Remove Window's unused event mask - Rename com.jogamp.newt.impl.awt.AWTNewtFactory -> com.jogamp.newt.awt.NewtFactoryAWT
* Changed NEWT NativeWindow creation contract - AWT/NEWT Parenting - Misc FixesSven Gothel2010-05-211-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +++++ Changed NEWT NativeWindow creation contract Original contract: (1) A native window was created as soon as possible, ie when NEWTFactory.createWindow(..) was called - if possible. (2) A valid native window has to be created at least after setVisible(true) has been called. Problems: Not all implementation are able to create the native window that early, but at setVisible(true) only (e.g: KD and EGL). Due to window parenting especially the new AWT/NEWT parenting, the native window can only be created in case the parent native window is valid. New contract: (1) A native window is created at setVisible(true), if it's a top level window or the native parent window is valid. (2) A valid native window may not be created after setVisible(true) has been called. Subsequent setVisible(true) calls shall be made in case the creation has not been done yet. This is demonstrated in GLWindow.display() for example. The new contract implements a lazy native window creation. +++++ AWT/NEWT Parenting - HierarchyListener and ComponentListener ensure that the NEWT child window will be setVisible according to the AWT parent window. - Lazy native window creation relaxes requirements to the parent window's state. - Attachment of the child window and setVisible() may be called after NEWT child window creation. - GLWindow supports NEWT child window creation directly The test case TestParenting01AWT.java reflect this new contract and demonstrates more simplified and more flexible use cases. +++++ NEWT Fixes: - All NEWT implementation's native code method names end with 0. - GLWindow: don't issue the actual 'init'/'display' call to GLEventListeners in case the window is not visible. - NEWT setSize/setPosition: if native-window call native-window action and let the attributes being set by the feedback call, which issues more action, ie RESIZE. else set the attributes directly, no feedback call/action is necessary. +++++ X11 Fixes: - X11GLContext MakeContextCurrent: Use MakeCurrent in case write and read drawable are equal, otherwise SEGV happens on ATI with heavy multithreading involved! Even XLockDisplay and XSync didn't help here .. - X11GLXDrawableFactory shared resource: Removed the resource holder thread to simplify code, hence proper release is no more desired and it could become a cause for deadlock. - Moved XInitThreads() from NEWT X11Window -> NativeWindow X11Util, since NativeWindow is loaded first (essential for XInitThreads()) and it is the more basic lib. - Made call to XInitThreads() conditional, ie it's spared if AWT could be used - which causes SEGV .. (AWT bug). See X11Util.java +++++ JOGL Fixes: - GLProfile.isAWTAvailable() -> NativeWindowFactory.isAWTAvailable() - GLProfile.isAWTJOGLAvailable() -> GLProfile.isAWTAvailable()
* A little cleanup ..Sven Gothel2010-05-061-55/+44
|
* Newt X11: Add focus in/out events; Request focus with mouse clickSven Gothel2010-05-051-20/+35
|
* NEWT Fixes:Sven Gothel2010-05-041-46/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Common native in NewtCommon.c/.h - Add simple NEWTEventFiFo, providing a pattern to spool events by an EventListener and to process them where it impacts (GLEventListener ..) - Window [X11|Windows]: setSize/setPosition: - always store the values, - only act if valid and !fullscreen - Window [X11]: - Add requestFocus - Add setTitle - Fix parent/child window creation - Fix parent/child window fullscreen (reparenting) - JUnit Test: ParentTest: - Shows parent and client window animation - Client window shall be able to go into fullscreen, ie disconnect/reconnect from its parent. Test: Focus-client + type-'f' - Both windows receive/dispatch events properly
* - Fix GLProcAddressResolver regression: Use GLProcAddressResolver !Sven Gothel2010-04-271-34/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - X11GLXDrawableFactory: - Move shared resource creation/destruction into it's own thread - Remove the ATI hack (no XDisplay closing) for every Display, this is only necessary for the shared XDisplay and in case of AWT. - Newt - Display: Only pumpMessages if device is ready. - X11Display: Verify handle not null at DispatchMessage. - Common recursive ToolkitLock implementation, from src/nativewindow/classes/com/jogamp/nativewindow/impl/LockingNativeWindowFactory.java and src/newt/classes/com/jogamp/newt/Window.java, -> com.jogamp.nativewindow.impl.RecursiveToolkitLock - Unique XLockDisplay/XUnlockDisplay call via X11Util to simplify debugging. X11Util: Added debug code for XLockDisplay/XUnlockDisplay. Added fast LongObjectHashMap Added static lib loading and initialization. Removed active and passive list, as well as unused methods, to easy maintenance. Possible since the only 'uncloseable' Display might be the shareable one. - X11Lib: Added static initialization via X11Util Test: junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGears* - Add WindowListener for quit ..
* NEWT CleanupSven Gothel2010-04-241-27/+27
| | | | | | | | | | | | | - Moved all implementation details (awt/x11/windows/macosx/..) to com.jogamp.newt.impl - Moved awt event handling com.jogamp.newt.awt.event -> com.jogamp.newt.event.awt - NEWTEvent extends java.util.EventObject - NEWTEventListener extends java.util.EventListener - Added Trace*Adapter, logging the event, incl. the time lag
* Newt.X11:XEventsQueued: QueuedAlready doesn't work on ATI - use QueuedAfterFlushSven Gothel2010-04-221-5/+9
|
* Migrating gl2/gl3/gl4 -> gldesktop. Use JOGL_GLDESKTOP_.. when using ↵Sven Gothel2010-04-221-3/+2
| | | | profile.jogl script
* Add remark (unsigned long -> uint_32) ..Sven Gothel2010-04-211-1/+1
|
* JOGL GL4 preperation (cont):Sven Gothel2010-04-201-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All available OpenGL versions (native/platform) are verified at GLProfile initialization and can be queried .. A mapping of major,compat -> major,minor,options is created. - Removal of temp context creation, when creating a context. This was necessary to query general availability of ARB_create_context. Due to the shared context of X11GLXDrawableFactory and WindowsWGLDrawableFactory, this is no more necessary. Due to the version mapping, the ARB_create_context paramters are known. - NativeWindow X11Lib: Added X11ErrorHandler, throwing a RuntimeException. Necessary to catch BadMatch .. etc X11 errors, eg for glXCreateContextAttribsARB Hence all X11 calls are covered now. - X11DummyGLXDrawable needs to use an own Window, otherwise GLn n>2 fails - Flattening the desktop GL* implementation, all use GL4bcImpl, which reduces the footprint dramatically. - GL*Impl.isGL*() (desktop) utilizes the GLContext.isGL*(), hence the results reflect the actual native context version. - GLContextImpl makeCurrent/create: Added workflow documentation, clarified code, defined abstract methods to have a protocol. - Removed moved files (from here to gluegen), see gluegen a01cb3d59715a41153380f1977ec75263b762dc6 - NativeLibLoader -> <TYPE>JNILibLoader - Fixed Exception Handling (as in gluegen bce53b52c8638729750c4286dbc04cb14329fd34), ie removed empty catch Throwable .. - GLContext.setSwapInterval(): Nop in offscreen case, otherwise X11IOError (NVIDIA Bug) Test: Tests - Junit - demos.gears.Gears - demos.jrefract.JRefract Platforms - Linux 64/32 ATI/NVidia - MacOsX - Windows (virtualbox 3.1.6, offscreen failed) TODO/BUGS: - FIXME ATI GLn n>2 with AWT, can't make context current, works well on NVIDIA though - FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available! - Add GL 3.3 to GL3/gl3ext.h - Add GL 4.0 to GL3/gl3ext.h and fix the GL3/GL4 seperation - Rename jogl.gl2.jar -> jogl.gldesktop.jar (as done with it's native lib already)
* Further ATI (fglrx) X11Display bug workaround/cleanupSven Gothel2010-04-151-49/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - See https://bugzilla.mozilla.org/show_bug.cgi?id=486277 - Calling XCloseDisplay occasionally leads to a SIGSEGV, even thought the reference is valid and OK. Workaround is not to close any X11Display, but to hold them stashed and reuse them. Since we already pipeline all X11Display's via Nativewindow's X11Util, an added referenceCounter and a global active/passive list solved this problem. This workaround is only active in case 'isVendorATI()'. NEWT/NativeWindow X11: - Let XIOErrorHandler and invalid display references fail hard with FatalError, otherwise we won't see the stack trace - and those bugs are indeed fatal. NativeWindow X11: - Install XIOErrorHandler, which stays active. - X11Util.X11Display: - Add reference counter - Add global active/passive list. Passive if reference count == 0 and marked as 'un-closeable' (-> ATI). Reusing passive members when create a new display. - JOGL: - Use DeleteLocalRef() calls to free temp NIO buffer in manual *Copied implementation. - GLDrawableFactoryImpl: Be serious about the shutdown() semantics - *GraphicsConfiguration: - Fix the invalid Onscreen/PBuffer/Pixmap determination (X11/EGL/WGL) - Just return null if not valid - X11GLXGraphicsConfigurationFactory - FBConfig - Determine recommendedIndex properly .. - Don't bail out if a FBConfig is invalid .. - Use Chooser in case nothing is recommended .. - X11OffscreenGLXDrawable fixes bugs: - wrong (int) cast of parent window in XCreatePixmap call - setting display to zero too early in destruction, ie before XCloseDisplay - X11GLXDrawableFactory is using [singleton] shared dummy resources for - Screen, Drawable and Context which are utilized in case they are needed .. They are removed at shutdown call - GLXVersion gathering in GLXUtil now .. - DefaultGLCapabilitiesChooser: Respect PBuffer selection Tests: - Add DrawableFactory shutdown() - Add various Offscreen Capabilties - Add Offscreen and non-pbuffer case - JUnit Passed (Linux64bit: NVidia/ATI) - demos.jrefract.JRefract passed (Linux64bit: NVidia/ATI)
* NEWT X11 Fix (mainly ATI and multithreading)Sven Gothel2010-04-131-6/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | - EventDispatchThread -> EDTUtil Since the name leads to the assumptions that an instance is the EDT. EDTUtil manages the EDT within. - EDTUtil, no more reference to Display, but use a Runnable for the pumpMessage() - Window.destroy() check if already done - X11Window: Added XErrorHandler to catch BadWindow and BadAtom while dispatching events - it is possible that the resource is already freed. Also added an XIOErrorHandler to identify the fatal Display* inaccessibility. Tests: - New junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java Testing creation/destruction and double destruction (error case) - Fix: src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java Properly holding all NEWT references .. Misc: - Reduced redundant NEWT 'toString()' output (*Capabilities, ..) -
* moved com.jogamp.javafx.* to com.jogamp.*.Michael Bien2010-03-291-28/+28
|
* final large refactoring to move to com.jogamp.*.Michael Bien2010-03-281-28/+28
|
* Fix Solaris buildSven Gothel2009-10-151-6/+5
|
* NEWT: Add EventDispatchThread (EDT) pattern.Sven Gothel2009-10-101-31/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to limitations on Windows, we need to standardize the one thread for - window creation, and - event dispatching This was already mentioned in the previous implementation but while integrating into another threading model (Plugin3), it turned out that manual managing the thread is too much of a burden. NEWT now uses a EDT per Display and Thread as the default, where Display creation, Window creation and event dispatching is 'pipelined' into. This can be switched off: NewtFactory.setUseEDT(boolean onoff); and queried via: NewtFactory.useEDT(); Note this EDT impl. does not implicate a global lock or whatsoever. The experimantal semantics of a current GL context for input event dispatching is removed, i.e. the GL context is no more made current for mouse/key listener. This reduces the complexity and allows the proper impl. of the external dispatch via EDT .. for example. Removed: GLWindow: setEventHandlerMode(int) .. etc X11Display: XLockDisplay/XUnlockDisplay needed to be utilized to allow the new multithreading (EDT/Render) Display usage. X11Window: lockSurface/unlockSurface locks X11Display as well .. +++++ NEWT: 'getSurfaceHandle()' semantics changed. To allow usage of the surfaceHandle for OS where it is allocated thread local (MS-Windows), it shall be aquired/released while lockSurface/unlockSurface. This is done in the Windows Window implementation. GLWindow can no more query 'getSurfaceHandle()' to verify if 'setRealized()' was successful. NEWT: Window surface lock is recursive and blocking now, as it shall be.
* NEWT: Fix X11 ConfigureEvent ; X11Window don't propagate pos change if parentedSven Gothel2009-09-291-23/+32
|
* Newt: native window parenting MacOSX: OK (but parent clipping is missing) ; ↵Sven Gothel2009-09-121-27/+37
| | | | X11: windowResize event handled
* NEWT: Native window parenting (X11: OK); AWTWindow external Frame OKSven Gothel2009-09-121-13/+8
|
* NEWT: Basic/Naive window parenting support ; NEWT GLWindow: remove ambigous ↵Sven Gothel2009-09-121-4/+6
| | | | create functions, ie with Window and Capabilities arguments