From: Rémi Bernon rbernon@codeweavers.com
With a global fallback setting under HKCU\Software\Wine\Explorer.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56243 --- programs/explorer/desktop.c | 37 +++++++++++++++++++++++++--- programs/explorer/explorer_private.h | 2 +- programs/explorer/systray.c | 4 ++- 3 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 9a58f13d887..65a89862190 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -841,6 +841,35 @@ static BOOL get_default_enable_shell( const WCHAR *name ) return result; }
+static BOOL get_default_show_systray( const WCHAR *name ) +{ + HKEY hkey; + BOOL found = FALSE; + BOOL result; + DWORD size = sizeof(result); + + /* @@ Wine registry key: HKCU\Software\Wine\Explorer\Desktops */ + if (name && !RegOpenKeyW( HKEY_CURRENT_USER, L"Software\Wine\Explorer\Desktops", &hkey )) + { + if (!RegGetValueW( hkey, name, L"ShowSystray", RRF_RT_REG_DWORD, NULL, &result, &size )) + found = TRUE; + RegCloseKey( hkey ); + } + + /* Try again with a global Explorer setting */ + /* @@ Wine registry key: HKCU\Software\Wine\Explorer */ + if (!found && !RegOpenKeyW( HKEY_CURRENT_USER, L"Software\Wine\Explorer", &hkey )) + { + if (!RegGetValueW( hkey, NULL, L"ShowSystray", RRF_RT_REG_DWORD, NULL, &result, &size )) + found = TRUE; + RegCloseKey( hkey ); + } + + /* Default on */ + if (!found) result = TRUE; + return result; +} + static void load_graphics_driver( const WCHAR *driver, GUID *guid ) { static const WCHAR device_keyW[] = L"System\CurrentControlSet\Control\Video\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\0000"; @@ -1020,7 +1049,7 @@ void manage_desktop( WCHAR *arg ) WCHAR *cmdline = NULL, *driver = NULL; WCHAR *p = arg; const WCHAR *name = NULL; - BOOL enable_shell = FALSE; + BOOL enable_shell = FALSE, show_systray = TRUE; void (WINAPI *pShellDDEInit)( BOOL ) = NULL; HMODULE shell32; HANDLE thread; @@ -1054,8 +1083,8 @@ 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 ); + 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) ); @@ -1101,7 +1130,7 @@ void manage_desktop( WCHAR *arg )
if (using_root) enable_shell = FALSE;
- initialize_systray( using_root, enable_shell ); + initialize_systray( using_root, enable_shell, show_systray ); if (!using_root) initialize_launchers( hwnd );
if ((shell32 = LoadLibraryW( L"shell32.dll" )) && diff --git a/programs/explorer/explorer_private.h b/programs/explorer/explorer_private.h index 34aa1cf046b..0639e41c9c6 100644 --- a/programs/explorer/explorer_private.h +++ b/programs/explorer/explorer_private.h @@ -22,7 +22,7 @@ #define __WINE_EXPLORER_PRIVATE_H
extern void manage_desktop( WCHAR *arg ); -extern void initialize_systray( BOOL using_root, BOOL enable_shell ); +extern void initialize_systray( BOOL using_root, BOOL enable_shell, BOOL show_systray ); extern void initialize_appbar(void); extern void handle_parent_notify( HWND hwnd, WPARAM wp ); extern void do_startmenu( HWND owner ); diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index b012d3ffe72..3b4e5bdc8ac 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -249,6 +249,7 @@ static void balloon_create_timer( struct icon *icon )
static BOOL show_balloon( struct icon *icon ) { + if (!show_systray) return FALSE; /* systray has been hidden */ if (icon->display == ICON_DISPLAY_HIDDEN) return FALSE; /* not displayed */ if (!icon->info_text[0]) return FALSE; /* no balloon */ balloon_icon = icon; @@ -1114,7 +1115,7 @@ void handle_parent_notify( HWND hwnd, WPARAM wp ) }
/* this function creates the listener window */ -void initialize_systray( BOOL using_root, BOOL arg_enable_shell ) +void initialize_systray( BOOL using_root, BOOL arg_enable_shell, BOOL arg_show_systray ) { RECT work_rect, primary_rect, taskbar_rect;
@@ -1125,6 +1126,7 @@ void initialize_systray( BOOL using_root, BOOL arg_enable_shell )
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;