From f48cc2c47fc41ada72a7a3213740d7c585a7d616 Mon Sep 17 00:00:00 2001 From: inkeliz Date: Mon, 10 Jun 2024 20:49:02 +0100 Subject: [PATCH] app: [Windows] use the app ID for the window class registry We're about to send messages between multiple instances of the same program, and we need something to distinguish Gio programs. Use the app ID. Signed-off-by: inkeliz Signed-off-by: Elias Naur --- app/os_windows.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/os_windows.go b/app/os_windows.go index 02a023c1..40369bba 100644 --- a/app/os_windows.go +++ b/app/os_windows.go @@ -132,13 +132,19 @@ func initResources() error { } resources.cursor = c icon, _ := windows.LoadImage(hInst, iconID, windows.IMAGE_ICON, 0, 0, windows.LR_DEFAULTSIZE|windows.LR_SHARED) + + appid, err := syscall.UTF16PtrFromString(ID) + if err != nil { + return err + } + wcls := windows.WndClassEx{ CbSize: uint32(unsafe.Sizeof(windows.WndClassEx{})), Style: windows.CS_HREDRAW | windows.CS_VREDRAW | windows.CS_OWNDC, LpfnWndProc: syscall.NewCallback(windowProc), HInstance: hInst, HIcon: icon, - LpszClassName: syscall.StringToUTF16Ptr("GioWindow"), + LpszClassName: appid, } cls, err := windows.RegisterClassEx(&wcls) if err != nil {