diff options
author | Sven Gothel <[email protected]> | 2009-06-17 13:26:29 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-06-17 13:26:29 +0000 |
commit | a92906bcb4ce4746f291d40a736949ec8476de61 (patch) | |
tree | 49708922895aa07bdc72b0513bb5e90f63ecedb2 /src/newt/native/WindowsWindow.c | |
parent | 802288f8964affbda3460eea52df3d241ae3036a (diff) |
- Add: GLProfile.get(name) return default if name=="GL" as well (or if null)
- Add: NEWT pumpMessages/dispatchMessages
- Handled by the Display implementation for all windows
- Windows .. OK
- MacOSX .. OK
- X11 .. OK
- Added Atom Property handling to attach java window object to window
- Removed the eventMask for dispatching messages,
since dispatching is for all windows now.
(Wasn't impl. for all platforms anyways)
- All init static code will funnel in the Display.initSingletion(),
to ensure a proper init order for all platforms.
- Display creation is unique for (name,thread).
Handling a TLS mapping of display-names to Displays.
- GLWindow: autoSwapBufferMode and eventHandlerMode are static members
- Tested with experimental tagged
GLWindow.setRunPumpMessages()/runCurrentThreadPumpMessage(),
1 thread - 4 windows, etc ..
java demos.es2.RedSquare -1thread -onepump -GL2 -GL2 -GL2 -GL2
No benefit ..
However .. the implementation is more correct now,
due to the display/current-thread message pumping.
- Fix: Window.sendMouseEvent() bounds check
- Fix: MacWindow has proper nsView locking now,
local to the window instance. locked in lockSurface
besides general window manipulation.
- Fix: JAWT utilized JAWTUtil.init() to
init libraries - NativeLibLoaderBase.loadNativeWindow("awt")
call was missing. (Visible on MacOSX + AWT)
- Fix: GLXUtil proper locking
- Fix: X11Util proper locking
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1976 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rwxr-xr-x | src/newt/native/WindowsWindow.c | 210 |
1 files changed, 74 insertions, 136 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 908eb2ac0..67fbd3f07 100755 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -778,61 +778,34 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, } /* - * Class: com_sun_javafx_newt_windows_WindowsScreen - * Method: getScreenWidth - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getScreenWidth - (JNIEnv *env, jobject obj, jint scrn_idx) -{ - return (jint)GetSystemMetrics(SM_CXSCREEN); -} - -/* - * Class: com_sun_javafx_newt_windows_WindowsScreen - * Method: getScreenWidth - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getScreenHeight - (JNIEnv *env, jobject obj, jint scrn_idx) -{ - return (jint)GetSystemMetrics(SM_CYSCREEN); -} - -/* - * Class: com_sun_javafx_newt_windows_WindowsWindow - * Method: initIDs - * Signature: ()Z + * Class: com_sun_javafx_newt_windows_WindowsDisplay + * Method: DispatchMessages + * Signature: ()V */ -JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initIDs +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_DispatchMessages (JNIEnv *env, jclass clazz) { - sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V"); - positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(II)V"); - focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(JZ)V"); - windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); - windowDestroyedID = (*env)->GetMethodID(env, clazz, "windowDestroyed", "()V"); - sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); - sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V"); - if (sizeChangedID == NULL || - positionChangedID == NULL || - focusChangedID == NULL || - windowDestroyNotifyID == NULL || - windowDestroyedID == NULL || - sendMouseEventID == NULL || - sendKeyEventID == NULL) { - return JNI_FALSE; - } - BuildDynamicKeyMapTable(); - return JNI_TRUE; + int i = 0; + MSG msg; + BOOL gotOne; + + // Periodically take a break + do { + gotOne = PeekMessage(&msg, (HWND) NULL, 0, 0, PM_REMOVE); + if (gotOne) { + ++i; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } while (gotOne && i < 100); } /* - * Class: com_sun_javafx_newt_windows_WindowsWindow + * Class: com_sun_javafx_newt_windows_WindowsDisplay * Method: LoadLibraryW * Signature: (Ljava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_LoadLibraryW +JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_LoadLibraryW (JNIEnv *env, jclass clazz, jstring dllName) { jchar* _dllName = GetNullTerminatedStringChars(env, dllName); @@ -842,11 +815,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_LoadLibra } /* - * Class: com_sun_javafx_newt_windows_WindowsWindow + * Class: com_sun_javafx_newt_windows_WindowsDisplay * Method: RegisterWindowClass * Signature: (Ljava/lang/String;J)I */ -JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_RegisterWindowClass +JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_RegisterWindowClass (JNIEnv *env, jclass clazz, jstring wndClassName, jlong hInstance) { ATOM res; @@ -882,17 +855,67 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_RegisterWi } /* - * Class: com_sun_javafx_newt_windows_WindowsWindow + * Class: com_sun_javafx_newt_windows_WindowsDisplay * Method: CleanupWindowResources * Signature: (java/lang/String;J)V */ -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_CleanupWindowResources - (JNIEnv *env, jobject obj, jint wndClassAtom, jlong hInstance) +JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_UnregisterWindowClass + (JNIEnv *env, jclass clazz, jint wndClassAtom, jlong hInstance) { UnregisterClass(MAKEINTATOM(wndClassAtom), (HINSTANCE) hInstance); } /* + * Class: com_sun_javafx_newt_windows_WindowsScreen + * Method: getWidthImpl + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getWidthImpl + (JNIEnv *env, jobject obj, jint scrn_idx) +{ + return (jint)GetSystemMetrics(SM_CXSCREEN); +} + +/* + * Class: com_sun_javafx_newt_windows_WindowsScreen + * Method: getWidthImpl + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getHeightImpl + (JNIEnv *env, jobject obj, jint scrn_idx) +{ + return (jint)GetSystemMetrics(SM_CYSCREEN); +} + +/* + * Class: com_sun_javafx_newt_windows_WindowsWindow + * Method: initIDs + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initIDs + (JNIEnv *env, jclass clazz) +{ + sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V"); + positionChangedID = (*env)->GetMethodID(env, clazz, "positionChanged", "(II)V"); + focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(JZ)V"); + windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V"); + windowDestroyedID = (*env)->GetMethodID(env, clazz, "windowDestroyed", "()V"); + sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); + sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V"); + if (sizeChangedID == NULL || + positionChangedID == NULL || + focusChangedID == NULL || + windowDestroyNotifyID == NULL || + windowDestroyedID == NULL || + sendMouseEventID == NULL || + sendKeyEventID == NULL) { + return JNI_FALSE; + } + BuildDynamicKeyMapTable(); + return JNI_TRUE; +} + +/* * Class: com_sun_javafx_newt_windows_WindowsWindow * Method: CreateWindow * Signature: (ILjava/lang/String;JJZIIII)J @@ -1017,91 +1040,6 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setVisible /* * Class: com_sun_javafx_newt_windows_WindowsWindow - * Method: DispatchMessages - * Signature: (JI)V - */ -JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_DispatchMessages - (JNIEnv *env, jclass clazz, jlong window, jint eventMask) -{ - int i = 0; - MSG msg; - BOOL gotOne; - WindowUserData * wud; - -#if defined(UNDER_CE) || _MSC_VER <= 1200 - wud = (WindowUserData *) GetWindowLong((HWND)window, GWL_USERDATA); -#else - wud = (WindowUserData *) GetWindowLongPtr((HWND)window, GWLP_USERDATA); -#endif - if(NULL==wud) { - fprintf(stderr, "INTERNAL ERROR in WindowsWindow::DispatchMessages window userdata NULL\n"); - exit(1); - } - - wud->jenv = env; - - if(eventMask<0) { - eventMask *= -1; - /* FIXME: re-select input mask - long xevent_mask_key = 0; - long xevent_mask_ptr = 0; - long xevent_mask_win = 0; - if( 0 != ( eventMask & EVENT_MOUSE ) ) { - xevent_mask_ptr |= ButtonPressMask|ButtonReleaseMask|PointerMotionMask; - } - if( 0 != ( eventMask & EVENT_KEY ) ) { - xevent_mask_key |= KeyPressMask|KeyReleaseMask; - } - if( 0 != ( eventMask & EVENT_WINDOW ) ) { - xevent_mask_win |= ExposureMask; - } - - XSelectInput(dpy, w, xevent_mask_win|xevent_mask_key|xevent_mask_ptr); - */ - } - - // Periodically take a break - do { - gotOne = PeekMessage(&msg, (HWND) window, 0, 0, PM_REMOVE); - if (gotOne) { - ++i; - switch (msg.message) { - case WM_CLOSE: - case WM_DESTROY: - case WM_SIZE: - if( ! ( eventMask & EVENT_WINDOW ) ) { - continue; - } - break; - - case WM_CHAR: - case WM_KEYDOWN: - case WM_KEYUP: - if( ! ( eventMask & EVENT_KEY ) ) { - continue; - } - break; - - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_MOUSEMOVE: - if( ! ( eventMask & EVENT_MOUSE ) ) { - continue; - } - break; - } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } while (gotOne && i < 100); -} - -/* - * Class: com_sun_javafx_newt_windows_WindowsWindow * Method: setSize0 * Signature: (JII)V */ |