[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
This commit is contained in:
Katayama Hirofumi MZ 2021-12-08 18:26:22 +09:00 committed by GitHub
parent 821223b3d5
commit 79c926c893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 0 deletions

View file

@ -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)))

View file

@ -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);

View file

@ -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)
{