[gtk: 1/2] gdk: Subtract base size when checking aspect ratio
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gdk: Subtract base size when checking aspect ratio
- Date: Fri, 14 Feb 2020 13:20:33 +0000 (UTC)
commit b36258f2042d610e59a04dde7eaad0aa37a249bf
Author: Vlad Zahorodnii <vlad zahorodnii kde org>
Date: Sun Jan 19 01:56:35 2020 +0200
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
gdk/gdksurface.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 8424576238..dbc709bea6 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]