diff --git a/ChangeLog b/ChangeLog index 5e56768..2ec6ad0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-12-08 Jonathan Gillaspie + + * Source/win32/WIN32Server.m: Added better logging on Window create and destroy errors. + Added a secondary call to get current mouse position if the first call fails. + * Source/win32/w32_text_focus.m: Cast parameter to appropriate (HWND) type. + 2010-11-18 Eric Wasylishen * Source/winlib/WIN32FontInfo.m: diff --git a/Source/win32/WIN32Server.m b/Source/win32/WIN32Server.m index 840002e..7968eb4 100644 --- a/Source/win32/WIN32Server.m +++ b/Source/win32/WIN32Server.m @@ -925,8 +925,11 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, (HMENU)NULL, hinstance, (void*)type); - NSDebugLLog(@"WTrace", @" num/handle: %d", hwnd); - + NSDebugLLog(@"WCTrace", @" num/handle: %d", hwnd); + if (!hwnd) { + NSLog(@"CreateWindowEx Failed %d", GetLastError()); + } + SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA); [self _setWindowOwnedByServer: (int)hwnd]; @@ -935,8 +938,10 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, - (void) termwindow: (int) winNum { - NSDebugLLog(@"WTrace", @"termwindow: %d", winNum); - DestroyWindow((HWND)winNum); + NSDebugLLog(@"WCTrace", @"termwindow: %d", winNum); + if (!DestroyWindow((HWND)winNum)) { + NSLog(@"DestroyWindow Failed %d", GetLastError()); + } } - (void) stylewindow: (unsigned int)style : (int) winNum @@ -1545,9 +1550,15 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, POINT p; if (!GetCursorPos(&p)) - { - NSLog(@"GetCursorPos failed with %d", GetLastError()); - return NSZeroPoint; + { + // Try using cursorInfo which should work in more situations + CURSORINFO cursorInfo; + cursorInfo.cbSize = sizeof(CURSORINFO); + if (!GetCursorInfo(&cursorInfo)) { + NSLog(@"GetCursorInfo failed with %d", GetLastError()); + return NSZeroPoint; + } + p = cursorInfo.ptScreenPos; } return MSScreenPointToGS(p.x, p.y); diff --git a/Source/win32/w32_text_focus.m b/Source/win32/w32_text_focus.m index b6cee6d..dd6a995 100644 --- a/Source/win32/w32_text_focus.m +++ b/Source/win32/w32_text_focus.m @@ -76,7 +76,7 @@ NSEvent *ev; // Remember the now focused window - currentFocus = wParam; + currentFocus = (HWND) wParam; ev = [NSEvent otherEventWithType: NSAppKitDefined location: NSMakePoint(0, 0)