[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 19 16:15:05 UTC 2019
include/vcl/syschild.hxx | 1 +
vcl/inc/salobj.hxx | 2 ++
vcl/inc/unx/gtk/gtkobject.hxx | 2 ++
vcl/source/window/syschild.cxx | 7 +++++++
vcl/unx/gtk3/gtk3gtkobject.cxx | 16 ++++++++++++++++
5 files changed, 28 insertions(+)
New commits:
commit 0c764bfd7abf0b4f21ece732d79bf9b02d7a42d9
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 17 17:25:57 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Dec 19 17:14:06 2019 +0100
add a SystemChildWindow::GetOptimalSize override
Change-Id: I812d996e78a6d627fda6612307ca4cb2f111b6a9
Reviewed-on: https://gerrit.libreoffice.org/85325
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/syschild.hxx b/include/vcl/syschild.hxx
index bdfd913fe929..11d85b029bf5 100644
--- a/include/vcl/syschild.hxx
+++ b/include/vcl/syschild.hxx
@@ -41,6 +41,7 @@ public:
// create a SystemChildWindow using the given SystemWindowData
explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true );
virtual ~SystemChildWindow() override;
+ virtual Size GetOptimalSize() const override;
virtual void dispose() override;
virtual const SystemEnvData* GetSystemData() const override;
diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx
index 83024fec339d..90ef3ae5e8d2 100644
--- a/vcl/inc/salobj.hxx
+++ b/vcl/inc/salobj.hxx
@@ -55,6 +55,8 @@ public:
virtual const SystemEnvData* GetSystemData() const = 0;
+ virtual Size GetOptimalSize() const { return Size(); }
+
void SetCallback( SystemChildWindow* pInst, SALOBJECTPROC pProc )
{ m_pInst = pInst; m_pCallback = pProc; }
void CallCallback( SalObjEvent nEvent )
diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx
index 75dbe39e4b9e..7ff9e499815b 100644
--- a/vcl/inc/unx/gtk/gtkobject.hxx
+++ b/vcl/inc/unx/gtk/gtkobject.hxx
@@ -52,6 +52,8 @@ public:
virtual void SetForwardKey( bool bEnable ) override;
virtual const SystemEnvData* GetSystemData() const override;
+
+ virtual Size GetOptimalSize() const override;
};
#endif // INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index 2ba10a2bcc75..81cbc43abd11 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -140,6 +140,13 @@ void SystemChildWindow::EnableEraseBackground( bool bEnable )
mpWindowImpl->mpSysObj->EnableEraseBackground( bEnable );
}
+Size SystemChildWindow::GetOptimalSize() const
+{
+ if (mpWindowImpl->mpSysObj)
+ return mpWindowImpl->mpSysObj->GetOptimalSize();
+ return vcl::Window::GetOptimalSize();
+}
+
void SystemChildWindow::SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs)
{
if (mpWindowImpl->mpSysObj)
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index 833048611b14..3079fdbe03a4 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -156,6 +156,22 @@ void GtkSalObject::Show( bool bVisible )
}
}
+Size GtkSalObject::GetOptimalSize() const
+{
+ if (m_pSocket)
+ {
+ bool bVisible = gtk_widget_get_visible(m_pSocket);
+ if (!bVisible)
+ gtk_widget_set_visible(m_pSocket, true);
+ GtkRequisition size;
+ gtk_widget_get_preferred_size(m_pSocket, nullptr, &size);
+ if (!bVisible)
+ gtk_widget_set_visible(m_pSocket, false);
+ return Size(size.width, size.height);
+ }
+ return Size();
+}
+
const SystemEnvData* GtkSalObject::GetSystemData() const
{
return &m_aSystemData;
More information about the Libreoffice-commits
mailing list