You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wxGTK3/wxGTK3-3.0.2-scrolwin-sizin...

48 lines
1.5 KiB

From 8d7e0d045250fa78a7e7d5a25cecee43bb75db3a Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@bullseye.com>
Date: Mon, 10 Nov 2014 04:13:18 +0000
Subject: [PATCH] fix infinite sizing loop with GTK3 when using a non-default
target window, closes #16668
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
docs/changes.txt | 5 +++++
src/gtk/scrolwin.cpp | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/docs/changes.txt b/docs/changes.txt
index 6f1e996..0a09cd5 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -581,6 +581,11 @@ All (GUI):
- Fix several floating point rounding bugs in wxPropertyGrid (Artur Wieczorek).
+wxGTK:
+
+- Fix infinite sizing loop with GTK3 when using wxScrolled with a non-default
+ target window.
+
wxMSW:
- Fix compilation with C++Builder XE compiler (Nichka).
diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp
index 9b39077..c500288 100644
--- a/src/gtk/scrolwin.cpp
+++ b/src/gtk/scrolwin.cpp
@@ -81,6 +81,14 @@ void wxScrollHelper::AdjustScrollbars()
{
int vw, vh;
m_targetWindow->GetVirtualSize(&vw, &vh);
+#ifdef __WXGTK3__
+ if (m_targetWindow != m_win)
+ {
+ // setting wxPizza preferred size keeps GtkScrolledWindow from causing
+ // an infinite sizing loop
+ gtk_widget_set_size_request(m_win->m_wxwindow, vw, vh);
+ }
+#endif
int w, h;
const wxSize availSize = GetSizeAvailableForScrollTarget(