From: Andrea Faulds <ajf@ajf.me> Without this, while appbars are positioned correctly, maximized windows will still cover them. Manual testing on Windows 2000 and XP found that the work area rect seems to be managed by explorer (it gets reset when explorer is started, registering appbars appears to change the work area, and killing explorer makes the work area stop changing). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59976 --- programs/explorer/appbar.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/programs/explorer/appbar.c b/programs/explorer/appbar.c index 46a988ebbed..09d8ad1290c 100644 --- a/programs/explorer/appbar.c +++ b/programs/explorer/appbar.c @@ -111,7 +111,7 @@ static void appbar_cliprect( HWND hwnd, RECT *rect ) struct appbar_data* data; LIST_FOR_EACH_ENTRY(data, &appbars, struct appbar_data, entry) { - if (data->hwnd == hwnd) + if (hwnd != NULL && data->hwnd == hwnd) { /* we only care about appbars that were added before this one */ return; @@ -138,6 +138,26 @@ static void appbar_cliprect( HWND hwnd, RECT *rect ) } } +/* update the system work area rectangle to exclude the taskbar and appbars + * (affects what part of the screen maximized windows cover for example) + */ +static void update_work_area(void) +{ + RECT rc = { 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) }; + + /* When not running in desktop mode, don't set the work area in order to + * avoid interfering with the non-WINE desktop environment's window + * management. (See for example freedesktop's _NET_WORKAREA.) + */ + if (get_taskbar_height() == 0) + return; + + appbar_cliprect( NULL, &rc ); + SystemParametersInfoW( SPI_SETWORKAREA, 0, &rc, 0 ); + + /* TODO: move and resize existing windows to fit the new work area */ +} + static UINT_PTR handle_appbarmessage(DWORD msg, struct appbar_data_msg *abd) { struct appbar_data* data; @@ -172,6 +192,8 @@ static UINT_PTR handle_appbarmessage(DWORD msg, struct appbar_data_msg *abd) send_poschanged(hwnd); free( data ); + + update_work_area(); } else WARN( "removing hwnd %p not on the list\n", hwnd ); return TRUE; @@ -197,6 +219,8 @@ static UINT_PTR handle_appbarmessage(DWORD msg, struct appbar_data_msg *abd) data->edge = abd->uEdge; data->rc = abd->rc; data->space_reserved = TRUE; + + update_work_area(); } else { @@ -334,4 +358,6 @@ void initialize_appbar(void) data->space_reserved = TRUE; list_add_tail(&appbars, &data->entry); + + update_work_area(); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11699