app: [Wayland] scale min/max window size correctly

The xdg_toplevel expects the min/max window size in DP rather
than pixels. The scaling factor would be applied twice because
we supplied pixels that we scaled ourselves, resulting in windows
twice the expected size on HiDPI screens. This bug probably went
for so long without being detected because it only manifests if
you actually set a minimum or maximum size.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2022-06-21 15:24:31 -04:00
committed by Elias Naur
parent 55c96adb91
commit 6a6ddc3f19
+4 -2
View File
@@ -1001,11 +1001,13 @@ func (w *window) Configure(options []Option) {
}
if prev.MinSize != cnf.MinSize {
w.config.MinSize = cnf.MinSize
C.xdg_toplevel_set_min_size(w.topLvl, C.int32_t(cnf.MinSize.X), C.int32_t(cnf.MinSize.Y))
scaled := cnf.MinSize.Div(w.scale)
C.xdg_toplevel_set_min_size(w.topLvl, C.int32_t(scaled.X), C.int32_t(scaled.Y))
}
if prev.MaxSize != cnf.MaxSize {
w.config.MaxSize = cnf.MaxSize
C.xdg_toplevel_set_max_size(w.topLvl, C.int32_t(cnf.MaxSize.X), C.int32_t(cnf.MaxSize.Y))
scaled := cnf.MaxSize.Div(w.scale)
C.xdg_toplevel_set_max_size(w.topLvl, C.int32_t(scaled.X), C.int32_t(scaled.Y))
}
}
if cnf.Decorated != prev.Decorated {