[PATCH] explorer: add registry support to disable Virtual Desktop systray

Rob Walker bob.mt.wya at gmail.com
Tue Jul 5 15:52:35 CDT 2016


Workaround for https://bugs.winehq.org/show_bug.cgi?id=40828

AvP Classic tested on Gentoo/Linux and the reported issue is not present
when the newly supported/added Wine Taskbar registry setting is disabled.

Tested on Gentoo/Linux

Signed-off-by: Rob Walker <bob.mt.wya at gmail.com>
---
 programs/explorer/desktop.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index d306bb9..3d2bb49 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -773,6 +773,31 @@ static BOOL get_default_enable_shell( const WCHAR *name )
     return result;
 }
 
+static BOOL get_default_systray_state(void)
+{
+    static const WCHAR taskbarW[] = {'T','a','s','k','b','a','r',0};
+    static const WCHAR disabledW[] = {'d','i','s','a','b','l','e','d',0};
+    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};
+    HKEY hkey;
+    WCHAR buffer[64];
+    DWORD size = sizeof(buffer);
+    BOOL result = TRUE;
+
+    /* @@ Wine registry key: HKCU\Software\Wine\Explorer\Desktops */
+    if (!RegOpenKeyW( HKEY_CURRENT_USER, desktop_keyW, &hkey ))
+    {
+        /* Default enabled, except for when the taskbar value is disabled */
+        if (!RegQueryValueExW( hkey, taskbarW, 0, NULL, &buffer, &size )) {
+            result = (lstrcmpiW( buffer, disabledW ) != 0);
+            TRACE( "found key %s with value %s\n", debugstr_w(taskbarW), debugstr_w(buffer) );
+        }
+        RegCloseKey( hkey );
+    }
+    return result;
+}
+
 static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
 {
     static const WCHAR device_keyW[] = {
@@ -916,6 +941,7 @@ void manage_desktop( WCHAR *arg )
     WCHAR *p = arg;
     const WCHAR *name = NULL;
     BOOL enable_shell = FALSE;
+    BOOL enable_systray = TRUE;
 
     /* get the rest of the command line (if any) */
     while (*p && !isspace(*p)) p++;
@@ -989,9 +1015,17 @@ void manage_desktop( WCHAR *arg )
             HMODULE shell32;
             void (WINAPI *pShellDDEInit)( BOOL );
 
-            if (using_root) enable_shell = FALSE;
+            if (using_root)
+            {
+                enable_shell = FALSE;
+                initialize_systray( graphics_driver, using_root, enable_shell );
+            }
+            else
+            {
+                enable_systray=get_default_systray_state();
+                initialize_systray( graphics_driver, !enable_systray, enable_shell );
+            }
 
-            initialize_systray( graphics_driver, using_root, enable_shell );
             if (!using_root) initialize_launchers( hwnd );
 
             if ((shell32 = LoadLibraryA( "shell32.dll" )) &&
-- 
2.9.0




More information about the wine-patches mailing list