explorer: Add a registry setting to always show the systray.

This commit is contained in:
Vincent Povirk 2013-12-16 16:17:21 -06:00 committed by Alexandre Julliard
parent 71fc31db00
commit 913cb83622
3 changed files with 34 additions and 5 deletions

View File

@ -638,6 +638,26 @@ 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 const WCHAR desktop_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'E','x','p','l','o','r','e','r','\\',
'D','e','s','k','t','o','p','s',0};
static const WCHAR enable_shellW[] = {'E','n','a','b','l','e','S','h','e','l','l',0};
HKEY hkey;
BOOL result = FALSE;
DWORD size = sizeof(result);
/* @@ Wine registry key: HKCU\Software\Wine\Explorer\Desktops */
if (!RegOpenKeyW( HKEY_CURRENT_USER, desktop_keyW, &hkey ))
{
if (RegGetValueW( hkey, name, enable_shellW, RRF_RT_REG_DWORD, NULL, &result, &size ))
result = FALSE;
RegCloseKey( hkey );
}
return result;
}
static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
{
static const WCHAR device_keyW[] = {
@ -780,6 +800,7 @@ void manage_desktop( WCHAR *arg )
WCHAR *cmdline = NULL, *driver = NULL;
WCHAR *p = arg;
const WCHAR *name = NULL;
BOOL enable_shell = FALSE;
/* get the rest of the command line (if any) */
while (*p && !isspace(*p)) p++;
@ -809,6 +830,9 @@ 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 && width && height)
{
if (!(desktop = CreateDesktopW( name, NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL )))
@ -850,7 +874,9 @@ void manage_desktop( WCHAR *arg )
HMODULE shell32;
void (WINAPI *pShellDDEInit)( BOOL );
initialize_systray( graphics_driver, using_root );
if (using_root) enable_shell = FALSE;
initialize_systray( graphics_driver, using_root, enable_shell );
if (!using_root) initialize_launchers( hwnd );
if ((shell32 = LoadLibraryA( "shell32.dll" )) &&

View File

@ -22,7 +22,7 @@
#define __WINE_EXPLORER_PRIVATE_H
extern void manage_desktop( WCHAR *arg );
extern void initialize_systray( HMODULE graphics_driver, BOOL using_root );
extern void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL enable_shell );
extern void initialize_appbar(void);
extern void do_startmenu( HWND owner );
extern LRESULT menu_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);

View File

@ -86,7 +86,7 @@ static unsigned int alloc_displayed;
static unsigned int nb_displayed;
static struct icon **displayed; /* array of currently displayed icons */
static BOOL hide_systray;
static BOOL hide_systray, enable_shell;
static int icon_cx, icon_cy, tray_width;
static struct icon *balloon_icon;
@ -352,7 +352,7 @@ static BOOL hide_icon(struct icon *icon)
invalidate_icons( icon->display, nb_displayed );
icon->display = -1;
if (!nb_displayed) ShowWindow( tray_window, SW_HIDE );
if (!nb_displayed && !enable_shell) ShowWindow( tray_window, SW_HIDE );
update_balloon( icon );
update_tooltip_position( icon );
@ -651,7 +651,7 @@ static void get_system_text_size( const WCHAR *text, SIZE *size )
}
/* this function creates the listener window */
void initialize_systray( HMODULE graphics_driver, BOOL using_root )
void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enable_shell )
{
WNDCLASSEXW class;
static const WCHAR classname[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0};
@ -664,6 +664,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root )
icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2*ICON_BORDER;
icon_cy = GetSystemMetrics( SM_CYSMICON ) + 2*ICON_BORDER;
hide_systray = using_root;
enable_shell = arg_enable_shell;
/* register the systray listener window class */
ZeroMemory(&class, sizeof(class));
@ -699,5 +700,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root )
start_button = CreateWindowW( button_class, start_label, WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
0, 0, start_text_size.cx + 8, icon_cy, tray_window, 0, 0, 0 );
if (enable_shell && !hide_systray) ShowWindow( tray_window, SW_SHOWNA );
if (hide_systray) do_hide_systray();
}