diff options
author | Sven Gothel <[email protected]> | 2013-04-05 03:40:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-05 03:40:17 +0200 |
commit | d4e840fed236bb139515ec03a4a2ebe1676d3cb1 (patch) | |
tree | 23c453f153e6d078f9cd424a995950ac701861ca | |
parent | 5e3563d7dab16384bcc381e24b741fa651f2f3cd (diff) |
Bug 707: Fix NEWT EVENT_MOUSE_EXITED not sent on Windows - Regression of commit 85338858f5c58694fa88e77df1386d0556887944
Commit replaced enqueueMouseEventID w/ sendMouseEventID, while not removing the 'jboolean wait' argument.
This also lead to staying in DRAGGED mode when mouse left the window.
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java | 11 | ||||
-rw-r--r-- | src/newt/native/WindowsWindow.c | 19 |
2 files changed, 20 insertions, 10 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index 475687eb4..e7a8d5a33 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -131,18 +131,19 @@ public class WindowDriver extends WindowImpl { setGraphicsConfiguration(cfg); final int flags = getReconfigureFlags(0, true) & ( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ; - setWindowHandle(CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(), - getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags)); - if (getWindowHandle() == 0) { + final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(), + getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags); + if ( 0 == _windowHandle ) { throw new NativeWindowException("Error creating window"); } - windowHandleClose = getWindowHandle(); + setWindowHandle(_windowHandle); + windowHandleClose = _windowHandle; addMouseListener(mouseTracker); if(DEBUG_IMPLEMENTATION) { Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+ " (Parent HWND "+toHexString(getParentWindowHandle())+ - ") : HWND "+toHexString(getWindowHandle())+", "+Thread.currentThread()); + ") : HWND "+toHexString(_windowHandle)+", "+Thread.currentThread()); e.printStackTrace(); } } diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 05953cb86..aeb860bbc 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -524,14 +524,14 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jb DBG_PRINT("*** WindowsWindow: requestFocus.XX\n"); } -static void NewtWindows_trackPointerLeave(HWND hwnd) { +static BOOL NewtWindows_trackPointerLeave(HWND hwnd) { TRACKMOUSEEVENT tme; memset(&tme, 0, sizeof(TRACKMOUSEEVENT)); tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; tme.hwndTrack = hwnd; tme.dwHoverTime = 0; // we don't use TME_HOVER - TrackMouseEvent(&tme); + return TrackMouseEvent(&tme); } #if 0 @@ -915,6 +915,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP break; case WM_MOUSEMOVE: + DBG_PRINT("*** WindowsWindow: WM_MOUSEMOVE %d/%d\n", (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam)); (*env)->CallVoidMethod(env, window, sendMouseEventID, (jshort) EVENT_MOUSE_MOVED, GetModifiers( FALSE, 0 ), @@ -923,7 +924,8 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP useDefWindowProc = 1; break; case WM_MOUSELEAVE: - (*env)->CallVoidMethod(env, window, sendMouseEventID, JNI_FALSE, + DBG_PRINT("*** WindowsWindow: WM_MOUSELEAVE\n"); + (*env)->CallVoidMethod(env, window, sendMouseEventID, (jshort) EVENT_MOUSE_EXITED, 0, (jint) -1, (jint) -1, // fake @@ -1739,7 +1741,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_trackPointer (JNIEnv *env, jclass clazz, jlong window) { HWND hwnd = (HWND) (intptr_t) window; - DBG_PRINT( "*** WindowsWindow: trackMouseLeave0\n"); - NewtWindows_trackPointerLeave(hwnd); + BOOL ok = NewtWindows_trackPointerLeave(hwnd); + DBG_PRINT( "*** WindowsWindow: trackMouseLeave0: %d\n", ok); + #ifdef VERBOSE_ON + if(!ok) { + int lastError = (int) GetLastError(); + DBG_PRINT( "*** WindowsWindow: trackMouseLeave0: lastError 0x%X %d\n", lastError, lastError); + } + #endif + (void)ok; } |