gdk: Subtract base size when checking aspect ratio
According to the ICCCM spec [1], one should subtract the base size from the window size before checking that the aspect ratio falls in range. This change fixes shrinking Firefox Picture-in-Picture windows when running KDE Plasma (with KWin as the window manager). [1] https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.3
This commit is contained in:
committed by
Vlad Zahorodnii
parent
a463dccd81
commit
b36258f204
@@ -1726,6 +1726,16 @@ gdk_surface_constrain_size (GdkGeometry *geometry,
|
||||
{
|
||||
gint delta;
|
||||
|
||||
if (flags & GDK_HINT_BASE_SIZE)
|
||||
{
|
||||
width -= base_width;
|
||||
height -= base_height;
|
||||
min_width -= base_width;
|
||||
min_height -= base_height;
|
||||
max_width -= base_width;
|
||||
max_height -= base_height;
|
||||
}
|
||||
|
||||
if (geometry->min_aspect * height > width)
|
||||
{
|
||||
delta = FLOOR (height - width / geometry->min_aspect, yinc);
|
||||
@@ -1751,6 +1761,12 @@ gdk_surface_constrain_size (GdkGeometry *geometry,
|
||||
height += delta;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & GDK_HINT_BASE_SIZE)
|
||||
{
|
||||
width += base_width;
|
||||
height += base_height;
|
||||
}
|
||||
}
|
||||
|
||||
#undef FLOOR
|
||||
|
||||
Reference in New Issue
Block a user