mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[USER32] Fix behavior of Task Switcher (Alt+Tab) (#1591)
Task Switcher didn't correctly behave on the windows with WS_EX_APPWINDOW extended style. CORE-15653
This commit is contained in:
parent
8d38373fd2
commit
1010f3796e
|
@ -209,41 +209,36 @@ BOOL CALLBACK EnumerateCallback(HWND window, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function mostly compatible with the normal EnumChildWindows,
|
static BOOL CALLBACK
|
||||||
// except it lists in Z-Order and it doesn't ensure consistency
|
EnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
// if a window is removed while enumerating
|
|
||||||
void EnumWindowsZOrder(WNDENUMPROC callback, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
HWND hwnd, hwndOwner;
|
HWND hwndOwner;
|
||||||
WCHAR szClass[64];
|
WCHAR szClass[64];
|
||||||
DWORD ExStyle;
|
DWORD ExStyle;
|
||||||
|
|
||||||
for (hwnd = GetTopWindow(NULL); hwnd; hwnd = GetWindow(hwnd, GW_HWNDNEXT))
|
if (!IsWindowVisible(hwnd))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
// check special windows
|
||||||
|
if (!GetClassNameW(hwnd, szClass, _countof(szClass)) ||
|
||||||
|
wcscmp(szClass, L"Shell_TrayWnd") == 0 ||
|
||||||
|
wcscmp(szClass, L"Progman") == 0)
|
||||||
{
|
{
|
||||||
if (!IsWindowVisible(hwnd))
|
return TRUE;
|
||||||
continue;
|
|
||||||
|
|
||||||
// check special windows
|
|
||||||
if (!GetClassNameW(hwnd, szClass, _countof(szClass)) ||
|
|
||||||
wcscmp(szClass, L"Shell_TrayWnd") == 0 ||
|
|
||||||
wcscmp(szClass, L"Progman") == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExStyle = GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
|
|
||||||
if (ExStyle & WS_EX_TOOLWINDOW)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
hwndOwner = GetWindow(hwnd, GW_OWNER);
|
|
||||||
if ((ExStyle & WS_EX_APPWINDOW) || !IsWindowVisible(hwndOwner))
|
|
||||||
{
|
|
||||||
if (!callback(hwnd, lParam))
|
|
||||||
break;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExStyle = GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
|
||||||
|
if (ExStyle & WS_EX_TOOLWINDOW)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
hwndOwner = GetWindow(hwnd, GW_OWNER);
|
||||||
|
if (!IsWindowVisible(hwndOwner) || (ExStyle & WS_EX_APPWINDOW))
|
||||||
|
{
|
||||||
|
if (!EnumerateCallback(hwnd, lParam))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessMouseMessage(UINT message, LPARAM lParam)
|
void ProcessMouseMessage(UINT message, LPARAM lParam)
|
||||||
|
@ -428,8 +423,8 @@ BOOL ProcessHotKey(VOID)
|
||||||
{
|
{
|
||||||
if (!isOpen)
|
if (!isOpen)
|
||||||
{
|
{
|
||||||
windowCount=0;
|
windowCount = 0;
|
||||||
EnumWindowsZOrder(EnumerateCallback, 0);
|
EnumWindows(EnumWindowsProc, 0);
|
||||||
|
|
||||||
if (windowCount == 0)
|
if (windowCount == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -574,7 +569,7 @@ LRESULT WINAPI DoAppSwitch( WPARAM wParam, LPARAM lParam )
|
||||||
Esc = TRUE;
|
Esc = TRUE;
|
||||||
|
|
||||||
windowCount = 0;
|
windowCount = 0;
|
||||||
EnumWindowsZOrder(EnumerateCallback, 0);
|
EnumWindows(EnumWindowsProc, 0);
|
||||||
|
|
||||||
if (windowCount < 2)
|
if (windowCount < 2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue