-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes fyne fails to setup dark mode #4758
Comments
Sometimes this also happens here. Even though the theme is correctly set in the 'fyne elements', the Windows' own window top bar remains in light theme, as in the print below (exactly when it occurred). It throws the same error 0x800703e6. The right behavior for the window would be: I read the error HRESULT =0x800703e6 represents - ERROR_NOACCESS. A description of the code reveals the message invalid access to memory location. Perhaps a possibility is that the window fyne tries to set to dark mode isn't fully initialized yet? I take this opportunity to ask you: Were you using the SystemTray or SystemTrayMenu API when this occurred? |
I were using none of them. At least on my machine the theme is still applied successfully, and I get the following error description: |
Any error message logged? |
|
OMG windows. I wonder if there is something in the thread handling where we set that up... possibly we knocked it into a goroutine? |
Seems not: runOnMain(func() {
w.setDarkMode() Perhaps there is something in our windows call that is not correct for all systems or at all times? dwm := syscall.NewLazyDLL("dwmapi.dll")
setAtt := dwm.NewProc("DwmSetWindowAttribute")
ret, _, err := setAtt.Call(uintptr(unsafe.Pointer(hwnd)), // window handle
20, // DWMWA_USE_IMMERSIVE_DARK_MODE
uintptr(unsafe.Pointer(&dark)), // on or off
8) // sizeof(darkMode) |
I have a vague recollection of this being a thing on old versions of Windows 10 (or at least something similar). Is the system updated to the latest version? |
Checklist
Describe the bug
Happens randomly, with error code 0x800703e6.
Dark mode, however, is still set successfully.
How to reproduce
Use
go run .
until it appears. Depends on your luck I guess.Screenshots
No response
Example code
Fyne version
2.4.4
Go compiler version
1.22.0
Operating system and version
Windows 10
Additional Information
Modified
internal/driver/glfw/window_windows.go
to show the error code.The text was updated successfully, but these errors were encountered: