vcl/inc/qt5/QtFrame.hxx |    1 +
 vcl/qt5/QtFrame.cxx     |   10 ++++++++--
 vcl/qt5/QtObject.cxx    |    2 --
 3 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit f3bd9ef889d1834f7b1feb49197a58e679826c00
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Wed Nov 17 13:26:09 2021 +0100
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Wed Nov 17 16:51:42 2021 +0100

    Qt resolve native winId() on demand
    
    As for gtk3 in commit ac9789dbb36f45dcc1caf7dd2951353b1574c8ea
    ("tdf#139609 avoid fetching unnecessary xid under gtk3").
    
    Change-Id: I82b2c22437e5ab957706c25fcc118b28abb07242
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125395
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 965ecbaba0e1..c3c9cdb9f309 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -210,6 +210,7 @@ public:
 
     virtual void SetScreenNumber(unsigned int) override;
     virtual void SetApplicationID(const OUString&) override;
+    virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
 
     inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index ce504c10b8db..5b8a6fad6d96 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -184,8 +184,6 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
     }
 
     FillSystemEnvData(m_aSystemData, reinterpret_cast<sal_IntPtr>(this), 
m_pQWidget);
-    if (m_aSystemData.platform != SystemEnvData::Platform::Wayland)
-        m_aSystemData.SetWindowHandle(m_pQWidget->winId());
 
     SetIcon(SV_ICON_ID_OFFICE);
 
@@ -1344,6 +1342,14 @@ void QtFrame::SetApplicationID(const OUString& rWMClass)
 #endif
 }
 
+void QtFrame::ResolveWindowHandle(SystemEnvData& rData) const
+{
+    if (!rData.pWidget)
+        return;
+    if (rData.platform != SystemEnvData::Platform::Wayland)
+        rData.SetWindowHandle(static_cast<QWidget*>(rData.pWidget)->winId());
+}
+
 // Drag'n'drop foo
 
 void QtFrame::registerDragSource(QtDragSource* pDragSource)
diff --git a/vcl/qt5/QtObject.cxx b/vcl/qt5/QtObject.cxx
index b8c30af2d340..569586a0dc98 100644
--- a/vcl/qt5/QtObject.cxx
+++ b/vcl/qt5/QtObject.cxx
@@ -42,8 +42,6 @@ QtObject::QtObject(QtFrame* pParent, bool bShow)
         m_pQWidget->show();
 
     QtFrame::FillSystemEnvData(m_aSystemData, 
reinterpret_cast<sal_IntPtr>(this), m_pQWidget);
-    if (m_aSystemData.platform != SystemEnvData::Platform::Wayland)
-        m_aSystemData.SetWindowHandle(m_pQWidget->winId());
 }
 
 QtObject::~QtObject()

Reply via email to