aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-10-02 19:49:04 +0200
committerSven Gothel <[email protected]>2023-10-02 19:49:04 +0200
commit7a2ee84416989476b7b2fd05ce484a5c7fcf81e8 (patch)
treecbc6a26e3def4627bc0b99b944f419367bb0f481
parentaf13e40ee502e69bb12e979e406c1a9793535482 (diff)
Bug 1470 - NEWT/JNI: Perform exception check and rethrow for all Java Callbacks as recommended
-rw-r--r--src/newt/native/IOSNewtUIWindow.m10
-rw-r--r--src/newt/native/MacNewtNSWindow.m13
-rw-r--r--src/newt/native/WindowsWindow.c41
-rw-r--r--src/newt/native/bcm_egl.c2
-rw-r--r--src/newt/native/bcm_vc_iv.c6
-rw-r--r--src/newt/native/drm_gbm.c2
6 files changed, 67 insertions, 7 deletions
diff --git a/src/newt/native/IOSNewtUIWindow.m b/src/newt/native/IOSNewtUIWindow.m
index 2efd7a25c..5d89d448e 100644
--- a/src/newt/native/IOSNewtUIWindow.m
+++ b/src/newt/native/IOSNewtUIWindow.m
@@ -222,6 +222,7 @@ static jmethodID windowRepaintID = NULL;
(*env)->CallBooleanMethod(env, javaWindowObject, windowRepaintID, JNI_TRUE /* defer */,
(int)dirtyRect.origin.x, (int)viewFrame.size.height - (int)dirtyRect.origin.y,
(int)dirtyRect.size.width, (int)dirtyRect.size.height);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.drawRect: Exception occured at windowRepaint(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -414,6 +415,7 @@ static jmethodID windowRepaintID = NULL;
(*env)->CallVoidMethod(env, javaWindowObject, sendTouchScreenEventID,
(jshort)newtEventType, (jint)newtEventModifiers,
jActionIdx, jNames, jTouchTypes, jX, jY, jPressure, (jfloat)2.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.sendTouchEvent: Exception occured at sendTouchScreenEvent(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -606,6 +608,7 @@ static jmethodID windowRepaintID = NULL;
}
(*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, defer?JNI_TRUE:JNI_FALSE,
(jfloat)oldPixelScaleV, (jfloat)pixelScale, (jfloat)maxPixelScale, (jboolean)changeScale);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.updatePixelScale: Exception occured at updatePixelScale(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -664,6 +667,7 @@ static jmethodID windowRepaintID = NULL;
}
(*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, defer?JNI_TRUE:JNI_FALSE,
(jfloat)oldPixelScaleV, (jfloat)pixelScale, (jfloat)maxPixelScale, (jboolean)changeScale);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.setPixelScale: Exception occured at updatePixelScale(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -692,6 +696,7 @@ static jmethodID windowRepaintID = NULL;
if( NULL != env && NULL != javaWin ) {
(*env)->CallBooleanMethod(env, javaWin, insetsChangedID, JNI_FALSE, cachedInsets[0], cachedInsets[1], cachedInsets[2], cachedInsets[3]);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.updateInsets: Exception occured at insetsChanged(..)");
}
}
@@ -716,6 +721,7 @@ static jmethodID windowRepaintID = NULL;
JNI_FALSE, // force
withinLiveResize
);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.updateSizePosInsets: Exception occured at sizeScreenPosInsetsChangedID(..)");
}
}
@@ -800,6 +806,7 @@ static jmethodID windowRepaintID = NULL;
}
(*env)->CallBooleanMethod(env, javaWindowObject, focusChangedID, JNI_FALSE, (gained == YES) ? JNI_TRUE : JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.focusChanged: Exception occured at focusChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -824,6 +831,7 @@ static jmethodID windowRepaintID = NULL;
return;
}
(*env)->CallBooleanMethod(env, javaWindowObject, visibleChangedID, (visible == YES) ? JNI_TRUE : JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.visibilityChanged: Exception occured at visibilityChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -923,6 +931,7 @@ static jmethodID windowRepaintID = NULL;
p0 = [self getLocationOnScreen: p0];
DBG_PRINT( "windowDidMove: [ x %d, y %d ]\n", (jint) p0.x, (jint) p0.y);
(*env)->CallBooleanMethod(env, javaWindowObject, screenPositionChangedID, JNI_TRUE, (jint) p0.x, (jint) p0.y);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.windowDidMove: Exception occured at screenPositionChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -956,6 +965,7 @@ static jmethodID windowRepaintID = NULL;
}
[newtView setDestroyNotifySent: true]; // earmark assumption of being closed
closed = (*env)->CallBooleanMethod(env, javaWindowObject, windowDestroyNotifyID, force ? JNI_TRUE : JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "IOSWindow.windowClosingImpl: Exception occured at windowDestroyNotify(..)");
if(!force && !closed) {
// not closed on java side, not force -> clear flag
[newtView setDestroyNotifySent: false];
diff --git a/src/newt/native/MacNewtNSWindow.m b/src/newt/native/MacNewtNSWindow.m
index 73bcaddcc..5a65788d2 100644
--- a/src/newt/native/MacNewtNSWindow.m
+++ b/src/newt/native/MacNewtNSWindow.m
@@ -380,6 +380,7 @@ static jmethodID windowRepaintID = NULL;
(*env)->CallBooleanMethod(env, javaWindowObject, windowRepaintID, JNI_TRUE /* defer */,
(int)dirtyRect.origin.x, (int)viewFrame.size.height - (int)dirtyRect.origin.y,
(int)dirtyRect.size.width, (int)dirtyRect.size.height);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.drawRect: Exception occured at windowRepaint(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -399,6 +400,7 @@ static jmethodID windowRepaintID = NULL;
}
(*env)->CallBooleanMethod(env, javaWindowObject, visibleChangedID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.viewDidHide: Exception occured at visibleChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -420,6 +422,7 @@ static jmethodID windowRepaintID = NULL;
}
(*env)->CallBooleanMethod(env, javaWindowObject, visibleChangedID, JNI_TRUE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.viewDidUnhide: Exception occured at visibleChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -723,6 +726,7 @@ static jmethodID windowRepaintID = NULL;
}
if (evType == EVENT_MOUSE_PRESSED) {
(*env)->CallVoidMethod(env, javaWindowObject, requestFocusID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.sendMouseEvent: Exception occured at requestFocus(..)");
}
NSPoint location = [self screenPos2NewtClientWinPos: [NSEvent mouseLocation]];
@@ -731,6 +735,7 @@ static jmethodID windowRepaintID = NULL;
evType, javaMods[0],
(jint) location.x, (jint) location.y,
javaButtonNum, scrollDeltaY);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.sendMouseEvent: Exception occured at enqueueMouseEvent(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -811,6 +816,7 @@ static jmethodID windowRepaintID = NULL;
(*env)->CallBooleanMethod(env, javaWindowObject, enqueueKeyEventID, JNI_FALSE,
evType, javaMods, keyCode, (jchar)keyChar, (jchar)keySymChar);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.sendKeyEvent: Exception occured at enqueueKeyEvent(..)");
}
} else {
// non-printable chars
@@ -820,6 +826,7 @@ static jmethodID windowRepaintID = NULL;
(*env)->CallBooleanMethod(env, javaWindowObject, enqueueKeyEventID, JNI_FALSE,
evType, javaMods, keyCode, keyChar, keyChar);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.sendKeyEvent: Exception occured at enqueueKeyEvent(..)");
}
// detaching thread not required - daemon
@@ -863,6 +870,7 @@ NS_ENDHANDLER
}
(*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE /* defer */,
(jfloat)oldPixelScale, (jfloat)pixelScale, (jfloat)maxPixelScale, (jboolean)changeScale);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.viewDidChangeBackingProperties: Exception occured at updatePixelScale(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -1016,6 +1024,7 @@ NS_ENDHANDLER
if( NULL != env && NULL != javaWin ) {
(*env)->CallBooleanMethod(env, javaWin, insetsChangedID, JNI_FALSE, cachedInsets[0], cachedInsets[1], cachedInsets[2], cachedInsets[3]);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.updateInsets: Exception occured at insetsChanged(..)");
}
}
@@ -1042,6 +1051,7 @@ NS_ENDHANDLER
JNI_FALSE, // force
withinLiveResize
);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.updateSizePosInsets: Exception occured at sizeScreenPosInsetsChanged(..)");
}
}
@@ -1215,6 +1225,7 @@ NS_ENDHANDLER
}
(*env)->CallBooleanMethod(env, javaWindowObject, focusChangedID, JNI_FALSE, (gained == YES) ? JNI_TRUE : JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.focusChanged: Exception occured at focusChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -1374,6 +1385,7 @@ NS_ENDHANDLER
p0 = [self getLocationOnScreen: p0];
DBG_PRINT( "windowDidMove: [ x %d, y %d ]\n", (jint) p0.x, (jint) p0.y);
(*env)->CallBooleanMethod(env, javaWindowObject, screenPositionChangedID, JNI_TRUE, (jint) p0.x, (jint) p0.y);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.windowDidMove: Exception occured at screenPositionChanged(..)");
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -1417,6 +1429,7 @@ NS_ENDHANDLER
}
[newtView setDestroyNotifySent: true]; // earmark assumption of being closed
closed = (*env)->CallBooleanMethod(env, javaWindowObject, windowDestroyNotifyID, force ? JNI_TRUE : JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "MacWindow.windowClosingImpl: Exception occured at windowDestroyNotify(..)");
if(!force && !closed) {
// not closed on java side, not force -> clear flag
[newtView setDestroyNotifySent: false];
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 201304dd9..dd856919f 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -597,6 +597,7 @@ static int WmKeyDown(JNIEnv *env, jobject window, USHORT wkey, WORD repCnt, BYTE
(*env)->CallBooleanMethod(env, window, sendKeyEventID,
(jshort) EVENT_KEY_PRESSED,
(jint) modifiers, (jshort) javaVKeyUS, (jshort) javaVKeyXX, (jchar) utf16Char);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.WmKeyDown: Exception occured at sendKeyEvent(..)");
return 0;
}
@@ -615,6 +616,7 @@ static int WmKeyUp(JNIEnv *env, jobject window, USHORT wkey, WORD repCnt, BYTE s
(*env)->CallBooleanMethod(env, window, sendKeyEventID,
(jshort) EVENT_KEY_RELEASED,
(jint) modifiers, (jshort) javaVKeyUS, (jshort) javaVKeyXX, (jchar) utf16Char);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.WmKeyUp: Exception occured at sendKeyEvent(..)");
return 0;
}
@@ -760,8 +762,10 @@ static jboolean UpdateInsets(JNIEnv *env, WindowUserData *wud, HWND hwnd) {
(void*)hwnd, strategy, (int)wud->insets.left, (int)wud->insets.right, (int)wud->insets.top, (int)wud->insets.bottom,
(int) ( wud->insets.left + wud->insets.right ), (int) (wud->insets.top + wud->insets.bottom), wud->isInCreation);
if( !wud->isInCreation ) {
- return (*env)->CallBooleanMethod(env, window, insetsChangedID,
- JNI_FALSE, (int)wud->insets.left, (int)wud->insets.right, (int)wud->insets.top, (int)wud->insets.bottom);
+ jboolean res = (*env)->CallBooleanMethod(env, window, insetsChangedID,
+ JNI_FALSE, (int)wud->insets.left, (int)wud->insets.right, (int)wud->insets.top, (int)wud->insets.bottom);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.UpdateInsets: Exception occured at insetsChanged(..)");
+ return res;
}
return JNI_TRUE;
}
@@ -815,11 +819,13 @@ static void WmSize(JNIEnv *env, WindowUserData * wud, HWND wnd, UINT type)
DBG_PRINT( "WindowsWindow: WmSize.X window %p - Leave J, maximized\n", (void*)wnd);
return;
}
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.WmSize: Exception occured at maximizedChanged(..)");
}
if( JNI_FALSE == (*env)->CallBooleanMethod(env, window, sizeChangedID, JNI_FALSE, JNI_FALSE, wud->width, wud->height, JNI_FALSE) ) {
DBG_PRINT( "WindowsWindow: WmSize.X window %p - Leave J, sizeChanged\n", (void*)wnd);
return;
}
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.WmSize: Exception occured at sizeChanged(..)");
}
}
@@ -941,9 +947,11 @@ static jboolean sendTouchScreenEvent(JNIEnv *env, jobject window,
}
(*env)->SetFloatArrayRegion(env, jPressure, 0, count, pressure);
- return (*env)->CallBooleanMethod(env, window, sendTouchScreenEventID,
- (jshort)eventType, (jint)modifiers, (jint)actionIdx,
- jNames, jX, jY, jPressure, (jfloat)maxPressure);
+ jboolean res = (*env)->CallBooleanMethod(env, window, sendTouchScreenEventID,
+ (jshort)eventType, (jint)modifiers, (jint)actionIdx,
+ jNames, jX, jY, jPressure, (jfloat)maxPressure);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendTouchScreenEvent(..)");
+ return res;
}
// #define DO_ERASEBKGND 1
@@ -982,6 +990,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
// WM_CLOSE -> Java::windowDestroyNotify -> W_DESTROY
case WM_CLOSE:
(*env)->CallBooleanMethod(env, window, windowDestroyNotifyID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at windowDestroyNotify(..)");
break;
case WM_DESTROY:
@@ -1073,6 +1082,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
wud->visible = wParam==TRUE;
if( !wud->isInCreation ) {
(*env)->CallBooleanMethod(env, window, visibleChangedID, wParam==TRUE?JNI_TRUE:JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at visibleChanged(..)");
}
break;
@@ -1082,6 +1092,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
DBG_PRINT("*** WindowsWindow: WM_MOVE window %p, %d/%d, at-init %d\n", wnd, wud->xpos, wud->ypos, wud->isInCreation);
if( !wud->isInCreation ) {
(*env)->CallBooleanMethod(env, window, positionChangedID, JNI_FALSE, JNI_FALSE, (jint)wud->xpos, (jint)wud->ypos);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at positionChanged(..)");
}
useDefWindowProc = 1;
break;
@@ -1108,6 +1119,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
// Let NEWT render the whole client area by issueing repaint for it, w/o looping through erase background
ValidateRect(wnd, NULL); // clear all!
(*env)->CallBooleanMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at windowRepaint(..)");
} else {
DBG_PRINT("*** WindowsWindow: WM_PAINT.1 (clean)\n");
// shall not happen ?
@@ -1142,6 +1154,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
DBG_PRINT("*** WindowsWindow: WM_ERASEBKGND.1 (repaint)\n");
ValidateRect(wnd, NULL); // clear all!
(*env)->CallBooleanMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at windowRepaint(..)");
res = 1; // return 1 == done, OpenGL, etc .. erases the background, hence we claim to have just done this
}
break;
@@ -1196,6 +1209,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
wud->focused = TRUE;
if( !wud->isInCreation ) {
(*env)->CallBooleanMethod(env, window, focusChangedID, JNI_FALSE, JNI_TRUE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at focusChanged(..)");
}
useDefWindowProc = 1;
break;
@@ -1212,6 +1226,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
wud->focused = FALSE;
if( !wud->isInCreation ) {
(*env)->CallBooleanMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at focusChanged(..)");
}
useDefWindowProc = 1;
} else {
@@ -1273,11 +1288,13 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
NewtWindows_trackPointerLeave(wnd);
}
(*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at requestFocus(..)");
(*env)->CallBooleanMethod(env, window, sendMouseEventID,
(jshort) EVENT_MOUSE_PRESSED,
GetModifiers( 0 ),
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 1, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1305,6 +1322,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
GetModifiers( 0 ),
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 1, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1320,11 +1338,13 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
NewtWindows_trackPointerLeave(wnd);
}
(*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at requestFocus(..)");
(*env)->CallBooleanMethod(env, window, sendMouseEventID,
(jshort) EVENT_MOUSE_PRESSED,
GetModifiers( 0 ),
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 2, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1349,6 +1369,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
GetModifiers( 0 ),
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 2, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1364,11 +1385,13 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
NewtWindows_trackPointerLeave(wnd);
}
(*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at requestFocus(..)");
(*env)->CallBooleanMethod(env, window, sendMouseEventID,
(jshort) EVENT_MOUSE_PRESSED,
GetModifiers( 0 ),
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 3, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1393,6 +1416,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
GetModifiers( 0 ),
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 3, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1418,6 +1442,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
modifiers,
(jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jshort) 0, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
}
useDefWindowProc = 1;
}
@@ -1433,6 +1458,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
0,
(jint) -1, (jint) -1, // fake
(jshort) 0, (jfloat) 0.0f);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
}
}
@@ -1463,6 +1489,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
modifiers,
(jint) 0, (jint) 0,
(jshort) 1, (jfloat) rotation);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
break;
}
@@ -1492,6 +1519,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
modifiers,
(jint) eventPt.x, (jint) eventPt.y,
(jshort) 1, (jfloat) rotationOrTilt);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at sendMouseEvent(..)");
useDefWindowProc = 1;
break;
}
@@ -1579,6 +1607,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
if( sendFocus ) {
(*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.wndProc: Exception occured at requestFocus(..)");
}
int sentCount = 0, updownCount=0, moveCount=0;
// Primary first, if available!
@@ -2462,6 +2491,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_InitWindow0
if( wud->isMaximized ) {
(*env)->CallBooleanMethod(env, wud->jinstance, maximizedChangedID, JNI_TRUE, JNI_TRUE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.InitWindow: Exception occured at maximizedChanged(..)");
}
(*env)->CallBooleanMethod(env, wud->jinstance, sizePosInsetsFocusVisibleChangedID, JNI_FALSE, JNI_FALSE,
(jint)wud->xpos, (jint)wud->ypos,
@@ -2470,6 +2500,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_InitWindow0
(jint)(wud->focused ? 1 : 0),
(jint)(wud->visible ? 1 : 0),
JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "WindowsWindow.InitWindow: Exception occured at sizePosInsetsFocusVisibleChanged(..)");
DBG_PRINT("*** WindowsWindow: InitWindow JNI callbacks done\n");
if( wud->supportsMTouch ) {
diff --git a/src/newt/native/bcm_egl.c b/src/newt/native/bcm_egl.c
index 9b960d278..88e214a1f 100644
--- a/src/newt/native/bcm_egl.c
+++ b/src/newt/native/bcm_egl.c
@@ -1,4 +1,5 @@
/*
+ * Copyright 2012-2023 JogAmp Community. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -144,6 +145,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_bcm_egl_WindowDriver_CreateWindo
return 0;
}
(*env)->CallVoidMethod(env, obj, windowCreatedID, (jint) cfgID, (jint)uiWidth, (jint)uiHeight);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "BcmEGLWindow.CreateWindow: Exception occured at windowCreated(..)");
DBG_PRINT( "[RealizeWindow.Create] ok: win %p, cfgid %d, %ux%u\n", window, cfgID, uiWidth, uiHeight);
// release and destroy already made context ..
diff --git a/src/newt/native/bcm_vc_iv.c b/src/newt/native/bcm_vc_iv.c
index 3a853fc5c..459bca124 100644
--- a/src/newt/native/bcm_vc_iv.c
+++ b/src/newt/native/bcm_vc_iv.c
@@ -1,5 +1,5 @@
/**
- * Copyright 2012 JogAmp Community. All rights reserved.
+ * Copyright 2012-2023 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -318,6 +318,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_bcm_vc_iv_ScreenDriver_initNative
if( graphics_get_display_size(0 /* LCD */, &screen_width, &screen_height) >= 0 ) {
DBG_PRINT( "BCM.Screen initNative ok %dx%d\n", screen_width, screen_height );
(*env)->CallVoidMethod(env, obj, setScreenSizeID, (jint) screen_width, (jint) screen_height);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "BcmVcIvWindow.initNative: Exception occured at setScreenSize(..)");
} else {
DBG_PRINT( "BCM.Screen initNative failed\n" );
}
@@ -398,6 +399,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_CreateWin
vc_dispmanx_update_submit_sync( dispman_update );
(*env)->CallBooleanMethod(env, obj, visibleChangedID, JNI_TRUE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "BcmVcIvWindow.CreateWindow: Exception occured at visibleChanged(..)");
DBG_PRINT( "BCM.Display Window.Create.X %p, element %p\n",
(void*)(intptr_t)dispman_display, (void*)(intptr_t)p->handle);
@@ -451,9 +453,11 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_reconfigur
bcm_moveTo( p->handle, p->layer, p->x, p->y, p->width, p->height);
if( posChanged ) {
(*env)->CallBooleanMethod(env, obj, positionChangedID, JNI_FALSE, JNI_FALSE, x, y);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "BcmVcIvWindow.reconfigure: Exception occured at positionChanged(..)");
}
if( sizeChanged ) {
(*env)->CallBooleanMethod(env, obj, sizeChangedID, JNI_FALSE, JNI_FALSE, width, height, JNI_FALSE);
+ NewtCommon_ExceptionCheck1_throwNewRuntimeException(env, "BcmVcIvWindow.reconfigure: Exception occured at sizeChanged(..)");
}
}
diff --git a/src/newt/native/drm_gbm.c b/src/newt/native/drm_gbm.c
index 722c11a49..867ded607 100644
--- a/src/newt/native/drm_gbm.c
+++ b/src/newt/native/drm_gbm.c
@@ -1,5 +1,5 @@
/**
- * Copyright 2019 JogAmp Community. All rights reserved.
+ * Copyright 2019-2023 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: