|
@@ -663,15 +663,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
|
case WM_ACTIVATE:
|
|
|
{
|
|
|
- POINT cursorPos;
|
|
|
BOOL minimized;
|
|
|
|
|
|
minimized = HIWORD(wParam);
|
|
|
if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
|
|
|
- /* Don't mark the window as shown if it's activated before being shown */
|
|
|
- if (!IsWindowVisible(hwnd)) {
|
|
|
- break;
|
|
|
- }
|
|
|
if (LOWORD(wParam) == WA_CLICKACTIVE) {
|
|
|
SDL_bool swapButtons = GetSystemMetrics(SM_SWAPBUTTON) != 0;
|
|
|
if (GetAsyncKeyState(VK_LBUTTON)) {
|
|
@@ -692,42 +687,55 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
}
|
|
|
|
|
|
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
|
|
- if (SDL_GetKeyboardFocus() != data->window) {
|
|
|
- SDL_SetKeyboardFocus(data->window);
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ returnCode = 0;
|
|
|
+ break;
|
|
|
|
|
|
- GetCursorPos(&cursorPos);
|
|
|
- ScreenToClient(hwnd, &cursorPos);
|
|
|
- SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
|
|
|
+ case WM_SETFOCUS:
|
|
|
+ {
|
|
|
+ POINT cursorPos;
|
|
|
|
|
|
- WIN_CheckAsyncMouseRelease(data);
|
|
|
- WIN_UpdateClipCursor(data->window);
|
|
|
+ if (SDL_GetKeyboardFocus() != data->window) {
|
|
|
+ SDL_SetKeyboardFocus(data->window);
|
|
|
+ }
|
|
|
|
|
|
- /*
|
|
|
- * FIXME: Update keyboard state
|
|
|
- */
|
|
|
- WIN_CheckClipboardUpdate(data->videodata);
|
|
|
+ GetCursorPos(&cursorPos);
|
|
|
+ ScreenToClient(hwnd, &cursorPos);
|
|
|
+ SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
|
|
|
|
|
|
- SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
|
|
- SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
|
|
|
- SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
|
|
|
- } else {
|
|
|
- RECT rect;
|
|
|
+ WIN_CheckAsyncMouseRelease(data);
|
|
|
+ WIN_UpdateClipCursor(data->window);
|
|
|
|
|
|
- data->in_window_deactivation = SDL_TRUE;
|
|
|
+ /*
|
|
|
+ * FIXME: Update keyboard state
|
|
|
+ */
|
|
|
+ WIN_CheckClipboardUpdate(data->videodata);
|
|
|
|
|
|
- if (SDL_GetKeyboardFocus() == data->window) {
|
|
|
- SDL_SetKeyboardFocus(NULL);
|
|
|
- WIN_ResetDeadKeys();
|
|
|
- }
|
|
|
+ SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
|
|
+ SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
|
|
|
+ SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
|
|
|
+ }
|
|
|
+ returnCode = 0;
|
|
|
+ break;
|
|
|
|
|
|
- if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect)) == 0) {
|
|
|
- ClipCursor(NULL);
|
|
|
- SDL_zero(data->cursor_clipped_rect);
|
|
|
- }
|
|
|
+ case WM_KILLFOCUS:
|
|
|
+ {
|
|
|
+ RECT rect;
|
|
|
+
|
|
|
+ data->in_window_deactivation = SDL_TRUE;
|
|
|
|
|
|
- data->in_window_deactivation = SDL_FALSE;
|
|
|
+ if (SDL_GetKeyboardFocus() == data->window) {
|
|
|
+ SDL_SetKeyboardFocus(NULL);
|
|
|
+ WIN_ResetDeadKeys();
|
|
|
}
|
|
|
+
|
|
|
+ if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect)) == 0) {
|
|
|
+ ClipCursor(NULL);
|
|
|
+ SDL_zero(data->cursor_clipped_rect);
|
|
|
+ }
|
|
|
+
|
|
|
+ data->in_window_deactivation = SDL_FALSE;
|
|
|
}
|
|
|
returnCode = 0;
|
|
|
break;
|