Mercurial > hg > openttd
changeset 7126:f5c001958c14 draft
(svn r10399) -Fix (FS#962): [Windows] _wnd.has_focus was not properly set after using ALT-TAB
author | glx <glx@openttd.org> |
---|---|
date | Sat, 30 Jun 2007 15:02:21 +0000 |
parents | c46d3397a476 |
children | 2116c82efa49 |
files | src/video/win32_v.cpp |
diffstat | 1 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -23,7 +23,6 @@ int height; int width_org; int height_org; - bool minimized; bool fullscreen; bool has_focus; bool running; @@ -508,8 +507,7 @@ break; case WM_SIZE: - _wnd.minimized = (wParam == SIZE_MINIMIZED); - if (!_wnd.minimized) { + if (wParam != SIZE_MINIMIZED) { /* Set maximized flag when we maximize (obviously), but also when we * switched to fullscreen from a maximized state */ _window_maximize = (wParam == SIZE_MAXIMIZED || (_window_maximize && _fullscreen)); @@ -601,23 +599,34 @@ return 0; } - case WM_ACTIVATEAPP: - _wnd.has_focus = (wParam != 0); + case WM_SETFOCUS: + _wnd.has_focus = true; + break; + + case WM_KILLFOCUS: + _wnd.has_focus = false; + break; + #if !defined(WINCE) + case WM_ACTIVATE: { + bool active = (LOWORD(wParam) != WA_INACTIVE); + bool minimized = (HIWORD(wParam) != 0); if (_wnd.fullscreen) { - if (_wnd.has_focus && _wnd.minimized) { + if (active && minimized) { /* Restore the game window */ ShowWindow(hwnd, SW_RESTORE); MakeWindow(true); - } else if (!_wnd.has_focus && !_wnd.minimized) { + } else if (!active && !minimized) { /* Minimise the window and restore desktop */ ShowWindow(hwnd, SW_MINIMIZE); ChangeDisplaySettings(NULL, 0); } } + break; + } + } #endif - break; - } + return DefWindowProc(hwnd, msg, wParam, lParam); }