Opened 4 years ago

Closed 4 years ago

#17456 closed defect (fixed)

Patch: Fix fo windows becoming unresizable on wxGTK with HiDPI displays

Reported by: botg Owned by:
Priority: normal Milestone: 3.1.1
Component: wxGTK Version: 3.0.2
Keywords: Cc:
Blocked By: Blocking:
Patch: yes


If using a HiDPI UI scale factor > 1, calling wxTopLevelWindowGTK::DoSetSizeHints results in a Window that cannot be resized anymore.

The problem is that we're passing INT_MAX as max width/height hint to gtk_window_set_geometry_hints, leading to overflows when calculating the maximum scaled window size.

This patch changes the maximum size hint to INT_MAX/16.

Patch is against master, but should also be applied to WX_3_0_BRANCH.

Steps to reproduce the bug:

  • Get Fedora 23
  • Set UI scale to 2 with gnome-tweak-tool
  • Build latext wx sources using GTK+3
  • Start the "text" sample which calls SetSizeHints

Without the patch, the window cannot be resized.

Attachments (1)

0001-Fix-wxTopLevelWindowGTK-DoSetSizeHints-if-a-window-s.patch download (1.3 KB) - added by botg 4 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 4 years ago by vadz

  • Milestone set to 3.1.1

Thanks, this looks safe to apply in any case, but I wonder if the comment just above

    // always set both min and max hints, otherwise GTK will
    // make assumptions we don't want about the unset values

is still valid, especially for GTK+ 3? It was added there in changeset:f94d58dd75aa251a9aefbca341ca97bc278c82d4 "only" 3.5 years ago, but it's not clear if the problem affected GTK+3 too. Paul, do you remember it by chance?

comment:2 Changed 4 years ago by Paul Cornett <paulcor@…>

In 4793e5b0a4e189e492287305859b278fed780080/git-wxWidgets:

Avoid unresizable windows on HiDPI displays when using SetSizeHints()

see #17456

comment:3 Changed 4 years ago by Paul Cornett <paulcor@…>

In a97553a939b76df1564ffbfe9c919d1da5a34c5a/git-wxWidgets:

Avoid unresizable windows on HiDPI displays when using SetSizeHints()

see #17456

(cherry picked from commit 4793e5b0a4e189e492287305859b278fed780080)

comment:4 Changed 4 years ago by pcor

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.