~eliasnaur/gio-patches

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

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

 1 files changed, 4 insertions(+), 2 deletions(-)
#784920 apple.yml success
#784921 freebsd.yml success
#784922 linux.yml success
#784923 openbsd.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/33169/mbox | git am -3
Learn more about email & git

[PATCH gio] app: [Wayland] scale min/max window size correctly Export this patch

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>
---
 app/os_wayland.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/os_wayland.go b/app/os_wayland.go
index 696d7107..629ded70 100644
--- a/app/os_wayland.go
+++ b/app/os_wayland.go
@@ -1008,11 +1008,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 {
-- 
2.36.1
gio/patches: SUCCESS in 21m30s

[app: [Wayland] scale min/max window size correctly][0] from [Chris Waldon][1]

[0]: https://lists.sr.ht/~eliasnaur/gio-patches/patches/33169
[1]: mailto:christopher.waldon.dev@gmail.com

✓ #784921 SUCCESS gio/patches/freebsd.yml https://builds.sr.ht/~eliasnaur/job/784921
✓ #784923 SUCCESS gio/patches/openbsd.yml https://builds.sr.ht/~eliasnaur/job/784923
✓ #784922 SUCCESS gio/patches/linux.yml   https://builds.sr.ht/~eliasnaur/job/784922
✓ #784920 SUCCESS gio/patches/apple.yml   https://builds.sr.ht/~eliasnaur/job/784920
Thank you, merged.

Elias