diff --git a/internal/glfw/glfw_windows.go b/internal/glfw/glfw_windows.go index 5d9594574..a6bd073ae 100644 --- a/internal/glfw/glfw_windows.go +++ b/internal/glfw/glfw_windows.go @@ -253,6 +253,11 @@ func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback) { return prev } +func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) { + glfwDLL.call("glfwSetWindowSizeLimits", w.w, uintptr(minw), uintptr(minh), uintptr(maxw), uintptr(maxh)) + panicError() +} + func (w *Window) SetIcon(images []image.Image) { gimgs := make([]glfwImage, len(images)) defer runtime.KeepAlive(gimgs) diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index da2bc6a9e..a95c6b415 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -649,7 +649,11 @@ func (u *UserInterface) deviceScaleFactor() float64 { return devicescale.GetAt(cm.x, cm.y) } } - return devicescale.GetAt(currentMonitor(u.window).GetPos()) + m := u.initMonitor + if u.window != nil { + m = currentMonitor(u.window) + } + return devicescale.GetAt(m.GetPos()) } func init() {