summaryrefslogtreecommitdiffstats
path: root/src/newt/native/NewtMacWindow.m
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-21 04:24:06 +0200
committerSven Gothel <[email protected]>2010-10-21 04:24:06 +0200
commit18bf27fa86da1f26fd085565f501736816d2f2e9 (patch)
treeca44458e4bb00b7969b77473ad93cd826c5ca6a7 /src/newt/native/NewtMacWindow.m
parent6da90f18da639f942bce9dec7fdd9a6c43e22145 (diff)
NEWT: Fix / Stabilize Fullscreen/Decoration/Reparenting Mode Changes
- 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
Diffstat (limited to 'src/newt/native/NewtMacWindow.m')
-rw-r--r--src/newt/native/NewtMacWindow.m23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index da31a686e..9f9442e9d 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -100,12 +100,23 @@ jint GetDeltaY(NSEvent *event, jint javaMods) {
}
}
-/** FIXME: Tried child window: message reception ..
- (void)viewWillDraw
{
fprintf(stderr, "*************** viewWillDraw: 0x%p", javaWindowObject); fflush(stderr);
[super viewWillDraw];
-} */
+}
+
+- (void)viewDidHide
+{
+ (*env)->CallVoidMethod(env, javaWindowObject, visibleChangedID, JNI_FALSE);
+ [super viewDidHide];
+}
+
+- (void)viewDidUnhide
+{
+ (*env)->CallVoidMethod(env, javaWindowObject, visibleChangedID, JNI_TRUE);
+ [super viewDidUnhide];
+}
@end
@@ -113,6 +124,7 @@ static jmethodID sendMouseEventID = NULL;
static jmethodID sendKeyEventID = NULL;
static jmethodID insetsChangedID = NULL;
static jmethodID sizeChangedID = NULL;
+static jmethodID visibleChangedID = NULL;
static jmethodID positionChangedID = NULL;
static jmethodID focusChangedID = NULL;
static jmethodID windowDestroyNotifyID = NULL;
@@ -124,13 +136,14 @@ static jmethodID windowDestroyedID = NULL;
{
sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V");
sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V");
- sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V");
+ sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(IIZ)V");
+ visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(Z)V");
insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(IIII)V");
positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(II)V");
focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(Z)V");
windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V");
windowDestroyedID = (*env)->GetMethodID(env, clazz, "windowDestroyed", "()V");
- if (sendMouseEventID && sendKeyEventID && sizeChangedID && insetsChangedID &&
+ if (sendMouseEventID && sendKeyEventID && sizeChangedID && visibleChangedID && insetsChangedID &&
positionChangedID && focusChangedID && windowDestroyedID && windowDestroyNotifyID)
{
return YES;
@@ -398,7 +411,7 @@ static jint mods2JavaMods(NSUInteger mods)
(*env)->CallVoidMethod(env, javaWindowObject, sizeChangedID,
(jint) contentRect.size.width,
- (jint) contentRect.size.height);
+ (jint) contentRect.size.height, JNI_FALSE);
}
- (void)windowDidMove: (NSNotification*) notification