summaryrefslogtreecommitdiffstats
path: root/src/newt/native/NewtMacWindow.h
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-16 07:30:09 +0200
committerSven Gothel <[email protected]>2011-10-16 07:30:09 +0200
commitcac4e2e3f2d6c69a207077fd5e0ebec803afb6b0 (patch)
treef9e47f3ba7ac704f8c14bfe83f64122b883af49c /src/newt/native/NewtMacWindow.h
parentaf332515f76a4017e7a52ebec920e794a5398db4 (diff)
NEWT/OSX: Proper impl. of NEWT's focus management (fixes NEWT/AWT focus 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
Diffstat (limited to 'src/newt/native/NewtMacWindow.h')
-rw-r--r--src/newt/native/NewtMacWindow.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h
index 532eba6b4..648b68275 100644
--- a/src/newt/native/NewtMacWindow.h
+++ b/src/newt/native/NewtMacWindow.h
@@ -80,6 +80,8 @@
- (void) rightMouseDown: (NSEvent*) theEvent;
- (void) resetCursorRects;
+- (BOOL) acceptsFirstResponder;
+
@end
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@@ -100,10 +102,8 @@
+ (BOOL) initNatives: (JNIEnv*) env forClass: (jobject) clazz;
- (NSPoint) newtScreenWinPos2OSXScreenPos: (NSPoint) p;
-
- (NSPoint) newtClientWinPos2OSXScreenPos: (NSPoint) p;
- (NSPoint) getLocationOnScreen: (NSPoint) p;
-
- (NSPoint) screenPos2NewtClientWinPos: (NSPoint) p;
- (void) cursorHide:(BOOL)v;
@@ -113,6 +113,15 @@
- (void) updateInsets: (JNIEnv*) env;
+- (BOOL) becomeFirstResponder;
+- (BOOL) resignFirstResponder;
+- (void) becomeKeyWindow;
+- (void) windowDidBecomeKey: (NSNotification *) notification;
+- (void) sendFocusGained;
+- (void) resignKeyWindow;
+- (void) windowDidResignKey: (NSNotification *) notification;
+- (void) sendFocusLost;
+
- (id) initWithContentRect: (NSRect) contentRect
styleMask: (NSUInteger) windowStyle
backing: (NSBackingStoreType) bufferingType