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

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