diff options
author | Sven Gothel <[email protected]> | 2011-09-27 12:20:38 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-27 12:20:38 +0200 |
commit | 472a9c60b5599bb01883c628339ab29628511ed5 (patch) | |
tree | 3431c8bc9da58f7e371b18657d0db99422e96245 /src/newt/native | |
parent | df85f0dfafc09e147f9d422adf5ee8eabf67977b (diff) |
NEWT: Adapt to GlueGen's Lock ChangeSet, all java callbacks for native have '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.
Diffstat (limited to 'src/newt/native')
-rw-r--r-- | src/newt/native/KDWindow.c | 12 | ||||
-rw-r--r-- | src/newt/native/MacWindow.m | 76 | ||||
-rw-r--r-- | src/newt/native/NewtMacWindow.h | 2 | ||||
-rw-r--r-- | src/newt/native/NewtMacWindow.m | 48 | ||||
-rw-r--r-- | src/newt/native/WindowsWindow.c | 32 | ||||
-rw-r--r-- | src/newt/native/X11Window.c | 32 |
6 files changed, 124 insertions, 78 deletions
diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c index 21ad312d0..5f1affed1 100644 --- a/src/newt/native/KDWindow.c +++ b/src/newt/native/KDWindow.c @@ -127,7 +127,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_kd_KDDisplay_DispatchMessages KDint32 v[2]; if(!kdGetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, v)) { DBG_PRINT( "event window size change : src: %p %dx%d\n", userData, v[0], v[1]); - (*env)->CallVoidMethod(env, javaWindow, sizeChangedID, (jint) v[0], (jint) v[1], JNI_FALSE); + (*env)->CallVoidMethod(env, javaWindow, sizeChangedID, JNI_FALSE, (jint) v[0], (jint) v[1], JNI_FALSE); } else { DBG_PRINT( "event window size change error: src: %p %dx%d\n", userData, v[0], v[1]); } @@ -141,7 +141,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_kd_KDDisplay_DispatchMessages KDboolean visible; kdGetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visible); DBG_PRINT( "event window visibility: src: %p, v:%d\n", userData, visible); - (*env)->CallVoidMethod(env, javaWindow, visibleChangedID, visible?JNI_TRUE:JNI_FALSE); + (*env)->CallVoidMethod(env, javaWindow, visibleChangedID, JNI_FALSE, visible?JNI_TRUE:JNI_FALSE); } break; default: @@ -187,8 +187,8 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_kd_KDWindow_initIDs #endif #endif windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(J)V"); - sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(IIZ)V"); - visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(Z)V"); + sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V"); + visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(ZZ)V"); windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V"); @@ -287,7 +287,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_kd_KDWindow_setVisible0 KDboolean v = (visible==JNI_TRUE)?KD_TRUE:KD_FALSE; kdSetWindowPropertybv(w, KD_WINDOWPROPERTY_VISIBILITY, &v); DBG_PRINT( "[setVisible] v=%d\n", visible); - (*env)->CallVoidMethod(env, obj, visibleChangedID, visible); // FIXME: or send via event ? + (*env)->CallVoidMethod(env, obj, visibleChangedID, JNI_FALSE, visible); // FIXME: or defer=true ? } JNIEXPORT void JNICALL Java_jogamp_newt_driver_kd_KDWindow_setFullScreen0 @@ -317,6 +317,6 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_kd_KDWindow_setSize0 DBG_PRINT( "[setSize] v=%dx%d, res=%d\n", width, height, res); (void)res; - (*env)->CallVoidMethod(env, obj, sizeChangedID, (jint) width, (jint) height, JNI_FALSE); + (*env)->CallVoidMethod(env, obj, sizeChangedID, JNI_FALSE, (jint) width, (jint) height, JNI_FALSE); } diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m index 946ac489c..a149c74af 100644 --- a/src/newt/native/MacWindow.m +++ b/src/newt/native/MacWindow.m @@ -249,7 +249,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_createWindow0 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NewtView* myView = (NewtView*) (intptr_t) jview ; - DBG_PRINT( "createWindow0 - %p (this), %p (parent), %d/%d %dx%d, opaque %d, fs %d, style %X, buffType %X, screenidx %d, view %p\n", + DBG_PRINT( "createWindow0 - %p (this), %p (parent), %d/%d %dx%d, opaque %d, fs %d, style %X, buffType %X, screenidx %d, view %p (START)\n", (void*)(intptr_t)jthis, (void*)(intptr_t)parent, (int)x, (int)y, (int)w, (int)h, (int) opaque, (int)fullscreen, (int)styleMask, (int)bufferingType, (int)screen_idx, myView); @@ -302,18 +302,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_createWindow0 [myWindow setBackgroundColor: [NSColor clearColor]]; } - /** - if (fullscreen) { - [myWindow setOpaque: YES]; - } else { - // If the window is undecorated, assume we want the possibility of - // a shaped window, so make it non-opaque and the background color clear - if ((styleMask & NSTitledWindowMask) == 0) { - [myWindow setOpaque: NO]; - [myWindow setBackgroundColor: [NSColor clearColor]]; - } - } */ - // specify we want mouse-moved events [myWindow setAcceptsMouseMovedEvents:YES]; @@ -341,6 +329,9 @@ NS_ENDHANDLER // right mouse button down events [myView setNextResponder: myWindow]; + DBG_PRINT( "createWindow0 - %p (this), %p (parent): new window: %p (END)\n", + (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow); + [pool release]; return (jlong) ((intptr_t) myWindow); @@ -356,8 +347,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_makeKeyAndOrderF { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "makeKeyAndOrderFront0 - window: %p (START)\n", win); + [win performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:win waitUntilDone:NO]; // [win makeKeyAndOrderFront: win]; + + DBG_PRINT( "makeKeyAndOrderFront0 - window: %p (END)\n", win); + [pool release]; } @@ -371,8 +368,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_makeKey0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "makeKey0 - window: %p (START)\n", win); + [win performSelectorOnMainThread:@selector(makeKeyWindow:) withObject:nil waitUntilDone:NO]; // [win makeKeyWindow]; + + DBG_PRINT( "makeKey0 - window: %p (END)\n", win); + [pool release]; } @@ -386,8 +389,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_orderOut0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "orderOut0 - window: %p (START)\n", win); + [win performSelectorOnMainThread:@selector(orderOut:) withObject:win waitUntilDone:NO]; // [win orderOut: win]; + + DBG_PRINT( "orderOut0 - window: %p (END)\n", win); + [pool release]; } @@ -431,10 +440,16 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setTitle0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "setTitle0 - window: %p (START)\n", win); + NSString* str = jstringToNSString(env, title); [str autorelease]; [win performSelectorOnMainThread:@selector(setTitle:) withObject:str waitUntilDone:NO]; // [win setTitle: str]; + + DBG_PRINT( "setTitle0 - window: %p (END)\n", win); + [pool release]; } @@ -448,7 +463,13 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_contentView0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "contentView0 - window: %p (START)\n", win); + jlong res = (jlong) ((intptr_t) [win contentView]); + + DBG_PRINT( "contentView0 - window: %p (END)\n", win); + [pool release]; return res; } @@ -463,6 +484,11 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_changeContentVi { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSWindow* win = (NewtMacWindow*) ((intptr_t) window); + NewtView* newView = (NewtView *) ((intptr_t) jview); + + DBG_PRINT( "changeContentView0 - window: %p (START)\n", win); + NSObject *nsParentObj = (NSObject*) ((intptr_t) parentWindowOrView); NSWindow* pWin = NULL; NSView* pView = NULL; @@ -476,11 +502,10 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_changeContentVi } } - NSWindow* win = (NewtMacWindow*) ((intptr_t) window); - NewtView* newView = (NewtView *) ((intptr_t) jview); - NewtView* oldView = changeContentView(env, jthis, pWin, pView, win, newView); + DBG_PRINT( "changeContentView0 - window: %p (END)\n", win); + [pool release]; return (jlong) ((intptr_t) oldView); @@ -496,8 +521,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setContentSize0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "setContentSize0 - window: %p (START)\n", win); + NSSize sz = NSMakeSize(w, h); [win setContentSize: sz]; + + DBG_PRINT( "setContentSize0 - window: %p (END)\n", win); + [pool release]; } @@ -512,7 +543,13 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setFrameTopLeftP NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* pwin = (NSWindow*) ((intptr_t) parent); NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "setFrameTopLeftPoint0 - window: %p (START)\n", win); + setFrameTopLeftPoint(pwin, win, x, y); + + DBG_PRINT( "setFrameTopLeftPoint0 - window: %p (END)\n", win); + [pool release]; } @@ -526,12 +563,17 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setAlwaysOnTop0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* win = (NSWindow*) ((intptr_t) window); + + DBG_PRINT( "setAlwaysOnTop0 - window: %p (START)\n", win); + if(atop) { [win setLevel:NSFloatingWindowLevel]; } else { [win setLevel:NSNormalWindowLevel]; } + + DBG_PRINT( "setAlwaysOnTop0 - window: %p (END)\n", win); + [pool release]; } - diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h index a8931d6fc..5c465d4e9 100644 --- a/src/newt/native/NewtMacWindow.h +++ b/src/newt/native/NewtMacWindow.h @@ -36,7 +36,7 @@ #include "NewtCommon.h" -// #define VERBOSE_ON 1 +#define VERBOSE_ON 1 #ifdef VERBOSE_ON #define DBG_PRINT(...) fprintf(stderr, __VA_ARGS__); fflush(stderr) diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m index 6125761e3..eb1426dc2 100644 --- a/src/newt/native/NewtMacWindow.m +++ b/src/newt/native/NewtMacWindow.m @@ -72,8 +72,10 @@ jint GetDeltaY(NSEvent *event, jint javaMods) { return 0; } -static jmethodID sendMouseEventID = NULL; -static jmethodID sendKeyEventID = NULL; +static jmethodID enqueueMouseEventID = NULL; +static jmethodID enqueueKeyEventID = NULL; +static jmethodID enqueueRequestFocusID = NULL; + static jmethodID insetsChangedID = NULL; static jmethodID sizeChangedID = NULL; static jmethodID visibleChangedID = NULL; @@ -145,7 +147,7 @@ static jmethodID windowDestroyNotifyID = NULL; return; } - (*env)->CallVoidMethod(env, javaWindowObject, visibleChangedID, JNI_FALSE); + (*env)->CallVoidMethod(env, javaWindowObject, visibleChangedID, JNI_TRUE, JNI_FALSE); if (shallBeDetached) { (*jvmHandle)->DetachCurrentThread(jvmHandle); @@ -163,7 +165,7 @@ static jmethodID windowDestroyNotifyID = NULL; return; } - (*env)->CallVoidMethod(env, javaWindowObject, visibleChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, javaWindowObject, visibleChangedID, JNI_TRUE, JNI_TRUE); if (shallBeDetached) { (*jvmHandle)->DetachCurrentThread(jvmHandle); @@ -178,16 +180,17 @@ static jmethodID windowDestroyNotifyID = NULL; + (BOOL) initNatives: (JNIEnv*) env forClass: (jclass) clazz { - sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); - sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)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"); + enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZIIIIII)V"); + enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZIIIC)V"); + sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V"); + visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(ZZ)V"); + insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(ZIIII)V"); + positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(ZII)V"); + focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(ZZ)V"); windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); - if (sendMouseEventID && sendKeyEventID && sizeChangedID && visibleChangedID && insetsChangedID && - positionChangedID && focusChangedID && windowDestroyNotifyID) + enqueueRequestFocusID = (*env)->GetMethodID(env, clazz, "enqueueRequestFocus", "(Z)V"); + if (enqueueMouseEventID && enqueueKeyEventID && sizeChangedID && visibleChangedID && insetsChangedID && + positionChangedID && focusChangedID && windowDestroyNotifyID && enqueueRequestFocusID) { return YES; } @@ -219,8 +222,7 @@ static jmethodID windowDestroyNotifyID = NULL; DBG_PRINT( "updateInsets: [ l %d, r %d, t %d, b %d ]\n", (int)left, (int)right, (int)top, (int)bottom); - (*env)->CallVoidMethod(env, javaWindowObject, insetsChangedID, - left, right, top, bottom); + (*env)->CallVoidMethod(env, javaWindowObject, insetsChangedID, JNI_TRUE, left, right, top, bottom); } - (id) initWithContentRect: (NSRect) contentRect @@ -294,7 +296,7 @@ static jint mods2JavaMods(NSUInteger mods) // Note: the key code in the NSEvent does not map to anything we can use jchar keyChar = (jchar) [chars characterAtIndex: i]; - (*env)->CallVoidMethod(env, javaWindowObject, sendKeyEventID, + (*env)->CallVoidMethod(env, javaWindowObject, enqueueKeyEventID, JNI_FALSE, evType, javaMods, keyCode, keyChar); } @@ -378,7 +380,10 @@ static jint mods2JavaMods(NSUInteger mods) // ignore 0 increment wheel scroll events return; } - (*env)->CallVoidMethod(env, javaWindowObject, sendMouseEventID, + if (evType == EVENT_MOUSE_PRESSED) { + (*env)->CallVoidMethod(env, javaWindowObject, enqueueRequestFocusID, JNI_FALSE); + } + (*env)->CallVoidMethod(env, javaWindowObject, enqueueMouseEventID, JNI_FALSE, evType, javaMods, (jint) location.x, (jint) (contentRect.size.height - location.y), @@ -483,7 +488,7 @@ static jint mods2JavaMods(NSUInteger mods) NSRect frameRect = [self frame]; NSRect contentRect = [self contentRectForFrameRect: frameRect]; - (*env)->CallVoidMethod(env, javaWindowObject, sizeChangedID, + (*env)->CallVoidMethod(env, javaWindowObject, sizeChangedID, JNI_TRUE, (jint) contentRect.size.width, (jint) contentRect.size.height, JNI_FALSE); @@ -522,8 +527,7 @@ static jint mods2JavaMods(NSUInteger mods) screenRect = [screen frame]; pt = NSMakePoint(rect.origin.x, screenRect.origin.y + screenRect.size.height - rect.origin.y - rect.size.height); - (*env)->CallVoidMethod(env, javaWindowObject, positionChangedID, - (jint) pt.x, (jint) pt.y); + (*env)->CallVoidMethod(env, javaWindowObject, positionChangedID, JNI_TRUE, (jint) pt.x, (jint) pt.y); if (shallBeDetached) { (*jvmHandle)->DetachCurrentThread(jvmHandle); @@ -593,7 +597,7 @@ static jint mods2JavaMods(NSUInteger mods) return; } - (*env)->CallVoidMethod(env, javaWindowObject, focusChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, javaWindowObject, focusChangedID, JNI_TRUE, JNI_TRUE); if (shallBeDetached) { (*jvmHandle)->DetachCurrentThread(jvmHandle); @@ -620,7 +624,7 @@ static jint mods2JavaMods(NSUInteger mods) return; } - (*env)->CallVoidMethod(env, javaWindowObject, focusChangedID, JNI_FALSE); + (*env)->CallVoidMethod(env, javaWindowObject, focusChangedID, JNI_TRUE, JNI_FALSE); if (shallBeDetached) { (*jvmHandle)->DetachCurrentThread(jvmHandle); diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 8402373b3..307938ac1 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -666,7 +666,7 @@ static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd) (int)m_insets.left, (int)m_insets.top, (int)m_insets.right, (int)m_insets.bottom, (int)(m_insets.right-m_insets.left), (int)(m_insets.top-m_insets.bottom)); - (*env)->CallVoidMethod(env, window, insetsChangedID, + (*env)->CallVoidMethod(env, window, insetsChangedID, JNI_FALSE, m_insets.left, m_insets.right, m_insets.top, m_insets.bottom); return &m_insets; @@ -732,7 +732,7 @@ static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd) (void*)hwnd, (int)m_insets.left, (int)m_insets.right, (int)m_insets.top, (int)m_insets.bottom, (int) ( m_insets.left + m_insets.right ), (int) (m_insets.top + m_insets.bottom)); - (*env)->CallVoidMethod(env, window, insetsChangedID, + (*env)->CallVoidMethod(env, window, insetsChangedID, JNI_FALSE, (int)m_insets.left, (int)m_insets.right, (int)m_insets.top, (int)m_insets.bottom); return &m_insets; } @@ -761,7 +761,7 @@ static void WmSize(JNIEnv *env, jobject window, HWND wnd, UINT type) DBG_PRINT("*** WindowsWindow: WmSize window %p, %dx%d, visible %d\n", (void*)wnd, w, h, isVisible); - (*env)->CallVoidMethod(env, window, sizeChangedID, w, h, JNI_FALSE); + (*env)->CallVoidMethod(env, window, sizeChangedID, JNI_FALSE, w, h, JNI_FALSE); } static LRESULT CALLBACK wndProc(HWND wnd, UINT message, @@ -944,22 +944,22 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, } case WM_SETFOCUS: - (*env)->CallVoidMethod(env, window, focusChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_TRUE); useDefWindowProc = 1; break; case WM_KILLFOCUS: - (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE); + (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE); useDefWindowProc = 1; break; case WM_SHOWWINDOW: - (*env)->CallVoidMethod(env, window, visibleChangedID, wParam==TRUE?JNI_TRUE:JNI_FALSE); + (*env)->CallVoidMethod(env, window, visibleChangedID, JNI_FALSE, wParam==TRUE?JNI_TRUE:JNI_FALSE); break; case WM_MOVE: DBG_PRINT("*** WindowsWindow: WM_MOVE window %p, %d/%d\n", wnd, (int)LOWORD(lParam), (int)HIWORD(lParam)); - (*env)->CallVoidMethod(env, window, positionChangedID, (jint)LOWORD(lParam), (jint)HIWORD(lParam)); + (*env)->CallVoidMethod(env, window, positionChangedID, JNI_FALSE, (jint)LOWORD(lParam), (jint)HIWORD(lParam)); useDefWindowProc = 1; break; @@ -971,7 +971,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, jint width = r.right-r.left; jint height = r.bottom-r.top; if (width > 0 && height > 0) { - (*env)->CallVoidMethod(env, window, windowRepaintID, r.left, r.top, width, height); + (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, r.left, r.top, width, height); } ValidateRect(wnd, &r); */ @@ -980,7 +980,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, } case WM_ERASEBKGND: // ignore erase background - (*env)->CallVoidMethod(env, window, windowRepaintID, 0, 0, -1, -1); + (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1); useDefWindowProc = 0; res = 1; // OpenGL, etc .. erases the background, hence we claim to have just done this break; @@ -1240,13 +1240,13 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowsWindow_initIDs { NewtCommon_init(env); - insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(IIII)V"); - sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(IIZ)V"); - positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(II)V"); - focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(Z)V"); - visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(Z)V"); + insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(ZIIII)V"); + sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V"); + positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(ZII)V"); + focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(ZZ)V"); + visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(ZZ)V"); windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); - windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(IIII)V"); + windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(ZIIII)V"); enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZIIIIII)V"); sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZIIIC)V"); @@ -1396,7 +1396,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowsWindow_CreateWind // send insets before visibility, allowing java code a proper sync point! insets = UpdateInsets(env, wud->jinstance, window); - (*env)->CallVoidMethod(env, wud->jinstance, visibleChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, wud->jinstance, visibleChangedID, JNI_FALSE, JNI_TRUE); if(!userPos) { GetWindowRect(window, &rc); diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index e1a0071b5..f2af91970 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -504,13 +504,13 @@ static Status NewtWindows_updateInsets(JNIEnv *env, jobject jwindow, Display *dp if(0 != NewtWindows_getFrameExtends(dpy, window, left, right, top, bottom)) { DBG_PRINT( "NewtWindows_updateInsets: insets by _NET_FRAME_EXTENTS [ l %d, r %d, t %d, b %d ]\n", *left, *right, *top, *bottom); - (*env)->CallVoidMethod(env, jwindow, insetsChangedID, *left, *right, *top, *bottom); + (*env)->CallVoidMethod(env, jwindow, insetsChangedID, JNI_FALSE, *left, *right, *top, *bottom); return 1; // OK } else if(0 != NewtWindows_getParentPosition (dpy, window, left, top)) { *right = *left; *bottom = *left; DBG_PRINT( "NewtWindows_updateInsets: insets by parent position [ l %d, r %d, t %d, b %d ]\n", *left, *right, *top, *bottom); - (*env)->CallVoidMethod(env, jwindow, insetsChangedID, *left, *right, *top, *bottom); + (*env)->CallVoidMethod(env, jwindow, insetsChangedID, JNI_FALSE, *left, *right, *top, *bottom); return 1; // OK } return 0; // Error @@ -886,9 +886,9 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Display_DispatchMessages0 int left, right, top, bottom; NewtWindows_updateInsets(env, jwindow, dpy, evt.xany.window, &left, &right, &top, &bottom); } - (*env)->CallVoidMethod(env, jwindow, sizeChangedID, + (*env)->CallVoidMethod(env, jwindow, sizeChangedID, JNI_FALSE, (jint) evt.xconfigure.width, (jint) evt.xconfigure.height, JNI_FALSE); - (*env)->CallVoidMethod(env, jwindow, positionChangedID, + (*env)->CallVoidMethod(env, jwindow, positionChangedID, JNI_FALSE, (jint) evt.xconfigure.x, (jint) evt.xconfigure.y); } break; @@ -904,12 +904,12 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Display_DispatchMessages0 case FocusIn: DBG_PRINT( "X11: event . FocusIn call %p\n", (void*)evt.xvisibility.window); - (*env)->CallVoidMethod(env, jwindow, focusChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, jwindow, focusChangedID, JNI_FALSE, JNI_TRUE); break; case FocusOut: DBG_PRINT( "X11: event . FocusOut call %p\n", (void*)evt.xvisibility.window); - (*env)->CallVoidMethod(env, jwindow, focusChangedID, JNI_FALSE); + (*env)->CallVoidMethod(env, jwindow, focusChangedID, JNI_FALSE, JNI_FALSE); break; case Expose: @@ -917,7 +917,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Display_DispatchMessages0 evt.xexpose.x, evt.xexpose.y, evt.xexpose.width, evt.xexpose.height, evt.xexpose.count); if (evt.xexpose.count == 0 && evt.xexpose.width > 0 && evt.xexpose.height > 0) { - (*env)->CallVoidMethod(env, jwindow, windowRepaintID, + (*env)->CallVoidMethod(env, jwindow, windowRepaintID, JNI_FALSE, evt.xexpose.x, evt.xexpose.y, evt.xexpose.width, evt.xexpose.height); } break; @@ -933,7 +933,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Display_DispatchMessages0 int left, right, top, bottom; NewtWindows_updateInsets(env, jwindow, dpy, evt.xany.window, &left, &right, &top, &bottom); } - (*env)->CallVoidMethod(env, jwindow, visibleChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, jwindow, visibleChangedID, JNI_FALSE, JNI_TRUE); } break; @@ -943,7 +943,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Display_DispatchMessages0 evt.xunmap.event!=evt.xunmap.window); if( evt.xunmap.event == evt.xunmap.window ) { // ignore child window notification - (*env)->CallVoidMethod(env, jwindow, visibleChangedID, JNI_FALSE); + (*env)->CallVoidMethod(env, jwindow, visibleChangedID, JNI_FALSE, JNI_FALSE); } break; @@ -1437,14 +1437,14 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_X11Screen_setCurrentScree JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_X11Window_initIDs0 (JNIEnv *env, jclass clazz) { - insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(IIII)V"); - sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(IIZ)V"); - positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(II)V"); - focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(Z)V"); - visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(Z)V"); + insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(ZIIII)V"); + sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V"); + positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(ZII)V"); + focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(ZZ)V"); + visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(ZZ)V"); reparentNotifyID = (*env)->GetMethodID(env, clazz, "reparentNotify", "(J)V"); windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); - windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(IIII)V"); + windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(ZIIII)V"); enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZIIIIII)V"); sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZIIIC)V"); @@ -1638,7 +1638,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_X11Window_CreateWindow0 // send insets before visibility, allowing java code a proper sync point! NewtWindows_updateInsets(env, jwindow, dpy, window, &left, &right, &top, &bottom); - (*env)->CallVoidMethod(env, jwindow, visibleChangedID, JNI_TRUE); + (*env)->CallVoidMethod(env, jwindow, visibleChangedID, JNI_FALSE, JNI_TRUE); if(!userPos) { // get position from WM |