aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/NewtMacWindow.m
Commit message (Collapse)AuthorAgeFilesLines
* Fix Bug 560 and NEWT window closing behavior in general for all platforms.Sven Gothel2012-05-011-4/+31
| | | | | | | | | | | | | | | | | | | | | | - 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)
* Newt/OSX(native): close0() shall not release NewtMacWindow (NSWindow) in ↵Sven Gothel2012-04-211-5/+31
| | | | | | | | case it's already in destruction (destroyNotifySend via windowWillClose()) This fixes the double release crash of the NSWindow, at the end of an application. Tested on OSX 10.6.8 and 10.7.3.
* NEWT/OSX: Cleanup 'javaWindowObject' @ window-close & avoid NPE; Disable ↵Sven Gothel2012-01-181-6/+24
| | | | | | | | | | | | | | | | | | lostFocus (resignKeyWindow) when in fullscreen mode; Ignore invalid key release/type events. - Cleanup 'javaWindowObject' @ window-close & avoid NPE Ensure that the direct window.close() impl. removes the global reference and that all use cases check for NULL pointer. - Disable lostFocus (resignKeyWindow) when in fullscreen mode Similar to the X11 KDE bug, OS X delivers a lostFocus event which we prevent from being processed in fullscreen mode. - Ignore invalid key release/type events In case of offscreen/onscreen switching (fullscreen/reparenting) via destroy/create, the still pressed key would be send to the new window and repeat the action (key typed). State validation discards the double processing.
* NEWT/OSX: Cleanup NewtMacWindow header (sort, fix and add declarations); ↵Sven Gothel2012-01-171-112/+112
| | | | Remove warning of unused var
* NEWT/OSX Pointer Invisible Fix: 10.6.* responder declarations & test ↵Sven Gothel2012-01-161-7/+22
| | | | | | | | | | | | | focus/isInside On OS X 10.6.8 the lack of responder method declarations (mouseEntered, ..) lead to ignore the impl. callbacks. 'isMouseInside' cannot rely on 'mouseExit'/'mouseEntered' when setMouseInvisible() is being called, deduce it manually. focusLost == mouseExit (OS X behavior), hence focusGained needs to set mouse invisible/visible in case it's requested.
* NEWT EVENT_MOUSE_WHEEL_MOVED: Fix Bug 413 - Generate proper mouse wheel events.Sven Gothel2011-12-021-12/+6
| | | | | | | | | | > 0: UP < 0: DOWN See MouseEvent.getWheelRotation() for details. OSX/Windows: Default to wheel 'button' 1 OSX: Properly report '<0' X11: Synthesize wheel events by mapping buttons 4/5 and 6/7 to wheel 1 and 2.
* NEWTMacWindow:View: Make lock recursive ..Sven Gothel2011-11-291-12/+23
| | | | | Attempt to fix the shared-context-multithreading bug (eg. TestSharedContextVBOES2NEWT2) via proper locking .. but seems not to be sufficient (yet).
* NEWT MacWindow: the softLock (pthread mutex) is now always blocking (remove ↵Sven Gothel2011-11-291-18/+0
| | | | non blocking code)
* NewtMacWindow: Add CR/LF to DBG_PRINTSven Gothel2011-11-191-15/+17
|
* NEWT/AWT Focus Traversal / Deadlock Fix (Windows) ; Harmonized NEWT ↵Sven Gothel2011-11-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KeyListener handling (Bug 526) NativeWindow: - expose 'hasFocus()' Window: - 'protected enqueueRequestFocus(..)' -> 'public requestFocus(boolean wait)' - New: 'setKeyboardFocusHandler(KeyListener)' allowing focus traversal co-op w/ covered TK (AWT) WindowImpl: - Impl Window changes (see above) - Impl 'consumedTag' see commit 3b38957f36d4f89b85730755a41c00892ac70591 NewtCanvasAWT: - FocusAction only removes the global AWT focus owner. This fixes a deadlock on the Windows platform of AWT's native peer requestFocus impl, since it's no more called at this point. - NEW FocusTraversalKeyListener is set as the newtChild's KeyboardFocusHandler, allowing traversal to the next/previous AWT component. AWTParentWindowAdapter: - focusGained(..) clears AWT focus and propagates focus to Newt child, non blocking w/ 'requestFocus(false)' (see above) KeyEvent: - Document limitations of getKeyChar() (Bug 526) MacWindow: - only deliver keyChar on key Typed events, harmonizing platform behavior (Bug 526) WindowsWindow: - regenerate the keyCode for EVENT_KEY_TYPED (Bug 526) X11Windows: - complete keyCode mapping X11 -> Newt - X11KeySym2NewtVKey() - only deliver keyChar on key Typed events, harmonizing platform behavior (Bug 526) Tests: - GearsES2: Make focus visible - TestParentingFocusTraversal01AWT: unit test for keyboard focus traversal w/ NewtCanvasAWT
* OSX: CGL type cleanup ; layeredSurface impl.Sven Gothel2011-11-051-15/+15
| | | | | | | | | - Use proper OSX types for NS/CGL prototypes (gluegen) and impl. - Impl layeredSurface (native): - OSXUtil: NSView backing creation - OSXUtil: AttachJAWTSurfaceLayer - CGL: NSOpenGLLayer type impl. and hook
* NEWT/OSX NewtView: Add 'soft' pthread locking impacts: ↵Sven Gothel2011-10-271-10/+66
| | | | | | | | needsDisplay/displayIfNeeded, .. - Add 'soft' pthread locking (blockin) - impacts: needsDisplay/displayIfNeeded, .. - needsDisplay/displayIfNeeded also respects destroyNotifySend (ignore action if set)
* NEWT/OSX: Can't use sending key/mouse directly to WindowImpl, deadlock .. ↵Sven Gothel2011-10-261-1/+7
| | | | see comment
* NEWT/MacOSX: Fix resignKeyWindow super call. Summarize ↵Sven Gothel2011-10-221-40/+12
| | | | sendFocusLost/sendFocusGained -> focusChanged
* NEWT/OSX: Attempt to stabilize native parenting (ie w/ AWT) ; Add ↵Sven Gothel2011-10-201-27/+70
| | | | | | | | | | | | | | | | | windowRepaint() callback - act on positionChanged(..) only for realized windows, otherwise we could end in an AWT deadlock (AWT parent window). - add view parenting calls (addSubView/removeFromSuperview) - attachToParent after view configuration - allow concurrently view draw - add windowRepaint() callback (native -> java) - add more debug tracing
* NEWT/OSX: Send events direct w/o EDT queue (like X11 and Win32)Sven Gothel2011-10-161-10/+28
|
* NEWT/OSX: Proper impl. of NEWT's focus management (fixes NEWT/AWT focus ↵Sven Gothel2011-10-161-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior/tests) - Old code was just requesting the focus and made the window upfront and notifying a gained focus to WindowImpl. (hack) - Using proper requestFocus impl. issuing focusAction() and utilizing native focus gained/lost messages. This distinguish between 'makeKey' and 'orderFront'. Also requesting and accepting (view) first responder role, which is a precursor to proper gained/lost focus handling on OSX. - NEWTCanvasAWT: Adding 'steal AWT focus': +++ void requestFocus() { super.requestFocus(); // AWT < steal AWT focus > NEWTChild.requestFocus() } +++ Helps make the focus traversal between NEWT/AWT more reliable. Happend on OSX that AWT (NewtCanvasAWT instance) didn't release the focus after NEWT child gained the same. We are not able to use the 'focusAction()' here (disabled in this code path) due to AWT-EDT blocking and recursive focus changes. The latter is also intendend to request the AWT focus first .. - AWT/NEWT focus test 01 passes on OSX
* NEWT/OSX: Add mouse enter/exit and pointer features (visible, confined, ↵Sven Gothel2011-10-161-37/+182
| | | | warp) - cleanup pos/coord translations
* Newt/OSX: Fix top/child positioning, positionChanged(), rely on native ↵Sven Gothel2011-10-121-18/+38
| | | | | | | | | | | | pos/size notifications Newt/MacWindow - remove redundant manual window-move/set-size code - Use local getLocationOnScreen(..), fixes positionChanged(..) - setFrameTopLeftPoint(..) use totalHeight (w/ insets) - create: don't 'retain' the window reference (ref counter) - close: release view, - cache insets - to be used @ create
* NEWT: Adapt to GlueGen's Lock ChangeSet, all java callbacks for native have ↵Sven Gothel2011-09-271-22/+26
| | | | | | | | | | | | | | 'defer' 1st argument - Adapt to GlueGen's Lock ChangeSet: e4baba27507ce78e64a150ec6f69fb96f5721a34 - All java callbacks for native have 'defer' 1st argument. This allows enqueuing resulting events to the EDT if required, ie. the native thread may not be 'compatible' (MacOSX). - MacOSX-Native: enqueue key/mouse events and defer:=true for all java callbacks Since we are comming from a 3rd-party thread (AWT/NSApp-MainThread) we shall not abuse it.
* NEWT/JOGL: MacOSX UpdateSven Gothel2011-09-251-27/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Feature related: - Added always-on-top - Added translucency - Child Window Position - AWT parent: manual traverse up the tree and calc position on screen (Problem: the parent view rect is not at the proper position, but covers the whole frame) EDTUtil related: - Works now w/ AWT ot headless (again) - OSX native JNI callbacks gathering JNIEnv properly and attaches/detaches thread. - AWT case: using AWT-Event which properly dispatches our cocoa events - MainThread (headless) case: Fork off thread w/ main class and kick off NSApp run(). This leads to same behavior as w/ AWT case. - Using DefaultEDTUtil - Cleanup MainThread (implements EDTUtil) - Currently not used as EDTUtil (osx), just as launcher - Removed EDTUtil impl code, reuse DefaultEDTUtil - Cleanup AWTEDTUtil (implements EDTUtil) - Currently not used as EDTUtil (osx)
* NativeWindow/NEWT: Refine Insets definition for size and position, read and ↵Sven Gothel2011-09-041-1/+1
| | | | write access
* NEWT: Add WindowListener.windowDestroyed() ; Remove WindowImpl.windowDestroyed()Sven Gothel2010-12-231-4/+1
| | | | | | | | | | | | | 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.
* Fix macosx compilationSven Gothel2010-11-021-10/+10
|
* NEWT: Fix / Stabilize Fullscreen/Decoration/Reparenting Mode ChangesSven Gothel2010-10-211-5/+18
| | | | | | | | | | | | | | | | | | | | | | - 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 OSX 2: Newt EDT (MainThread) and I/O methods ; Build jogl.build.numberSven Gothel2010-07-261-26/+27
|
* Fix file modesSven Gothel2010-07-071-0/+0
|
* Fix: Locking/Threading; Common IntIntHashMap and Buffers; Fix: ↵Sven Gothel2010-06-101-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add missing return in recursive lock; Add MacOSX EVENT_KEY_TYPEDSven Gothel2010-04-241-0/+1
|
* Fix NEWT Window destroy/close race condition,Sven Gothel2010-04-091-1/+1
| | | | | | | | where a programatic window.destroy() call from thread 1 triggers a destroy() call via the native windowing toolkit via windowDestroyNotify(). It has to be checked/locked if a destroy is in progress, otherwise they could deadlock (OSX and Win32).
* Newt: MacOSX child clipping tests (failed)Sven Gothel2009-09-121-0/+8
|
* newt: mac os mouse wheel event support, also made it more consistent with ↵trembovetski2009-08-251-2/+53
| | | | windows
* newt: one more attempt to commit insets-related changestrembovetski2009-08-201-4/+37
|
* Copied JOGL_2_SANDBOX r1957 on to trunk; JOGL_2_SANDBOX branch is now closedKenneth Russel2009-06-151-0/+391
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1959 232f8b59-042b-4e1e-8c03-345bb8c30851