Default window size with shadows is wrong on X11
Steps to reproduce
- Create a window with default size on X11
- observe the actual size
Current behavior
The current behavior is that the default size of the window is wrong on X11. That is, it depends on the size of the shadow. The bigger the shadow - the bigger is the Window, the smaller the shadow - the closer it is to the correct value. This isn't an issue on Wayland, so this means that all windows are at an incorrect size on X11 if it was designed for the correct size in mind.
For example, for such a window
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0`"/>
<template class="DefaultSizeExampleWindow" parent="GtkApplicationWindow">
<property name="default-width">600</property>
<property name="default-height">300</property>
<property name="title">Hello, World!</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header_bar"></object>
</child>
<child>
<object class="GtkLabel" id="label">
<property name="label">Hello, World!</property>
<property name="visible">True</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="2"/>
</attributes>
</object>
</child>
</template>
</interface>
It should be 600x300, but apparently with legacy shadows on X11 it is 652x352
. However more importantly,
it is different than on wayland.
The most visible example of this is the new Libadwaita shadows, which are significantly bigger than before,
which make this issue much more noticable and makes libadwaita apps quite broken on X11 (as default window sizes will be designed for how it behaves on Wayland, leaving X11 users with a pretty broken experience with oversized windows).
Subclasses of GtkWindow like AdwWindow are also affected.
As you can see, when the shadows are big, there is a large difference between X11 and Wayland.
Also for context, how much shadows can change the size of the window compared to small shadows. with small shadows on X11:
Expected outcome
That the window default size correctly calculates the shadow area, and behaves on X11 like it does on Wayland. The size of the css shadow should have no affect on the default size of the window.
Version information
- Which version of GTK you are using - Happens both on versions in org.gnome.Platform//master and org.gnome.Platform//40