[WIN32SS] Move SwitchToThisWindow codes to win32k (#987)

- Implement user32!SwitchToThisWindow by NtUserCallTwoParam TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW.
- Improve user32!CloseWindow with using SetActiveWindow and ShowWindow (synchronized).
CORE-15165
This commit is contained in:
Katayama Hirofumi MZ 2018-10-28 02:56:16 +09:00 committed by GitHub
parent 07e6af6aa1
commit 4bd0166e63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 18 deletions

View file

@ -79,22 +79,9 @@ BringWindowToTop(HWND hWnd)
VOID WINAPI
SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
SwitchToThisWindow(HWND hwnd, BOOL bUnknown)
{
HWND hwndFG;
if (fAltTab)
{
if (IsIconic(hwnd))
PostMessageW(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(hwnd);
}
else
{
hwndFG = GetForegroundWindow();
PostMessageW(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetWindowPos(hwnd, hwndFG, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
SetWindowPos(hwndFG, hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
NtUserxSwitchToThisWindow(hwnd, bUnknown);
}
@ -127,7 +114,9 @@ ChildWindowFromPointEx(HWND hwndParent,
BOOL WINAPI
CloseWindow(HWND hWnd)
{
return PostMessageW(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
/* NOTE: CloseWindow does minimizes, and doesn't close. */
SetActiveWindow(hWnd);
return ShowWindow(hWnd, SW_SHOWMINIMIZED);
}
FORCEINLINE