Some applications use FindWindowA() with class Shell_TrayWnd to find the taskbar window on Windows. Then GetWindowRect() is called to get the taskbar window rectangle. Finally, the taskbar window rectangle is subtracted from the primary screen rectangle to calculate the work area. Without a valid taskbar window position, these applications end up getting an incorrect work area and going down the wrong path. So use the same position and size as the host system panel for explorer taskbar when it's hidden.
From: Zhiyi Zhang zzhang@codeweavers.com
--- configure.ac | 1 + programs/explorer/tests/Makefile.in | 5 +++ programs/explorer/tests/explorer.c | 51 +++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 programs/explorer/tests/Makefile.in create mode 100644 programs/explorer/tests/explorer.c
diff --git a/configure.ac b/configure.ac index 1d0ae5c3fc2..cc3f42ecbf0 100644 --- a/configure.ac +++ b/configure.ac @@ -3348,6 +3348,7 @@ WINE_CONFIG_MAKEFILE(programs/dxdiag) WINE_CONFIG_MAKEFILE(programs/eject) WINE_CONFIG_MAKEFILE(programs/expand) WINE_CONFIG_MAKEFILE(programs/explorer) +WINE_CONFIG_MAKEFILE(programs/explorer/tests) WINE_CONFIG_MAKEFILE(programs/extrac32) WINE_CONFIG_MAKEFILE(programs/fc) WINE_CONFIG_MAKEFILE(programs/find) diff --git a/programs/explorer/tests/Makefile.in b/programs/explorer/tests/Makefile.in new file mode 100644 index 00000000000..01dfc134fe5 --- /dev/null +++ b/programs/explorer/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = explorer.exe +IMPORTS = user32 + +C_SRCS = \ + explorer.c diff --git a/programs/explorer/tests/explorer.c b/programs/explorer/tests/explorer.c new file mode 100644 index 00000000000..c9ed7a900f2 --- /dev/null +++ b/programs/explorer/tests/explorer.c @@ -0,0 +1,51 @@ +/* + * Explorer.exe tests + * + * Copyright 2022 Zhiyi Zhang for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <windows.h> +#include "wine/test.h" + +static void test_taskbar(void) +{ + RECT taskbar_rect, expected_rect, primary_rect, work_rect; + HWND hwnd; + BOOL ret; + + hwnd = FindWindowA("Shell_TrayWnd", NULL); + if (!hwnd) + { + skip("Failed to find the taskbar window.\n"); + return; + } + + ret = GetWindowRect(hwnd, &taskbar_rect); + ok(ret, "GetWindowRect failed, error %ld.\n", GetLastError()); + + SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_rect, 0); + SetRect(&primary_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SubtractRect(&expected_rect, &primary_rect, &work_rect); + todo_wine + ok(EqualRect(&taskbar_rect, &expected_rect), "Expected %s, got %s.\n", + wine_dbgstr_rect(&expected_rect), wine_dbgstr_rect(&taskbar_rect)); +} + +START_TEST(explorer) +{ + test_taskbar(); +}
From: Zhiyi Zhang zzhang@codeweavers.com
Some applications use FindWindowA() with class Shell_TrayWnd to find the taskbar window on Windows. Then GetWindowRect() is called to get the taskbar window rectangle. Finally, the taskbar window rectangle is subtracted from the primary screen rectangle to calculate the work area. Without a valid taskbar window position, these applications end up getting an incorrect work area and going down the wrong path. So use the same position and size as the host system panel for explorer taskbar when it's hidden. --- programs/explorer/systray.c | 15 +++++++++------ programs/explorer/tests/explorer.c | 1 - 2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 5b7216b2904..7790648d021 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -712,10 +712,7 @@ static void show_taskbar_contextmenu( HWND button, LPARAM lparam )
static void do_hide_systray(void) { - SetWindowPos( tray_window, 0, - GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN), - GetSystemMetrics(SM_YVIRTUALSCREEN) + GetSystemMetrics(SM_CYVIRTUALSCREEN), - 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE ); + ShowWindow( tray_window, SW_HIDE ); }
static BOOL notify_owner( struct icon *icon, UINT msg, POINT pt ) @@ -899,6 +896,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab { WNDCLASSEXW class; static const WCHAR classname[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0}; + RECT work_rect, primary_rect, taskbar_rect;
if (using_root && graphics_driver) wine_notify_icon = (void *)GetProcAddress( graphics_driver, "wine_notify_icon" );
@@ -924,8 +922,13 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab return; }
- tray_window = CreateWindowExW( WS_EX_NOACTIVATE, classname, NULL, WS_POPUP, - 0, GetSystemMetrics( SM_CYSCREEN ), 0, 0, 0, 0, 0, 0 ); + SystemParametersInfoW( SPI_GETWORKAREA, 0, &work_rect, 0 ); + SetRect( &primary_rect, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) ); + SubtractRect( &taskbar_rect, &primary_rect, &work_rect ); + + tray_window = CreateWindowExW( WS_EX_NOACTIVATE, classname, NULL, WS_POPUP, taskbar_rect.left, + taskbar_rect.top, taskbar_rect.right - taskbar_rect.left, + taskbar_rect.bottom - taskbar_rect.top, 0, 0, 0, 0 ); if (!tray_window) { WINE_ERR("Could not create tray window\n"); diff --git a/programs/explorer/tests/explorer.c b/programs/explorer/tests/explorer.c index c9ed7a900f2..3882027ae46 100644 --- a/programs/explorer/tests/explorer.c +++ b/programs/explorer/tests/explorer.c @@ -40,7 +40,6 @@ static void test_taskbar(void) SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_rect, 0); SetRect(&primary_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); SubtractRect(&expected_rect, &primary_rect, &work_rect); - todo_wine ok(EqualRect(&taskbar_rect, &expected_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&expected_rect), wine_dbgstr_rect(&taskbar_rect)); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126272
Your paranoid android.
=== debian11 (32 bit report) ===
d3d8: stateblock: Timeout visual: Timeout
d3d9: d3d9ex: Timeout device: Timeout stateblock: Timeout visual: Timeout
d3dcompiler_43: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3dcompiler_46: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3dcompiler_47: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3drm: d3drm: Timeout vector: Timeout
d3dx10_34: d3dx10: Timeout
d3dx10_35: d3dx10: Timeout
d3dx10_36: d3dx10: Timeout
d3dx10_37: d3dx10: Timeout
d3dx10_38: d3dx10: Timeout
d3dx10_39: d3dx10: Timeout
d3dx10_40: d3dx10: Timeout
d3dx10_41: d3dx10: Timeout
d3dx10_42: d3dx10: Timeout
d3dx10_43: d3dx10: Timeout
d3dx11_42: d3dx11: Timeout
d3dx11_43: d3dx11: Timeout
d3dx9_36: asm: Timeout core: Timeout effect: Timeout line: Timeout
Report validation errors: math: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out