From a97553a939b76df1564ffbfe9c919d1da5a34c5a Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@users.noreply.github.com>
Date: Mon, 21 Mar 2016 09:46:46 -0700
Subject: [PATCH] Avoid unresizable windows on HiDPI displays when using
SetSizeHints()
see #17456
(cherry picked from commit 4793e5b0a4e189e492287305859b278fed780080)
---
src/gtk/toplevel.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
index 464fb3f..69fca2a 100644
--- a/src/gtk/toplevel.cpp
+++ b/src/gtk/toplevel.cpp
@@ -1273,8 +1273,9 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH,
int hints_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
hints.min_width = 1;
hints.min_height = 1;
- hints.max_width = INT_MAX;
- hints.max_height = INT_MAX;
+ // using INT_MAX for size will lead to integer overflow with HiDPI scaling
+ hints.max_width = INT_MAX / 16;
+ hints.max_height = INT_MAX / 16;
int decorSize_x;
int decorSize_y;
#ifdef HAS_CLIENT_DECOR