https://git.reactos.org/?p=reactos.git;a=commitdiff;h=79c926c893c563ba5f701…
commit 79c926c893c563ba5f701eecf4c73640a2192834
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Dec 8 18:26:22 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 8 18:26:22 2021 +0900
[NTUSER] Implement HSHELL_RUDEAPPACTIVATE notification (#4147)
- Add IntIsWindowFullscreen function to judge whether the window is fullscreen.
- Add IntCheckFullscreen function to notify HSHELL_RUDEAPPACTIVATE if fullscreen.
- Add IntCheckFullscreen call in UpdateShellHook function.
- Add IntCheckFullscreen call in co_WinPosSetWindowPos function.
CORE-16130
---
win32ss/user/ntuser/focus.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
win32ss/user/ntuser/focus.h | 1 +
win32ss/user/ntuser/winpos.c | 4 ++++
3 files changed, 54 insertions(+)
diff --git a/win32ss/user/ntuser/focus.c b/win32ss/user/ntuser/focus.c
index 3c5ee19ed87..a9ea0965177 100644
--- a/win32ss/user/ntuser/focus.c
+++ b/win32ss/user/ntuser/focus.c
@@ -15,6 +15,7 @@ PTHREADINFO gptiForeground = NULL;
PPROCESSINFO gppiLockSFW = NULL;
ULONG guSFWLockCount = 0; // Rule #8, No menus are active. So should be zero.
PTHREADINFO ptiLastInput = NULL;
+HWND ghwndOldFullscreen = NULL;
/*
Check locking of a process or one or more menus are active.
@@ -48,9 +49,57 @@ IntGetThreadFocusWindow(VOID)
return ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
}
+BOOL FASTCALL IntIsWindowFullscreen(PWND Window)
+{
+ RECTL rclAnd, rclMonitor, rclWindow;
+ PMONITOR pMonitor;
+
+ if (!Window || !(Window->style & WS_VISIBLE) || (Window->style &
WS_CHILD) ||
+ (Window->ExStyle & WS_EX_TOOLWINDOW) || !IntGetWindowRect(Window,
&rclWindow))
+ {
+ return FALSE;
+ }
+
+ pMonitor = UserGetPrimaryMonitor();
+ if (!pMonitor)
+ {
+ RECTL_vSetRect(&rclMonitor, 0, 0,
+ UserGetSystemMetrics(SM_CXSCREEN),
UserGetSystemMetrics(SM_CYSCREEN));
+ }
+ else
+ {
+ rclMonitor = *(LPRECTL)&pMonitor->rcMonitor;
+ }
+
+ RECTL_bIntersectRect(&rclAnd, &rclMonitor, &rclWindow);
+ return RtlEqualMemory(&rclAnd, &rclMonitor, sizeof(RECTL));
+}
+
+BOOL FASTCALL IntCheckFullscreen(PWND Window)
+{
+ HWND hWnd;
+
+ if (ghwndOldFullscreen &&
!IntIsWindowFullscreen(ValidateHwndNoErr(ghwndOldFullscreen)))
+ ghwndOldFullscreen = NULL;
+
+ if (!IntIsWindowFullscreen(Window))
+ return FALSE;
+
+ hWnd = UserHMGetHandle(Window);
+ if (ghwndOldFullscreen != hWnd)
+ {
+ co_IntShellHookNotify(HSHELL_RUDEAPPACTIVATED, (WPARAM)hWnd, TRUE);
+ ghwndOldFullscreen = hWnd;
+ }
+ return TRUE;
+}
+
VOID FASTCALL
UpdateShellHook(PWND Window)
{
+ if (IntCheckFullscreen(Window))
+ return;
+
if ( Window->spwndParent == UserGetDesktopWindow() &&
(!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
(Window->ExStyle & WS_EX_APPWINDOW)))
diff --git a/win32ss/user/ntuser/focus.h b/win32ss/user/ntuser/focus.h
index 821d7b4db57..37ada347dc0 100644
--- a/win32ss/user/ntuser/focus.h
+++ b/win32ss/user/ntuser/focus.h
@@ -29,3 +29,4 @@ VOID FASTCALL IntActivateWindow(PWND,PTHREADINFO,HANDLE,DWORD);
BOOL FASTCALL IntDeactivateWindow(PTHREADINFO,HANDLE);
BOOL FASTCALL co_IntSetForegroundMessageQueue(PWND,PTHREADINFO,BOOL,DWORD );
VOID FASTCALL UpdateShellHook(PWND);
+BOOL FASTCALL IntCheckFullscreen(PWND Window);
diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c
index 550a074c6c1..da70805ed9c 100644
--- a/win32ss/user/ntuser/winpos.c
+++ b/win32ss/user/ntuser/winpos.c
@@ -1926,6 +1926,10 @@ co_WinPosSetWindowPos(
Window->head.pti->cVisWindows++;
IntNotifyWinEvent(EVENT_OBJECT_SHOW, Window, OBJID_WINDOW, CHILDID_SELF,
WEF_SETBYWNDPTI);
}
+ else
+ {
+ IntCheckFullscreen(Window);
+ }
if (Window->hrgnUpdate != NULL && Window->hrgnUpdate != HRGN_WINDOW)
{