aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-05-21 06:15:17 +0200
committerSven Gothel <[email protected]>2010-05-21 06:15:17 +0200
commit6e599a2696f878786783e0fea17534e67655a5c9 (patch)
tree65774f7318ea67a170902efefbd3a952c94d7f6d /src/newt/native
parent3d8e85915ccdf48b9a97b5ed279716a2204a7a82 (diff)
Changed NEWT NativeWindow creation contract - AWT/NEWT Parenting - Misc Fixes
+++++ Changed NEWT NativeWindow creation contract Original contract: (1) A native window was created as soon as possible, ie when NEWTFactory.createWindow(..) was called - if possible. (2) A valid native window has to be created at least after setVisible(true) has been called. Problems: Not all implementation are able to create the native window that early, but at setVisible(true) only (e.g: KD and EGL). Due to window parenting especially the new AWT/NEWT parenting, the native window can only be created in case the parent native window is valid. New contract: (1) A native window is created at setVisible(true), if it's a top level window or the native parent window is valid. (2) A valid native window may not be created after setVisible(true) has been called. Subsequent setVisible(true) calls shall be made in case the creation has not been done yet. This is demonstrated in GLWindow.display() for example. The new contract implements a lazy native window creation. +++++ AWT/NEWT Parenting - HierarchyListener and ComponentListener ensure that the NEWT child window will be setVisible according to the AWT parent window. - Lazy native window creation relaxes requirements to the parent window's state. - Attachment of the child window and setVisible() may be called after NEWT child window creation. - GLWindow supports NEWT child window creation directly The test case TestParenting01AWT.java reflect this new contract and demonstrates more simplified and more flexible use cases. +++++ NEWT Fixes: - All NEWT implementation's native code method names end with 0. - GLWindow: don't issue the actual 'init'/'display' call to GLEventListeners in case the window is not visible. - NEWT setSize/setPosition: if native-window call native-window action and let the attributes being set by the feedback call, which issues more action, ie RESIZE. else set the attributes directly, no feedback call/action is necessary. +++++ X11 Fixes: - X11GLContext MakeContextCurrent: Use MakeCurrent in case write and read drawable are equal, otherwise SEGV happens on ATI with heavy multithreading involved! Even XLockDisplay and XSync didn't help here .. - X11GLXDrawableFactory shared resource: Removed the resource holder thread to simplify code, hence proper release is no more desired and it could become a cause for deadlock. - Moved XInitThreads() from NEWT X11Window -> NativeWindow X11Util, since NativeWindow is loaded first (essential for XInitThreads()) and it is the more basic lib. - Made call to XInitThreads() conditional, ie it's spared if AWT could be used - which causes SEGV .. (AWT bug). See X11Util.java +++++ JOGL Fixes: - GLProfile.isAWTAvailable() -> NativeWindowFactory.isAWTAvailable() - GLProfile.isAWTJOGLAvailable() -> GLProfile.isAWTAvailable()
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/MacWindow.m22
-rwxr-xr-xsrc/newt/native/WindowsWindow.c28
-rwxr-xr-xsrc/newt/native/X11Window.c20
3 files changed, 33 insertions, 37 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 21bc9b2ad..1956b6899 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -125,7 +125,7 @@ NS_ENDHANDLER
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_macosx_MacDisplay_initNSApplication
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_macosx_MacDisplay_initNSApplication0
(JNIEnv *env, jclass clazz)
{
static int initialized = 0;
@@ -199,7 +199,7 @@ NS_ENDHANDLER
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_macosx_MacScreen_getWidthImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_macosx_MacScreen_getWidthImpl0
(JNIEnv *env, jclass clazz, jint screen_idx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -220,7 +220,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_macosx_MacScreen_getWidthImpl
* Method: getHeightImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_macosx_MacScreen_getHeightImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_macosx_MacScreen_getHeightImpl0
(JNIEnv *env, jclass clazz, jint screen_idx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -241,7 +241,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_macosx_MacScreen_getHeightImpl
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_initIDs0
(JNIEnv *env, jclass clazz)
{
static int initialized = 0;
@@ -338,7 +338,7 @@ NS_ENDHANDLER
* Method: makeKeyAndOrderFront
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_makeKeyAndOrderFront
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_makeKeyAndOrderFront0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -352,7 +352,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_makeKeyAndOrde
* Method: makeKey
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_makeKey
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_makeKey0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -366,7 +366,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_makeKey
* Method: orderOut
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_orderOut
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_orderOut0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -421,7 +421,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_setTitle0
* Method: contentView
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_contentView
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_contentView0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -436,7 +436,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_contentView
* Method: changeContentView
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_changeContentView
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_changeContentView0
(JNIEnv *env, jobject jthis, jlong parent, jlong window, jlong jview)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -456,7 +456,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_changeContent
* Method: setContentSize
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_setContentSize
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_setContentSize0
(JNIEnv *env, jobject unused, jlong window, jint w, jint h)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -471,7 +471,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_setContentSize
* Method: setFrameTopLeftPoint
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_setFrameTopLeftPoint
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_macosx_MacWindow_setFrameTopLeftPoint0
(JNIEnv *env, jobject unused, jlong parent, jlong window, jint x, jint y)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 488588f52..fabcab1c7 100755
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -922,7 +922,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
* Method: DispatchMessages
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_DispatchMessages0
(JNIEnv *env, jclass clazz)
{
int i = 0;
@@ -950,7 +950,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_Dispatch
* Method: LoadLibraryW
* Signature: (Ljava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_LoadLibraryW
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_LoadLibraryW0
(JNIEnv *env, jclass clazz, jstring dllName)
{
jchar* _dllName = NewtCommon_GetNullTerminatedStringChars(env, dllName);
@@ -964,7 +964,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_LoadLib
* Method: RegisterWindowClass
* Signature: (Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_RegisterWindowClass
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_RegisterWindowClass0
(JNIEnv *env, jclass clazz, jstring wndClassName, jlong hInstance)
{
ATOM res;
@@ -1004,7 +1004,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_Register
* Method: CleanupWindowResources
* Signature: (java/lang/String;J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_UnregisterWindowClass
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_UnregisterWindowClass0
(JNIEnv *env, jclass clazz, jint wndClassAtom, jlong hInstance)
{
UnregisterClass(MAKEINTATOM(wndClassAtom), (HINSTANCE) (intptr_t) hInstance);
@@ -1015,7 +1015,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_Unregist
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getWidthImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getWidthImpl0
(JNIEnv *env, jobject obj, jint scrn_idx)
{
return (jint)GetSystemMetrics(SM_CXSCREEN);
@@ -1026,7 +1026,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getWidthI
* Method: getHeightImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getHeightImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getHeightImpl0
(JNIEnv *env, jobject obj, jint scrn_idx)
{
return (jint)GetSystemMetrics(SM_CYSCREEN);
@@ -1037,7 +1037,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getHeight
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initIDs0
(JNIEnv *env, jclass clazz)
{
sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V");
@@ -1070,7 +1070,7 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initI
* Method: CreateWindow
* Signature: (JILjava/lang/String;JJZIIII)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_CreateWindow0
(JNIEnv *env, jobject obj, jlong parent, jint wndClassAtom, jstring jWndName, jlong hInstance, jlong visualID,
jboolean bIsUndecorated,
jint jx, jint jy, jint defaultWidth, jint defaultHeight)
@@ -1151,7 +1151,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_CreateWi
* Method: DestroyWindow
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_DestroyWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_DestroyWindow0
(JNIEnv *env, jobject obj, jlong window)
{
DestroyWindow((HWND) (intptr_t) window);
@@ -1162,7 +1162,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_DestroyWi
* Method: GetDC
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_GetDC
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_GetDC0
(JNIEnv *env, jobject obj, jlong window)
{
return (jlong) (intptr_t) GetDC((HWND) (intptr_t) window);
@@ -1173,7 +1173,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_GetDC
* Method: ReleaseDC
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_ReleaseDC
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_ReleaseDC0
(JNIEnv *env, jobject obj, jlong window, jlong dc)
{
ReleaseDC((HWND) (intptr_t) window, (HDC) (intptr_t) dc);
@@ -1184,7 +1184,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_ReleaseDC
* Method: MonitorFromWindow
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_MonitorFromWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_MonitorFromWindow0
(JNIEnv *env, jobject obj, jlong window)
{
#if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410 || WINVER >= 0x0500) && !defined(_WIN32_WCE)
@@ -1337,7 +1337,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_setFullsc
* Method: setTitle
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_setTitle
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_setTitle0
(JNIEnv *env, jclass clazz, jlong window, jstring title)
{
HWND hwnd = (HWND) (intptr_t) window;
@@ -1355,7 +1355,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_setTitle
* Method: requestFocus
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_requestFocus
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_requestFocus0
(JNIEnv *env, jclass clazz, jlong window)
{
NewtWindows_requestFocus ( (HWND) (intptr_t) window ) ;
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index eb52e45bc..abaa3594f 100755
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -236,17 +236,13 @@ static void displayDispatchErrorHandlerEnable(int onoff, JNIEnv * env) {
/*
* Class: com_jogamp_newt_impl_x11_X11Display
* Method: initIDs
- * Signature: ()Z
+ * Signature: (Z)Z
*/
-JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Display_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Display_initIDs0
(JNIEnv *env, jclass clazz)
{
jclass c;
- if( 0 == XInitThreads() ) {
- fprintf(stderr, "Warning: NEWT X11Window: XInitThreads() failed\n");
- }
-
displayCompletedID = (*env)->GetMethodID(env, clazz, "displayCompleted", "(JJ)V");
if (displayCompletedID == NULL) {
return JNI_FALSE;
@@ -284,7 +280,7 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Display_initIDs
* Method: CompleteDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_CompleteDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_CompleteDisplay0
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
@@ -431,7 +427,7 @@ static void NewtWindows_setDecorations (Display *dpy, Window w, Bool val) {
* Method: DispatchMessages
* Signature: (JIJJ)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_DispatchMessages0
(JNIEnv *env, jobject obj, jlong display, jlong javaObjectAtom, jlong wmDeleteAtom)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -597,7 +593,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_DispatchMessages
* Method: GetScreen
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_GetScreen
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_GetScreen0
(JNIEnv *env, jobject obj, jlong display, jint screen_index)
{
Display * dpy = (Display *)(intptr_t)display;
@@ -643,7 +639,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getHeight0
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Window_initIDs0
(JNIEnv *env, jclass clazz)
{
windowChangedID = (*env)->GetMethodID(env, clazz, "windowChanged", "(IIII)V");
@@ -671,7 +667,7 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Window_initIDs
* Method: CreateWindow
* Signature: (JJIJIIII)J
*/
-JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CreateWindow0
(JNIEnv *env, jobject obj, jlong parent, jlong display, jint screen_index,
jlong visualID,
jlong javaObjectAtom, jlong windowDeleteAtom,
@@ -800,7 +796,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CreateWindow
* Method: CloseWindow
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CloseWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CloseWindow0
(JNIEnv *env, jobject obj, jlong display, jlong window, jlong javaObjectAtom)
{
Display * dpy = (Display *) (intptr_t) display;