[PATCH] winex11: Allow user to set WM_CLASS

Nicholas Little arealityfarbetween at googlemail.com
Sun Dec 20 18:00:29 CST 2020


This commit allows the user to optionally set the WM_CLASS by setting an
environment variable WINEWMCLASS with the aim of allowing him to ensure
desktop environments can correctly identify wine windows, unfortunately
the executable filename isn't always sufficient as some programs share a
common executable name.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50095
---
 dlls/winex11.drv/window.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 457173964eb..6b87166c830 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -837,6 +837,7 @@ static void set_initial_wm_hints( Display *display, Window window )
     Atom protocols[3];
     Atom dndVersion = WINE_XDND_VERSION;
     XClassHint *class_hints;
+    char *wine_wm_class;
 
     /* wm protocols */
     i = 0;
@@ -849,8 +850,9 @@ static void set_initial_wm_hints( Display *display, Window window )
     /* class hints */
     if ((class_hints = XAllocClassHint()))
     {
+        wine_wm_class = getenv( "WINEWMCLASS" );
         class_hints->res_name = process_name;
-        class_hints->res_class = process_name;
+        class_hints->res_class = wine_wm_class ? wine_wm_class : process_name;
         XSetClassHint( display, window, class_hints );
         XFree( class_hints );
     }
-- 
2.26.2




More information about the wine-devel mailing list