https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4bd0166e633194df337b5…
commit 4bd0166e633194df337b577488860d0a178e9daa
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Oct 28 02:56:16 2018 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Oct 28 02:56:16 2018 +0900
[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
---
win32ss/user/ntuser/simplecall.c | 20 ++++++++++++++++++--
win32ss/user/user32/include/ntwrapper.h | 5 +++++
win32ss/user/user32/windows/window.c | 21 +++++----------------
3 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/win32ss/user/ntuser/simplecall.c b/win32ss/user/ntuser/simplecall.c
index c7ad21fca0..0d2042bb6d 100644
--- a/win32ss/user/ntuser/simplecall.c
+++ b/win32ss/user/ntuser/simplecall.c
@@ -3,7 +3,8 @@
* PROJECT: ReactOS kernel
* PURPOSE: NtUserCallXxx call stubs
* FILE: win32ss/user/ntuser/simplecall.c
- * PROGRAMER: Ge van Geldorp (ge(a)gse.nl)
+ * PROGRAMERS: Ge van Geldorp (ge(a)gse.nl)
+ * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com)
*/
#include <win32k.h>
@@ -505,9 +506,24 @@ NtUserCallTwoParam(
}
case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW:
- STUB
+ {
+ HWND hwnd = (HWND)Param1;
Ret = 0;
+ Window = UserGetWindowObject(hwnd);
+ if (!Window)
+ {
+ break;
+ }
+ if ((BOOL)Param2)
+ {
+ if (Window->style & WS_MINIMIZE)
+ {
+ UserPostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ }
+ }
+ UserSetActiveWindow(Window);
break;
+ }
case TWOPARAM_ROUTINE_SETCARETPOS:
Ret = (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2);
diff --git a/win32ss/user/user32/include/ntwrapper.h
b/win32ss/user/user32/include/ntwrapper.h
index 01a07e4b30..e1d31f9fd7 100644
--- a/win32ss/user/user32/include/ntwrapper.h
+++ b/win32ss/user/user32/include/ntwrapper.h
@@ -688,6 +688,11 @@ EXTINLINE BOOL NtUserxUpdateUiState(HWND hWnd, DWORD Param)
return (BOOL)NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)Param,
TWOPARAM_ROUTINE_ROS_UPDATEUISTATE);
}
+EXTINLINE VOID NtUserxSwitchToThisWindow(HWND hWnd, BOOL bUnknown)
+{
+ NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)bUnknown,
TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW);
+}
+
EXTINLINE BOOL NtUserxShowOwnedPopups(HWND hWnd, BOOL fShow)
{
return (BOOL)NtUserCallTwoParam((DWORD_PTR)hWnd, fShow,
TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS);
diff --git a/win32ss/user/user32/windows/window.c b/win32ss/user/user32/windows/window.c
index cad886129b..df5438045e 100644
--- a/win32ss/user/user32/windows/window.c
+++ b/win32ss/user/user32/windows/window.c
@@ -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