summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-13 21:08:32 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-08-13 21:08:32 +0000
commitf04d654ae74dabc9c1517e7a0d187ee12e43da05 (patch)
treef4dbcf93008f1a6540062fbefb16d9dbc95a35ba
parent7e8c4f9c682e7be63bd6a22b3ec6ba47c52d810b (diff)
parent9dd198e53f53a9c2e4a791ec5b67b3ffa7b3900b (diff)
downloadgtk+-f04d654ae74dabc9c1517e7a0d187ee12e43da05.tar.gz
Merge branch 'wip/clamp-x11-on-resize-too' into 'gtk-3-24'
gdk/x11: Clamp window size both when creating and resizing See merge request GNOME/gtk!1046
-rw-r--r--gdk/x11/gdkwindow-x11.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index f92a146be5..4de412315d 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -1003,6 +1003,25 @@ connect_frame_clock (GdkWindow *window)
}
}
+static void
+clamp_window_size (GdkWindow *window,
+ gint *width,
+ gint *height)
+{
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
+
+ if (*width * impl->window_scale > 32767 ||
+ *height * impl->window_scale > 32767)
+ {
+ g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
+
+ if (*width * impl->window_scale > 32767)
+ *width = 32767 / impl->window_scale;
+ if (*height * impl->window_scale > 32767)
+ *height = 32767 / impl->window_scale;
+ }
+}
+
void
_gdk_x11_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
@@ -1101,16 +1120,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
class = InputOnly;
}
- if (window->width * impl->window_scale > 32767 ||
- window->height * impl->window_scale > 32767)
- {
- g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
-
- if (window->width * impl->window_scale > 32767)
- window->width = 32767 / impl->window_scale;
- if (window->height * impl->window_scale > 32767)
- window->height = 32767 / impl->window_scale;
- }
+ clamp_window_size (window, &window->width, &window->height);
impl->unscaled_width = window->width * impl->window_scale;
impl->unscaled_height = window->height * impl->window_scale;
@@ -1909,6 +1919,8 @@ gdk_window_x11_move_resize (GdkWindow *window,
window_x11_move (window, x, y);
else
{
+ clamp_window_size (window, &width, &height);
+
if (with_move)
window_x11_move_resize (window, x, y, width, height);
else