aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/native')
-rwxr-xr-xsrc/newt/native/BroadcomEGL.c16
-rw-r--r--src/newt/native/IntelGDL.c24
-rwxr-xr-xsrc/newt/native/KDWindow.c20
-rw-r--r--src/newt/native/MacWindow.m62
-rw-r--r--src/newt/native/NewtMacWindow.h2
-rwxr-xr-xsrc/newt/native/NewtMacWindow.m2
-rwxr-xr-xsrc/newt/native/WindowsWindow.c74
-rwxr-xr-xsrc/newt/native/X11Window.c194
8 files changed, 220 insertions, 174 deletions
diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c
index 55688f9d1..9aac90abb 100755
--- a/src/newt/native/BroadcomEGL.c
+++ b/src/newt/native/BroadcomEGL.c
@@ -41,7 +41,7 @@
#include <stdio.h>
#include <string.h>
-#include "com_sun_javafx_newt_opengl_broadcom_egl_Window.h"
+#include "com_jogamp_newt_opengl_broadcom_egl_Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -72,7 +72,7 @@ static jmethodID windowCreatedID = NULL;
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Display_DispatchMessages
(JNIEnv *env, jobject obj)
{
// FIXME: n/a
@@ -80,7 +80,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_Disp
(void) obj;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_CreateDisplay
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Display_CreateDisplay
(JNIEnv *env, jobject obj, jint width, jint height)
{
(void) env;
@@ -94,7 +94,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_Cre
return (jlong) (intptr_t) dpy;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_DestroyDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Display_DestroyDisplay
(JNIEnv *env, jobject obj, jlong display)
{
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
@@ -111,7 +111,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_Dest
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_initIDs
(JNIEnv *env, jclass clazz)
{
windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(III)V");
@@ -123,7 +123,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_i
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_CreateWindow
(JNIEnv *env, jobject obj, jlong display, jboolean chromaKey, jint width, jint height)
{
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
@@ -167,7 +167,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_Crea
return (jlong) (intptr_t) window;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_CloseWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_CloseWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
@@ -180,7 +180,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_Close
DBG_PRINT( "[CloseWindow] X\n");
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_SwapWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_SwapWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
diff --git a/src/newt/native/IntelGDL.c b/src/newt/native/IntelGDL.c
index 1bc43cd0e..7857b594f 100644
--- a/src/newt/native/IntelGDL.c
+++ b/src/newt/native/IntelGDL.c
@@ -37,9 +37,9 @@
#include <stdio.h>
#include <string.h>
-#include "com_sun_javafx_newt_intel_gdl_Display.h"
-#include "com_sun_javafx_newt_intel_gdl_Screen.h"
-#include "com_sun_javafx_newt_intel_gdl_Window.h"
+#include "com_jogamp_newt_intel_gdl_Display.h"
+#include "com_jogamp_newt_intel_gdl_Screen.h"
+#include "com_jogamp_newt_intel_gdl_Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -123,7 +123,7 @@ static void JNI_ThrowNew(JNIEnv *env, const char *throwable, const char* message
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Display_DispatchMessages
(JNIEnv *env, jobject obj, jlong displayHandle, jobject focusedWindow)
{
// FIXME: n/a
@@ -138,7 +138,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DispatchMessag
} */
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_CreateDisplay
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_intel_gdl_Display_CreateDisplay
(JNIEnv *env, jobject obj)
{
gdl_ret_t retval;
@@ -171,7 +171,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_CreateDisplay
return (jlong) (intptr_t) p_driver_info;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DestroyDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Display_DestroyDisplay
(JNIEnv *env, jobject obj, jlong displayHandle)
{
gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
@@ -190,7 +190,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DestroyDisplay
* Screen
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_intel_gdl_Screen_initIDs
(JNIEnv *env, jclass clazz)
{
screenCreatedID = (*env)->GetMethodID(env, clazz, "screenCreated", "(II)V");
@@ -202,7 +202,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_initIDs
return JNI_TRUE;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_GetScreenInfo
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Screen_GetScreenInfo
(JNIEnv *env, jobject obj, jlong displayHandle, jint idx)
{
gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
@@ -234,7 +234,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_GetScreenInfo
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_intel_gdl_Window_initIDs
(JNIEnv *env, jclass clazz)
{
updateBoundsID = (*env)->GetMethodID(env, clazz, "updateBounds", "(IIII)V");
@@ -246,7 +246,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_initIDs
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CreateSurface
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_intel_gdl_Window_CreateSurface
(JNIEnv *env, jobject obj, jlong displayHandle, jint scr_width, jint scr_height, jint x, jint y, jint width, jint height) {
gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
@@ -339,7 +339,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CreateSurface
return (jlong) (intptr_t) plane;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CloseSurface
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Window_CloseSurface
(JNIEnv *env, jobject obj, jlong display, jlong surface)
{
gdl_plane_id_t plane = (gdl_plane_id_t) (intptr_t) surface ;
@@ -348,7 +348,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CloseSurface
DBG_PRINT("[CloseSurface] plane %d\n", plane);
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_SetBounds0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Window_SetBounds0
(JNIEnv *env, jobject obj, jlong surface, jint scr_width, jint scr_height, jint x, jint y, jint width, jint height) {
gdl_plane_id_t plane = (gdl_plane_id_t) (intptr_t) surface ;
diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c
index 6c7aa7731..15bef7582 100755
--- a/src/newt/native/KDWindow.c
+++ b/src/newt/native/KDWindow.c
@@ -64,7 +64,7 @@
#include <KD/kd.h>
#include <KD/NV_extwindowprops.h>
-#include "com_sun_javafx_newt_opengl_kd_KDWindow.h"
+#include "com_jogamp_newt_opengl_kd_KDWindow.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -103,7 +103,7 @@ static jmethodID sendKeyEventID = NULL;
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDDisplay_DispatchMessages
(JNIEnv *env, jobject obj)
{
const KDEvent * evt;
@@ -200,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDDisplay_DispatchMess
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_initIDs
(JNIEnv *env, jclass clazz)
{
#ifdef VERBOSE_ON
@@ -228,7 +228,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_initIDs
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_CreateWindow
(JNIEnv *env, jobject obj, jlong display, jintArray jAttrs)
{
jint * attrs = NULL;
@@ -270,7 +270,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CreateWindow
return (jlong) (intptr_t) window;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_RealizeWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_RealizeWindow
(JNIEnv *env, jobject obj, jlong window)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -285,7 +285,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_RealizeWindo
return (jlong) (intptr_t) nativeWindow;
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CloseWindow
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_CloseWindow
(JNIEnv *env, jobject obj, jlong window, jlong juserData)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -299,11 +299,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CloseWindow
}
/*
- * Class: com_sun_javafx_newt_opengl_kd_KDWindow
+ * Class: com_jogamp_newt_opengl_kd_KDWindow
* Method: setVisible0
* Signature: (JJZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setVisible0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_setVisible0
(JNIEnv *env, jobject obj, jlong window, jboolean visible)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -312,7 +312,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setVisible0
DBG_PRINT( "[setVisible] v=%d\n", visible);
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setFullScreen0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_setFullScreen0
(JNIEnv *env, jobject obj, jlong window, jboolean fullscreen)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -323,7 +323,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setFullScreen
(void)res;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setSize0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_setSize0
(JNIEnv *env, jobject obj, jlong window, jint width, jint height)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 1749805c8..f0ebfc0a0 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -33,7 +33,7 @@
#import <inttypes.h>
-#import "com_sun_javafx_newt_macosx_MacWindow.h"
+#import "com_jogamp_newt_macosx_MacWindow.h"
#import "NewtMacWindow.h"
#import "EventListener.h"
@@ -121,11 +121,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacDisplay
+ * Class: com_jogamp_newt_macosx_MacDisplay
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacDisplay_initNSApplication
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_macosx_MacDisplay_initNSApplication
(JNIEnv *env, jclass clazz)
{
static int initialized = 0;
@@ -155,11 +155,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacDisplay_initNSAppl
}
/*
- * Class: com_sun_javafx_newt_macosx_MacDisplay
+ * Class: com_jogamp_newt_macosx_MacDisplay
* Method: dispatchMessages0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacDisplay_dispatchMessages0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacDisplay_dispatchMessages0
(JNIEnv *env, jobject unused, jlong window, jint eventMask)
{
NSEvent* event = NULL;
@@ -195,11 +195,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacScreen
+ * Class: com_jogamp_newt_macosx_MacScreen
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getWidthImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_macosx_MacScreen_getWidthImpl
(JNIEnv *env, jclass clazz, jint screen_idx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -216,11 +216,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getWidthImpl
}
/*
- * Class: com_sun_javafx_newt_macosx_MacScreen
+ * Class: com_jogamp_newt_macosx_MacScreen
* Method: getHeightImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getHeightImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_macosx_MacScreen_getHeightImpl
(JNIEnv *env, jclass clazz, jint screen_idx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -237,11 +237,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getHeightImpl
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_macosx_MacWindow_initIDs
(JNIEnv *env, jclass clazz)
{
static int initialized = 0;
@@ -258,11 +258,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_initIDs
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: createWindow0
* Signature: (JIIIIZIIIJ)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_createWindow0
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_macosx_MacWindow_createWindow0
(JNIEnv *env, jobject jthis, jlong parent, jint x, jint y, jint w, jint h, jboolean fullscreen, jint styleMask,
jint bufferingType, jint screen_idx, jlong jview)
{
@@ -334,11 +334,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: makeKeyAndOrderFront
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKeyAndOrderFront
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_makeKeyAndOrderFront
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -348,11 +348,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKeyAndOrder
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: makeKey
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKey
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_makeKey
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -362,11 +362,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKey
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: orderOut
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_orderOut
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_orderOut
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -376,11 +376,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_orderOut
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: close0
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_close0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_close0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -401,11 +401,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: setTitle0
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setTitle0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_setTitle0
(JNIEnv *env, jobject unused, jlong window, jstring title)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -417,11 +417,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setTitle0
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: contentView
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_contentView
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_macosx_MacWindow_contentView
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -432,11 +432,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_contentView
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: changeContentView
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_changeContentView
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_macosx_MacWindow_changeContentView
(JNIEnv *env, jobject jthis, jlong parent, jlong window, jlong jview)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -452,11 +452,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_changeContentV
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: setContentSize
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setContentSize
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_setContentSize
(JNIEnv *env, jobject unused, jlong window, jint w, jint h)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -467,11 +467,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setContentSize
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: setFrameTopLeftPoint
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setFrameTopLeftPoint
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_setFrameTopLeftPoint
(JNIEnv *env, jobject unused, jlong parent, jlong window, jint x, jint y)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h
index e19be2ed8..560cfe408 100644
--- a/src/newt/native/NewtMacWindow.h
+++ b/src/newt/native/NewtMacWindow.h
@@ -55,7 +55,7 @@
@end
-@interface NewtMacWindow : NSWindow
+@interface NewtMacWindow : NSWindow <NSWindowDelegate>
{
}
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index 146c04de1..3d8d32a40 100755
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -441,7 +441,7 @@ static jint mods2JavaMods(NSUInteger mods)
}
(*env)->CallVoidMethod(env, javaWindowObject, windowDestroyNotifyID);
- // Will be called by Window.java (*env)->CallVoidMethod(env, javaWindowObject, windowDestroyedID);
+ (*env)->CallVoidMethod(env, javaWindowObject, windowDestroyedID); // No OSX hook for DidClose, so do it here
// EOL ..
(*env)->DeleteGlobalRef(env, javaWindowObject);
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 5445ca372..67da99b1f 100755
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -89,7 +89,7 @@
#define MONITOR_DEFAULTTONEAREST 2
#endif
-#include "com_sun_javafx_newt_windows_WindowsWindow.h"
+#include "com_jogamp_newt_windows_WindowsWindow.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -902,11 +902,11 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: DispatchMessages
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_DispatchMessages
(JNIEnv *env, jclass clazz)
{
int i = 0;
@@ -925,11 +925,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_DispatchM
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: LoadLibraryW
* Signature: (Ljava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_LoadLibraryW
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_LoadLibraryW
(JNIEnv *env, jclass clazz, jstring dllName)
{
jchar* _dllName = GetNullTerminatedStringChars(env, dllName);
@@ -939,11 +939,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_LoadLibr
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: RegisterWindowClass
* Signature: (Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_RegisterWindowClass
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_RegisterWindowClass
(JNIEnv *env, jclass clazz, jstring wndClassName, jlong hInstance)
{
ATOM res;
@@ -979,44 +979,44 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_RegisterW
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: CleanupWindowResources
* Signature: (java/lang/String;J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_UnregisterWindowClass
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_UnregisterWindowClass
(JNIEnv *env, jclass clazz, jint wndClassAtom, jlong hInstance)
{
UnregisterClass(MAKEINTATOM(wndClassAtom), (HINSTANCE) (intptr_t) hInstance);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsScreen
+ * Class: com_jogamp_newt_windows_WindowsScreen
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getWidthImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_windows_WindowsScreen_getWidthImpl
(JNIEnv *env, jobject obj, jint scrn_idx)
{
return (jint)GetSystemMetrics(SM_CXSCREEN);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsScreen
+ * Class: com_jogamp_newt_windows_WindowsScreen
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getHeightImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_windows_WindowsScreen_getHeightImpl
(JNIEnv *env, jobject obj, jint scrn_idx)
{
return (jint)GetSystemMetrics(SM_CYSCREEN);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_windows_WindowsWindow_initIDs
(JNIEnv *env, jclass clazz)
{
sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V");
@@ -1045,11 +1045,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initID
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: CreateWindow
* Signature: (JILjava/lang/String;JJZIIII)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsWindow_CreateWindow
(JNIEnv *env, jobject obj, jlong parent, jint wndClassAtom, jstring jWndName, jlong hInstance, jlong visualID,
jboolean bIsUndecorated,
jint jx, jint jy, jint defaultWidth, jint defaultHeight)
@@ -1113,44 +1113,44 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_CreateWin
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: DestroyWindow
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_DestroyWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_DestroyWindow
(JNIEnv *env, jobject obj, jlong window)
{
DestroyWindow((HWND) (intptr_t) window);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: GetDC
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_GetDC
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsWindow_GetDC
(JNIEnv *env, jobject obj, jlong window)
{
return (jlong) (intptr_t) GetDC((HWND) (intptr_t) window);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: ReleaseDC
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_ReleaseDC
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_ReleaseDC
(JNIEnv *env, jobject obj, jlong window, jlong dc)
{
ReleaseDC((HWND) (intptr_t) window, (HDC) (intptr_t) dc);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: MonitorFromWindow
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_MonitorFromWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsWindow_MonitorFromWindow
(JNIEnv *env, jobject obj, jlong window)
{
#if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410 || WINVER >= 0x0500) && !defined(_WIN32_WCE)
@@ -1161,11 +1161,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_MonitorFr
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setVisible0
* Signature: (JZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setVisible0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setVisible0
(JNIEnv *_env, jclass clazz, jlong window, jboolean visible)
{
HWND hWnd = (HWND) (intptr_t) window;
@@ -1178,11 +1178,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setVisible
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setSize0
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setSize0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setSize0
(JNIEnv *env, jobject obj, jlong parent, jlong window, jint x, jint y, jint width, jint height)
{
HWND hwndP = (HWND) (intptr_t) parent;
@@ -1215,11 +1215,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setSize0
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setPosition
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setPosition
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setPosition
(JNIEnv *env, jobject obj, jlong parent, jlong window, jint x, jint y)
{
UINT flags = SWP_NOACTIVATE | SWP_NOSIZE;
@@ -1236,11 +1236,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setPositio
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setFullscreen
* Signature: (JIIIIZZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setFullscreen0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setFullscreen0
(JNIEnv *env, jobject obj, jlong parent, jlong window, jint x, jint y, jint width, jint height, jboolean bIsUndecorated, jboolean on)
{
UINT flags;
@@ -1272,11 +1272,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setFullscr
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setTitle
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setTitle
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setTitle
(JNIEnv *env, jclass clazz, jlong window, jstring title)
{
HWND hwnd = (HWND) (intptr_t) window;
@@ -1290,11 +1290,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setTitle
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: requestFocus
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_requestFocus
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_requestFocus
(JNIEnv *env, jclass clazz, jlong window)
{
HWND hwnd = (HWND) (intptr_t) window;
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index b6b2bbe26..27ca8e6a0 100755
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -46,7 +46,7 @@
#include <X11/Xutil.h>
#include <X11/keysym.h>
-#include "com_sun_javafx_newt_x11_X11Window.h"
+#include "com_jogamp_newt_x11_X11Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -149,12 +149,25 @@ static jint X11KeySym2NewtVKey(KeySym keySym) {
return keySym;
}
-static const char * const ClazzNameRuntimeException =
- "java/lang/RuntimeException";
+static void _FatalError(JNIEnv *env, const char* msg, ...)
+{
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, ap);
+ va_end(ap);
+
+ fprintf(stderr, buffer);
+ fprintf(stderr, "\n");
+ (*env)->FatalError(env, buffer);
+}
+
+static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException";
static jclass runtimeExceptionClz=NULL;
static const char * const ClazzNameNewtWindow =
- "com/sun/javafx/newt/Window";
+ "com/jogamp/newt/Window";
static jclass newtWindowClz=NULL;
static jmethodID windowChangedID = NULL;
@@ -186,18 +199,51 @@ static void _throwNewRuntimeException(Display * unlockDisplay, JNIEnv *env, cons
* Display
*/
+
+static JNIEnv * x11ErrorHandlerJNIEnv = NULL;
+static XErrorHandler origErrorHandler = NULL ;
+
+static int displayDispatchErrorHandler(Display *dpy, XErrorEvent *e)
+{
+ fprintf(stderr, "Warning: NEWT X11 Error: DisplayDispatch %p, Code 0x%X\n", dpy, e->error_code);
+
+ if (e->error_code == BadAtom)
+ {
+ fprintf(stderr, " BadAtom (%p): Atom probably already removed\n", e->resourceid);
+ } else if (e->error_code == BadWindow)
+ {
+ fprintf(stderr, " BadWindow (%p): Window probably already removed\n", e->resourceid);
+ } else {
+ _throwNewRuntimeException(NULL, x11ErrorHandlerJNIEnv, "NEWT X11 Error: Display %p, Code 0x%X", dpy, e->error_code);
+ }
+
+ return 0;
+}
+
+static void displayDispatchErrorHandlerEnable(int onoff, JNIEnv * env) {
+ if(onoff) {
+ if(NULL==origErrorHandler) {
+ x11ErrorHandlerJNIEnv = env;
+ origErrorHandler = XSetErrorHandler(displayDispatchErrorHandler);
+ }
+ } else {
+ XSetErrorHandler(origErrorHandler);
+ origErrorHandler = NULL;
+ }
+}
+
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_x11_X11Display_initIDs
(JNIEnv *env, jclass clazz)
{
jclass c;
if( 0 == XInitThreads() ) {
- fprintf(stderr, "Warning: XInitThreads() failed\n");
+ fprintf(stderr, "Warning: NEWT X11Window: XInitThreads() failed\n");
}
displayCompletedID = (*env)->GetMethodID(env, clazz, "displayCompleted", "(JJ)V");
@@ -208,28 +254,24 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs
if(NULL==newtWindowClz) {
c = (*env)->FindClass(env, ClazzNameNewtWindow);
if(NULL==c) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't find %s\n", ClazzNameNewtWindow);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't find %s", ClazzNameNewtWindow);
}
newtWindowClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==newtWindowClz) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't use %s\n", ClazzNameNewtWindow);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't use %s", ClazzNameNewtWindow);
}
}
if(NULL==runtimeExceptionClz) {
c = (*env)->FindClass(env, ClazzNameRuntimeException);
if(NULL==c) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't find %s\n", ClazzNameRuntimeException);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't find %s", ClazzNameRuntimeException);
}
runtimeExceptionClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==runtimeExceptionClz) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't use %s\n", ClazzNameRuntimeException);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't use %s", ClazzNameRuntimeException);
}
}
@@ -237,43 +279,45 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: LockDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_LockDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_LockDisplay
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "given display connection is NULL\n");
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: LockDisplay 0x%X\n", dpy);
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: UnlockDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_UnlockDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_UnlockDisplay
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "given display connection is NULL\n");
+ _FatalError(env, "invalid display connection..");
}
XUnlockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: UnlockDisplay 0x%X\n", dpy);
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: CompleteDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_CompleteDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_CompleteDisplay
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
@@ -281,19 +325,19 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_CompleteDisplay
jlong windowDeleteAtom;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "given display connection is NULL\n");
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
javaObjectAtom = (jlong) XInternAtom(dpy, "JOGL_JAVA_OBJECT", False);
if(None==javaObjectAtom) {
- _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!");
return;
}
windowDeleteAtom = (jlong) XInternAtom(dpy, "WM_DELETE_WINDOW", False);
if(None==windowDeleteAtom) {
- _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!");
return;
}
@@ -323,14 +367,13 @@ static uintptr_t getPtrOut32Long(unsigned long * src) {
}
static void setJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, jlong javaObjectAtom, jobject jwindow) {
- unsigned long jogl_java_object_data[2];
+ unsigned long jogl_java_object_data[2]; // X11 is based on 'unsigned long'
int nitems_32 = putPtrIn32Long( jogl_java_object_data, (uintptr_t) jwindow);
{
jobject test = (jobject) getPtrOut32Long(jogl_java_object_data);
if( ! (jwindow==test) ) {
- _throwNewRuntimeException(dpy, env, "Internal Error .. Encoded Window ref not the same %p != %p !\n", jwindow, test);
- return;
+ _FatalError(env, "Internal Error .. Encoded Window ref not the same %p != %p !", jwindow, test);
}
}
@@ -356,14 +399,13 @@ static jobject getJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, j
&nitems_return, &bytes_after_return, &jogl_java_object_data_pp);
if ( Success != res ) {
- _throwNewRuntimeException(dpy, env, "could not fetch Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, bail out!\n",
- res, nitems_return, bytes_after_return);
+ fprintf(stderr, "Warning: NEWT X11Window: Could not fetch Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, result 0!\n", res, nitems_return, bytes_after_return);
return NULL;
}
if(actual_type_return!=(Atom)javaObjectAtom || nitems_return<nitems_32 || NULL==jogl_java_object_data_pp) {
XFree(jogl_java_object_data_pp);
- _throwNewRuntimeException(dpy, env, "could not fetch Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, actual_type_return %ld, JOGL_JAVA_OBJECT %ld, bail out!\n",
+ fprintf(stderr, "Warning: NEWT X11Window: Fetched invalid Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, actual_type_return %ld, JOGL_JAVA_OBJECT %ld, result 0!\n",
res, nitems_return, bytes_after_return, (long)actual_type_return, javaObjectAtom);
return NULL;
}
@@ -374,18 +416,18 @@ static jobject getJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, j
#ifdef VERBOSE_ON
if(JNI_FALSE == (*env)->IsInstanceOf(env, jwindow, newtWindowClz)) {
- _throwNewRuntimeException(NULL, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !\n", jwindow);
+ _throwNewRuntimeException(dpy, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !", jwindow);
}
#endif
return jwindow;
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: DispatchMessages
* Signature: (JIJJ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_DispatchMessages
(JNIEnv *env, jobject obj, jlong display, jlong javaObjectAtom, jlong wmDeleteAtom)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -405,10 +447,12 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
XLockDisplay(dpy) ;
- // num_events = XPending(dpy); // XEventsQueued(dpy, QueuedAfterFlush); // I/O Flush ..
- // num_events = XEventsQueued(dpy, QueuedAlready); // Better, no I/O ..
- if ( 0 >= XEventsQueued(dpy, QueuedAlready) ) {
+ // num_events = XPending(dpy); // I/O Flush ..
+ // num_events = XEventsQueued(dpy, QueuedAfterFlush); // I/O Flush only of no already queued events are available
+ // num_events = XEventsQueued(dpy, QueuedAlready); // no I/O Flush at all, doesn't work on some cards (eg ATI)
+ if ( 0 >= XEventsQueued(dpy, QueuedAfterFlush) ) {
XUnlockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: DispatchMessages 0x%X - Leave 1\n", dpy);
return;
}
@@ -416,19 +460,26 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
num_events--;
if( 0==evt.xany.window ) {
- _throwNewRuntimeException(dpy, env, "event window NULL, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "event window NULL, bail out!");
return ;
}
if(dpy!=evt.xany.display) {
- _throwNewRuntimeException(dpy, env, "wrong display, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "wrong display, bail out!");
return ;
}
+
+ displayDispatchErrorHandlerEnable(1, env);
+
jwindow = getJavaWindowProperty(env, dpy, evt.xany.window, javaObjectAtom);
+ displayDispatchErrorHandlerEnable(0, env);
+
if(NULL==jwindow) {
- // just leave .. _throwNewRuntimeException(env, "could not fetch Java Window object, bail out!\n");
+ fprintf(stderr, "Warning: NEWT X11 DisplayDispatch %p, Couldn't handle event %d for invalid X11 window %p\n",
+ dpy, evt.type, evt.xany.window);
XUnlockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: DispatchMessages 0x%X - Leave 2\n", dpy);
return;
}
@@ -446,6 +497,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
}
XUnlockDisplay(dpy) ;
+ // DBG_PRINT3( "X11: DispatchMessages 0x%X - Window %p, Event %d\n", dpy, jwindow, evt.type);
switch(evt.type) {
case ButtonPress:
@@ -532,19 +584,18 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
*/
/*
- * Class: com_sun_javafx_newt_x11_X11Screen
+ * Class: com_jogamp_newt_x11_X11Screen
* Method: GetScreen
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Screen_GetScreen
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Screen_GetScreen
(JNIEnv *env, jobject obj, jlong display, jint screen_index)
{
Display * dpy = (Display *)(intptr_t)display;
Screen * scrn= NULL;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return 0;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy);
@@ -559,14 +610,14 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Screen_GetScreen
return (jlong) (intptr_t) scrn;
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getWidth0
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_x11_X11Screen_getWidth0
(JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
{
Display * dpy = (Display *) (intptr_t) display;
return (jint) XDisplayWidth( dpy, scrn_idx);
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getHeight0
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_x11_X11Screen_getHeight0
(JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -579,11 +630,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getHeight0
*/
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_x11_X11Window_initIDs
(JNIEnv *env, jclass clazz)
{
windowChangedID = (*env)->GetMethodID(env, clazz, "windowChanged", "(IIII)V");
@@ -605,11 +656,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Window_initIDs
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: CreateWindow
* Signature: (JJIJIIII)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Window_CreateWindow
(JNIEnv *env, jobject obj, jlong parent, jlong display, jint screen_index,
jlong visualID,
jlong javaObjectAtom, jlong windowDeleteAtom,
@@ -635,12 +686,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
DBG_PRINT4( "X11: CreateWindow %x/%d %dx%d\n", x, y, width, height);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return 0;
+ _FatalError(env, "invalid display connection..");
}
if(visualID<0) {
- _throwNewRuntimeException(NULL, env, "invalid VisualID ..\n");
+ _throwNewRuntimeException(NULL, env, "invalid VisualID ..");
return 0;
}
@@ -648,7 +698,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
XSync(dpy, False);
- scrn = ScreenOfDisplay(dpy, screen_index);
+ scrn = ScreenOfDisplay(dpy, scrn_idx);
// try given VisualID on screen
memset(&visualTemplate, 0, sizeof(XVisualInfo));
@@ -667,7 +717,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
if (visual==NULL)
{
- _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!");
return 0;
}
@@ -734,11 +784,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: CloseWindow
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_CloseWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_CloseWindow
(JNIEnv *env, jobject obj, jlong display, jlong window, jlong javaObjectAtom)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -746,18 +796,17 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_CloseWindow
jobject jwindow;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
jwindow = getJavaWindowProperty(env, dpy, w, javaObjectAtom);
if(NULL==jwindow) {
- _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!");
return;
}
if ( JNI_FALSE == (*env)->IsSameObject(env, jwindow, obj) ) {
- _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!\n");
+ _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!");
return;
}
(*env)->DeleteGlobalRef(env, jwindow);
@@ -779,11 +828,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_CloseWindow
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: setVisible0
* Signature: (JJZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_setVisible0
(JNIEnv *env, jobject obj, jlong display, jlong window, jboolean visible)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -791,8 +840,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
DBG_PRINT1( "X11: setVisible0 vis %d\n", visible);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
@@ -823,11 +871,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
#endif
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: setSize0
* Signature: (JIJIIIIIZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_setSize0
(JNIEnv *env, jobject obj, jlong jparent, jlong display, jint screen_index, jlong window, jint x, jint y, jint width, jint height, jint decorationToggle, jboolean setVisible)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -840,8 +888,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
DBG_PRINT6( "X11: setSize0 %d/%d %dx%d, dec %d, vis %d\n", x, y, width, height, decorationToggle, setVisible);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
@@ -887,11 +934,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: setPosition0
* Signature: (JJII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setPosition0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_setPosition0
(JNIEnv *env, jobject obj, jlong display, jlong window, jint x, jint y)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -900,8 +947,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setPosition0
DBG_PRINT2( "X11: setPos0 . XConfigureWindow %d/%d\n", x, y);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;