Blame SOURCES/0001-gdk-x11-Clamp-window-size-both-when-creating-and-res.patch

0d24c4
From 9dd198e53f53a9c2e4a791ec5b67b3ffa7b3900b Mon Sep 17 00:00:00 2001
0d24c4
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
0d24c4
Date: Tue, 6 Aug 2019 11:13:55 +0200
0d24c4
Subject: [PATCH] gdk/x11: Clamp window size both when creating and resizing
0d24c4
0d24c4
We clamp to 32767 when creating a new X11 GdkWindow due to larger sizes
0d24c4
not being supported, but still try to resize to larger when
0d24c4
gdk_window_resize() is called. Fix this by clamping in both places.
0d24c4
0d24c4
This fixes an issue in mutter where ridiculously sized Java windows
0d24c4
would not show up.
0d24c4
---
0d24c4
 gdk/x11/gdkwindow-x11.c | 32 ++++++++++++++++++++++----------
0d24c4
 1 file changed, 22 insertions(+), 10 deletions(-)
0d24c4
0d24c4
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
0d24c4
index f92a146be5..4de412315d 100644
0d24c4
--- a/gdk/x11/gdkwindow-x11.c
0d24c4
+++ b/gdk/x11/gdkwindow-x11.c
0d24c4
@@ -1003,6 +1003,25 @@ connect_frame_clock (GdkWindow *window)
0d24c4
     }
0d24c4
 }
0d24c4
 
0d24c4
+static void
0d24c4
+clamp_window_size (GdkWindow *window,
0d24c4
+                   gint      *width,
0d24c4
+                   gint      *height)
0d24c4
+{
0d24c4
+  GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
0d24c4
+
0d24c4
+  if (*width * impl->window_scale > 32767 ||
0d24c4
+      *height * impl->window_scale > 32767)
0d24c4
+    {
0d24c4
+      g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
0d24c4
+
0d24c4
+      if (*width * impl->window_scale > 32767)
0d24c4
+        *width = 32767 / impl->window_scale;
0d24c4
+      if (*height  * impl->window_scale > 32767)
0d24c4
+        *height = 32767 /  impl->window_scale;
0d24c4
+    }
0d24c4
+}
0d24c4
+
0d24c4
 void
0d24c4
 _gdk_x11_display_create_window_impl (GdkDisplay    *display,
0d24c4
                                      GdkWindow     *window,
0d24c4
@@ -1101,16 +1120,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay    *display,
0d24c4
       class = InputOnly;
0d24c4
     }
0d24c4
 
0d24c4
-  if (window->width * impl->window_scale > 32767 ||
0d24c4
-      window->height * impl->window_scale > 32767)
0d24c4
-    {
0d24c4
-      g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
0d24c4
-
0d24c4
-      if (window->width * impl->window_scale > 32767)
0d24c4
-        window->width = 32767 / impl->window_scale;
0d24c4
-      if (window->height  * impl->window_scale > 32767)
0d24c4
-        window->height = 32767 /  impl->window_scale;
0d24c4
-    }
0d24c4
+  clamp_window_size (window, &window->width, &window->height);
0d24c4
 
0d24c4
   impl->unscaled_width = window->width * impl->window_scale;
0d24c4
   impl->unscaled_height = window->height * impl->window_scale;
0d24c4
@@ -1909,6 +1919,8 @@ gdk_window_x11_move_resize (GdkWindow *window,
0d24c4
     window_x11_move (window, x, y);
0d24c4
   else
0d24c4
     {
0d24c4
+      clamp_window_size (window, &width, &height);
0d24c4
+
0d24c4
       if (with_move)
0d24c4
         window_x11_move_resize (window, x, y, width, height);
0d24c4
       else
0d24c4
-- 
0d24c4
2.21.0
0d24c4