Open
Description
Describe the bug
Windows: an app freezes forever (not responding) if ContentScale/DevicePixelRatio is equal or great than 1.5
How to reproduce
- configure the Cogent Core for Windows 64 bit;
- try to apply custom scaling options in
Settings
on Windows, for instance, use:150%
factor; - or connect to Windows machine from macOS via a
Windows App
(Microsoft Remote Desktop) with an optionOptimize for Retina displays
turned on; - try to run the
hello world
; - open either
Settings
orInspector
.
my environment:
- Go: go1.23.5 windows/amd64
- Zig: 0.14.0-dev.2851+b074fb7dd
- Windows 10 (22H2) 64 bit
useful commands:
- go install cogentcore.org/core/cmd/core@main
- core setup
- go env -w CGO_ENABLED=1 (by default this option is turned off on WIndows 10)
- go env -w CC="C:\zig0.14\zig cc"
- go env -w CXX="C:\zig0.14\zig c++"
- go env -w CGO_LDFLAGS="-O2 -g -lunwind" (this is important, on Windows 10 64 bit we must add -lunwind)
Example code
package main
import (
"cogentcore.org/core/core"
"cogentcore.org/core/events"
)
func main() {
b := core.NewBody()
btn := core.NewButton(b).SetText("Message")
btn.OnClick(func(e events.Event) {
core.MessageDialog(btn, "Hello, World!", "Message")
})
b.RunMainWindow()
}
Relevant output
An app title + (Not Responding)
Platform
Windows
Updates
20250129
Why it happens?
It happens when you connect to remote Windows machine from macOS via remote desktop client and then Windows OS sees Retina display. And then the Core
gets into deadlock because of following functions:
- func (w *Window) ConstrainFrame(topOnly bool) styles.Sides[int]
- func (w *Window) SetGeometry(fullscreen bool, pos, size image.Point, screen *system.Screen)
- func (a *App) RunOnMain(f func())
- func (a *App) MainLoop() for desktop
this pr partially fixes an issue above (#1462), but new windows are big as twice as needed.
to reproduce this issue you also have to delete following directory C:\Users\<user_name>\AppData\Roaming\Cogent Core
. An app might work if it could find some "appropriate" settings (1 of 100 chance, optimist).
20250131
this pr is not relevant (#1462).
Metadata
Metadata
Assignees
Type
Projects
Status
Todo