diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index 0dc4561c14..fce5ef05dc 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -307,44 +307,43 @@ LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam //////////////////////////////////////////////////////////////////// LONG wdxGraphicsWindow:: window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - int button = -1; - int x, y, width, height; + int button = -1; + int x, y, width, height; - switch(msg) { - - case WM_PAINT: { - PAINTSTRUCT ps; - BeginPaint(hwnd, &ps); - - if(DXREADY) - show_frame(); - EndPaint(hwnd, &ps); - return 0; + switch(msg) { + case WM_PAINT: { + PAINTSTRUCT ps; + BeginPaint(hwnd, &ps); + + if(DXREADY) + show_frame(); + EndPaint(hwnd, &ps); + return 0; + } + + case WM_MOUSEMOVE: + if(!DXREADY) + break; + + // Win32 doesn't return the same numbers as X does when the mouse + // goes beyond the upper or left side of the window + #define SET_MOUSE_COORD(iVal,VAL) { \ + iVal = VAL; \ + if(iVal & 0x8000) \ + iVal -= 0x10000; \ } - - case WM_MOUSEMOVE: - if(!DXREADY) - break; - - // Win32 doesn't return the same numbers as X does when the mouse - // goes beyond the upper or left side of the window - #define SET_MOUSE_COORD(iVal,VAL) { \ - iVal = VAL; \ - if(iVal & 0x8000) \ - iVal -= 0x10000; \ - } - - SET_MOUSE_COORD(x,LOWORD(lparam)); - SET_MOUSE_COORD(y,HIWORD(lparam)); - - if(mouse_motion_enabled() - && wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { - handle_mouse_motion(x, y); - } else if(mouse_passive_motion_enabled() && - ((wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == 0)) { - handle_mouse_motion(x, y); - } - return 0; + + SET_MOUSE_COORD(x,LOWORD(lparam)); + SET_MOUSE_COORD(y,HIWORD(lparam)); + + if(mouse_motion_enabled() + && wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { + handle_mouse_motion(x, y); + } else if(mouse_passive_motion_enabled() && + ((wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == 0)) { + handle_mouse_motion(x, y); + } + return 0; case WM_IME_NOTIFY: if (wparam == IMN_SETOPENSTATUS) { @@ -561,7 +560,14 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { _WindowAdjustingType = MovingOrResizing; } break; - +/* + case WM_SETCURSOR: { + if(!_props._bCursorIsVisible) + return true; // avoid defaultwindproc showing the cursor + break; +// return false; + } +*/ case WM_DISPLAYCHANGE: { #ifdef _DEBUG width = LOWORD(lparam); height = HIWORD(lparam); @@ -625,13 +631,13 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { break; } - if(_mouse_entry_enabled) - handle_mouse_entry(MOUSE_ENTERED,_pParentWindowGroup->_hMouseCursor); - POINT point; GetCursorPos(&point); ScreenToClient(hwnd, &point); + if(_mouse_entry_enabled) + handle_mouse_entry(MOUSE_ENTERED,point.x,point.y); + // this is a hack to make sure common modifier keys have proper state // since at focus loss, app may never receive key-up event corresponding to // a key-down. it would be better to know the exact set of ModifierButtons the @@ -652,7 +658,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { } if(_mouse_entry_enabled) - handle_mouse_entry(MOUSE_EXITED,_pParentWindowGroup->_hMouseCursor); + handle_mouse_entry(MOUSE_EXITED,0,0); int i; for(i=0;i