The option is on by default with the virtual desktop, off by default otherwise, but can be forced on/off in either case, letting it hide the taskbar in virtual desktop mode too.
The standalone systray window still uses the separate ShowSystray option which can be enabled when EnableShell is off. When EnableShell is on, the systray area will always be visible in the taskbar.
-- v2: explorer: Use the EnableShell option to show or hide the taskbar.
From: Rémi Bernon rbernon@codeweavers.com
The option is on by default with the virtual desktop, off by default otherwise, but can be forced on/off in either case, letting it hide the taskbar in virtual desktop mode too.
The standalone systray window still uses the separate ShowSystray option which can be enabled when EnableShell is off. When EnableShell is on, the systray area will always be visible in the taskbar. --- programs/explorer/systray.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 275c683e3ff..873f21f38fd 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -102,7 +102,10 @@ static HWND tray_window;
static unsigned int nb_displayed;
-static BOOL show_systray = TRUE, enable_shell, enable_taskbar; +static BOOL enable_taskbar; /* show full taskbar, with dedicated systray area */ +static BOOL show_systray; /* show a standalone systray window */ +static BOOL enable_dock; /* allow systray icons to be docked in the host systray */ + static int icon_cx, icon_cy, tray_width, tray_height; static int start_button_width, taskbar_button_width; static WCHAR start_label[50]; @@ -604,7 +607,7 @@ static void systray_remove_icon( struct icon *icon ) SetWindowPos( ptr->window, 0, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER ); }
- if (!--nb_displayed && !enable_shell) do_hide_systray(); + if (!--nb_displayed && !enable_taskbar) do_hide_systray(); TRACE( "removed %u now %d icons\n", icon->id, nb_displayed );
icon->display = ICON_DISPLAY_HIDDEN; @@ -619,7 +622,7 @@ static BOOL show_icon(struct icon *icon)
if (icon->display != ICON_DISPLAY_HIDDEN) return TRUE; /* already displayed */
- if (!enable_taskbar) + if (enable_dock) { DWORD old_exstyle = GetWindowLongW( icon->window, GWL_EXSTYLE );
@@ -651,8 +654,8 @@ static BOOL hide_icon(struct icon *icon)
if (icon->display == ICON_DISPLAY_HIDDEN) return TRUE; /* already hidden */
- if (!enable_taskbar && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_REMOVE, 0, 0, - NULL, NtUserSystemTrayCall, FALSE )) + if (enable_dock && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_REMOVE, 0, 0, + NULL, NtUserSystemTrayCall, FALSE )) { icon->display = ICON_DISPLAY_HIDDEN; icon->layered = FALSE; @@ -692,7 +695,7 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid ) InvalidateRect( icon->window, NULL, TRUE ); else if (icon->layered) paint_layered_icon( icon ); - else if (!enable_taskbar) + else if (enable_dock) NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_CLEAR, 0, 0, NULL, NtUserSystemTrayCall, FALSE ); } @@ -909,7 +912,7 @@ static void add_taskbar_button( HWND hwnd ) { struct taskbar_button *win;
- if (!enable_taskbar || !show_systray) return; + if (!enable_taskbar) return;
/* ignore our own windows */ if (hwnd) @@ -1064,7 +1067,7 @@ static LRESULT WINAPI shell_traywnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LP
case WM_DISPLAYCHANGE: if (!show_systray) do_hide_systray(); - else if (!nb_displayed && !enable_shell) do_hide_systray(); + else if (!nb_displayed && !enable_taskbar) do_hide_systray(); else do_show_systray(); break;
@@ -1159,8 +1162,8 @@ void initialize_systray( BOOL using_root, BOOL arg_enable_shell, BOOL arg_show_s icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2*ICON_BORDER; icon_cy = GetSystemMetrics( SM_CYSMICON ) + 2*ICON_BORDER; show_systray = arg_show_systray; - enable_shell = arg_enable_shell; - enable_taskbar = enable_shell || !using_root; + enable_taskbar = arg_enable_shell; + enable_dock = using_root && arg_show_systray && !arg_enable_shell;
/* register the systray listener window class */ if (!RegisterClassExW( &shell_traywnd_class )) @@ -1176,6 +1179,9 @@ void initialize_systray( BOOL using_root, BOOL arg_enable_shell, BOOL arg_show_s
if (enable_taskbar) { + show_systray = FALSE; /* never use the dedicated systray window */ + enable_dock = FALSE; /* disable docking when taskbar is enabled */ + 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 );
On Wed Aug 28 05:40:56 2024 +0000, Rémi Bernon wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/6367/diffs?diff_id=128853&start_sha=984e1cb88494fc60e86d3254a8faf7d877f58c1d#ce22c7a18cb22fd4032a00c8133a393e55554648_929_928)
I don't think we should keep the new default if it's been changed recently, it wasn't really intentional. I've made some changes to restore the original behavior.
On Wed Aug 28 05:41:01 2024 +0000, Rémi Bernon wrote:
I don't think we should keep the new default if it's been changed recently, it wasn't really intentional. I've made some changes to restore the original behavior.
The new patch behaves more like I would expect, thanks! Could you please update the commit message to say that EnableShell is only on by default for the "shell" desktop? It would also be a good idea to put the line `Fixes: 118810ad3bac91bfeea81e4408059d48c158e8c5` at the bottom to let @mstefani know that the patch should probably be backported to Wine Stable.
The one weird thing I noticed is that with your patch, ShowSystray=0 prevents icons from appearing in the host taskbar (though it does not hide them in Wine's taskbar). That is a novel behavior not found in any previous version of Wine. I'm thinking that it would be best to keep the ShowSystray option restricted to controlling the floating systray. ShowSystray=0 would continue to support the use case where the user wants the pre-9.0 behavior: Display systray icons if there is a taskbar available, but hide them if they would have to be in a floating window. Later on we can add support for the NoTrayItemsDisplay registry setting that Windows has, which would be like ShowSystray but would hide the icons from the host taskbar and the Wine traskbar in addition to hiding the floating systray.
Alex Henrie (@alexhenrie) commented about programs/explorer/systray.c:
icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2*ICON_BORDER; icon_cy = GetSystemMetrics( SM_CYSMICON ) + 2*ICON_BORDER; show_systray = arg_show_systray;
- enable_shell = arg_enable_shell;
- enable_taskbar = enable_shell || !using_root;
- enable_taskbar = arg_enable_shell;
- enable_dock = using_root && arg_show_systray && !arg_enable_shell;
`&& !arg_enable_shell` can be omitted because [if using_root is true, arg_enable_shell is false](https://gitlab.winehq.org/wine/wine/-/blob/e3d2620bdf6f8e91a5ccf5904f256a55a...).