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.
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/desktop.c | 14 ++++++-------- programs/explorer/systray.c | 26 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index fb59258ad36..31ead3c57e8 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -911,7 +911,7 @@ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, un return found; }
-static BOOL get_default_enable_shell( const WCHAR *name ) +static BOOL get_default_enable_shell( const WCHAR *name, BOOL using_root ) { HKEY hkey; BOOL found = FALSE; @@ -925,8 +925,8 @@ static BOOL get_default_enable_shell( const WCHAR *name ) found = TRUE; RegCloseKey( hkey ); } - /* Default off, except for the magic desktop name "shell" */ - if (!found) result = (lstrcmpiW( name, L"shell" ) == 0); + /* Default on for virtual desktop, off otherwise, except for the magic desktop name "shell" */ + if (!found) result = using_root ? (lstrcmpiW( name, L"shell" ) == 0) : TRUE; return result; }
@@ -1176,9 +1176,6 @@ void manage_desktop( WCHAR *arg ) if (!get_default_desktop_size( name, &width, &height )) width = height = 0; }
- if (name) enable_shell = get_default_enable_shell( name ); - show_systray = get_default_show_systray( name ); - UuidCreate( &guid ); TRACE( "display guid %s\n", debugstr_guid(&guid) ); load_graphics_driver( driver, &guid ); @@ -1197,6 +1194,9 @@ void manage_desktop( WCHAR *arg ) SetThreadDesktop( desktop ); }
+ if (name) enable_shell = get_default_enable_shell( name, using_root ); + show_systray = get_default_show_systray( name ); + /* create the desktop window */ hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, &guid ); @@ -1221,8 +1221,6 @@ void manage_desktop( WCHAR *arg ) initialize_display_settings( width, height ); initialize_appbar();
- if (using_root) enable_shell = FALSE; - initialize_systray( using_root, enable_shell, show_systray ); if (!using_root) initialize_launchers( hwnd );
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 );
Alex Henrie (@alexhenrie) commented about programs/explorer/desktop.c:
found = TRUE; RegCloseKey( hkey ); }
- /* Default off, except for the magic desktop name "shell" */
- if (!found) result = (lstrcmpiW( name, L"shell" ) == 0);
- /* Default on for virtual desktop, off otherwise, except for the magic desktop name "shell" */
- if (!found) result = using_root ? (lstrcmpiW( name, L"shell" ) == 0) : TRUE;
I don't quite understand what this means. If the virtual desktop is disabled, how can the desktop name be "shell" instead of "root"? Couldn't this be simplified to just `result = !using_root`? Moreover, is it a good idea to start turning on the shell by default, since clicking the Maximize button on a window will obscure the taskbar?
Thanks for bearing with me. There may well be good answers to all of those questions and I am just ignorant.
On Tue Aug 27 17:07:40 2024 +0000, Alex Henrie wrote:
I don't quite understand what this means. If the virtual desktop is disabled, how can the desktop name be "shell" instead of "root"? Couldn't this be simplified to just `result = !using_root`? Moreover, is it a good idea to start turning on the shell by default, since clicking the Maximize button on a window will obscure the taskbar? Thanks for bearing with me. There may well be good answers to all of those questions and I am just ignorant.
I have no idea, I'm just keeping the current behavior but I don't know what this shell desktop is about and yes, starting explorer with /desktop= now usually starts a virtual desktop mode.
Maybe it's been broken with the recent virtual desktop / systray changes. The only reference about it I can find is some wineandroid related feature.
I'm not sure to understand what you mean with enabled by default? It's enabled by default in virtual desktop mode, which shouldn't maximize the windows over the taskbar or am I missing something?
On Tue Aug 27 17:30:52 2024 +0000, Rémi Bernon wrote:
I have no idea, I'm just keeping the current behavior but I don't know what this shell desktop is about and yes, starting explorer with /desktop= now usually starts a virtual desktop mode. Maybe it's been broken with the recent virtual desktop / systray changes. The only reference about it I can find is some wineandroid related feature. I'm not sure to understand what you mean with enabled by default? It's enabled by default in virtual desktop mode, which shouldn't maximize the windows over the taskbar or am I missing something?
Before commit 118810ad3bac91bfeea81e4408059d48c158e8c5, `./wine explorer /desktop=foobar notepad` opened Wine Notepad in a virtual desktop without a taskbar. If you wanted the taskbar, you had to either set `EnableShell` in the registry or set the name of the virtual desktop to "shell", for example `./wine explorer /desktop=shell notepad`. This feature has been documented for many years in the [Wine Wiki](https://gitlab.winehq.org/wine/wine/-/wikis/Commands/explorer). I did not notice until this evening that the behavior has changed; it seems that ever since the aforementioned commit, the taskbar is shown by default in all virtual desktops and not just the one named "shell".
As far as maximizing, if you click the Maximize button on Wine Notepad in a virtual desktop, Wine Notepad will fill the entire virtual desktop, covering the taskbar. That's very different from Windows, where no window can overlap over the taskbar. My argument was that we might not want to turn on Wine's taskbar by default if it behaves so differently from Windows. However, it doesn't really matter to me whether or not the taskbar is shown by default, and the default has already been changed.
Assuming that we are going to keep the new default, we should remove all references to the no-longer-special "shell" desktop. We could, however, go back to the old default and make "shell" special again. I do not have a strong preference.