Fix cursors not showing up on Windows.

(At least mostly; there might still be a few glitches.)
This commit is contained in:
2015-01-04 22:03:24 -05:00
parent c3e801ad7a
commit f44f713cac
8 changed files with 58 additions and 55 deletions

View File

@@ -78,6 +78,8 @@ void handle_file_menu(int item_hit);
void handle_edit_menus(int item_hit);
void handle_item_menu(int item_hit);
#include "cursors.h"
LRESULT CALLBACK menuProc(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) {
if(message == WM_COMMAND) {
int cmd = LOWORD(wParam);
@@ -117,6 +119,11 @@ LRESULT CALLBACK menuProc(HWND handle, UINT message, WPARAM wParam, LPARAM lPara
// Help menu
case IDM_HELP: handle_help_menu(1);
}
} else if(message == WM_SETCURSOR) {
// Windows resets the cursor to an arrow whenever the mouse moves, unless we do this.
// Note: By handling this message, sf::Window::setMouseCursorVisible() will NOT work.
restore_cursor();
return true;
}
return CallWindowProc(reinterpret_cast<WNDPROC>(mainProc), handle, message, wParam, lParam);
}