summaryrefslogtreecommitdiffstats
path: root/src/newt/native/X11Display.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-05-01 09:21:14 +0200
committerSven Gothel <[email protected]>2012-05-01 09:21:14 +0200
commit4e0eb391d6c64f956ea5c87c0385ab48a24b2175 (patch)
tree69f0f45c73fc7fe2a95a678e75fa5fb4262911db /src/newt/native/X11Display.c
parent5742b1faa210401470032ef129e56a83c47fd046 (diff)
Fix Bug 560 and NEWT window closing behavior in general for all platforms.
- 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)
Diffstat (limited to 'src/newt/native/X11Display.c')
-rw-r--r--src/newt/native/X11Display.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/newt/native/X11Display.c b/src/newt/native/X11Display.c
index 9b99aebb5..88ac0df7e 100644
--- a/src/newt/native/X11Display.c
+++ b/src/newt/native/X11Display.c
@@ -266,7 +266,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_X11Display_initIDs0
focusChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "focusChanged", "(ZZ)V");
visibleChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "visibleChanged", "(ZZ)V");
reparentNotifyID = (*env)->GetMethodID(env, X11NewtWindowClazz, "reparentNotify", "(J)V");
- windowDestroyNotifyID = (*env)->GetMethodID(env, X11NewtWindowClazz, "windowDestroyNotify", "()V");
+ windowDestroyNotifyID = (*env)->GetMethodID(env, X11NewtWindowClazz, "windowDestroyNotify", "(Z)Z");
windowRepaintID = (*env)->GetMethodID(env, X11NewtWindowClazz, "windowRepaint", "(ZIIII)V");
enqueueMouseEventID = (*env)->GetMethodID(env, X11NewtWindowClazz, "enqueueMouseEvent", "(ZIIIIII)V");
sendMouseEventID = (*env)->GetMethodID(env, X11NewtWindowClazz, "sendMouseEvent", "(IIIIII)V");
@@ -563,9 +563,12 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Display_DispatchMessages0
break;
case ClientMessage:
if (evt.xclient.send_event==True && evt.xclient.data.l[0]==wm_delete_atom) { // windowDeleteAtom
- DBG_PRINT( "X11: event . ClientMessage call %p type 0x%X\n",
+ jboolean closed;
+ DBG_PRINT( "X11: event . ClientMessage call %p type 0x%X ..\n",
(void*)evt.xclient.window, (unsigned int)evt.xclient.message_type);
- (*env)->CallVoidMethod(env, jwindow, windowDestroyNotifyID);
+ closed = (*env)->CallBooleanMethod(env, jwindow, windowDestroyNotifyID, JNI_FALSE);
+ DBG_PRINT( "X11: event . ClientMessage call %p type 0x%X, closed: %d\n",
+ (void*)evt.xclient.window, (unsigned int)evt.xclient.message_type, (int)closed);
// Called by Window.java: CloseWindow();
num_events = 0; // end loop in case of destroyed display
}