Window size on high DPI display unexpectedly changes on first focus loss when using Wayland
I'm running a bog standard Debian Bookworm installation using Gnome 43.4 with multiple monitors: main "high DPI" (scale 2) one and 2 other "standard DPI". When a new window using GTK Wayland backend is opened on the high DPI monitor, then, whatever is its initial size, when it first loses focus due to switching to another application, its size is roughly halved, which basically makes using any non-maximized windows on this monitor impossible as you always have to resize them back to some reasonable size.
This does not happen if a window is opened on one of the standard DPI monitors and then moved to the high DPI one. It also doesn't happen when using x11 backend (GDK_BACKEND=x11
). It does happen with both GTK 3 and GTK 4, including Gnome own standard applications, i.e. AFAICS it happens with any GTK program but I attach a small example based on GTK "hello world" with some code for monitoring the window size added just in case it can be useful: helloworld.c
Current behavior
With the attached example, the output when launching the program and then pressing Alt-Tab to switch to another window (using mouse works too) is:
alloc: 252*289
alloc: 252*289
alloc: 252*289
alloc: 252*289
alloc: 252*289
alloc: 169*170
alloc: 169*170
alloc: 169*170
alloc: 169*170
alloc: 169*170
for the GTK 3 version and
size: 200*200
size: 200*200
size: 124*100
size: 124*100
size: 124*100
size: 124*100
for the GTK 4 one.
Expected outcome
It would be expected for the size not to change on its own.
Version information
I see this with both GTK 3.24.37 and 4.8.3.