diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-12-07 20:26:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-12-08 09:36:56 +0100 |
commit | 1361d656675c534638aa78c9decffae9e38127fa (patch) | |
tree | 93103cbe26a320d300d965ee22368bb2021ad170 /vcl/unx/gtk3 | |
parent | 307a181254ad5e7b3ee52a4fcfae654a34281fbe (diff) |
gtk3: GtkTreeView::gtk_widget_get_preferred_size can return a poor height
if GtkTreeView's internal do_validate_rows hasn't been run yet,
guarantee that's called by calling gtk_widget_get_preferred_width.
this is noticable in the calc autofilter color dropdown on getting
its preferred height right after inserting rows into it
Change-Id: I6dcef6ddfb462bcd9ff31ac797862804661f46fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126491
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index fbd171a14549..760c9a45652f 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -15401,6 +15401,12 @@ public: gtk_scrolled_window_get_min_content_height(GTK_SCROLLED_WINDOW(pParent))); } GtkRequisition size; +#if !GTK_CHECK_VERSION(4, 0, 0) + // sometimes gtk gives a bad outcome for gtk_widget_get_preferred_size if GtkTreeView's + // do_validate_rows hasn't been run before querying the preferred size, if we call + // gtk_widget_get_preferred_width first, we can guarantee do_validate_rows get's called + gtk_widget_get_preferred_width(m_pWidget, nullptr, &size.width); +#endif gtk_widget_get_preferred_size(m_pWidget, nullptr, &size); if (aRet.Width() == -1) aRet.setWidth(size.width); |