[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 11 09:04:39 UTC 2021
vcl/unx/gtk3/gtk3gtkobject.cxx | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 81d5acda2c143ab1183c7dc6d2386cc1b28c9fcf
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Mar 10 12:53:19 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Mar 11 10:03:55 2021 +0100
in GtkSalObject::GetOptimalSize get the preferred size
and not its current size as set via SetPosSize
as needed for calc navigator shrink/expand contents toolbar toggle
Change-Id: I848402f609d9c03fde9953e3b313c5a815a7f4f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112270
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index 5923088b79ee..e6da598d5e30 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -206,8 +206,18 @@ Size GtkSalObjectBase::GetOptimalSize() const
bool bVisible = gtk_widget_get_visible(m_pSocket);
if (!bVisible)
gtk_widget_set_visible(m_pSocket, true);
+
+ // Undo SetPosSize before getting its preferred size
+ gint width(-1), height(-1);
+ gtk_widget_get_size_request(m_pSocket, &width, &height);
+ gtk_widget_set_size_request(m_pSocket, -1, -1);
+
GtkRequisition size;
gtk_widget_get_preferred_size(m_pSocket, nullptr, &size);
+
+ // Restore SetPosSize size
+ gtk_widget_set_size_request(m_pSocket, width, height);
+
if (!bVisible)
gtk_widget_set_visible(m_pSocket, false);
return Size(size.width, size.height);
More information about the Libreoffice-commits
mailing list