[Libreoffice-commits] core.git: vcl/qt5

Jan-Marek Glogowski glogow at fbihome.de
Wed Jan 3 09:21:15 UTC 2018


 vcl/qt5/Qt5Frame.cxx  |   27 ++++++++++++++++++++++++++-
 vcl/qt5/Qt5Widget.cxx |    3 +++
 2 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 15d9087ff1e495e234b2cf073329c3358abb4dc0
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Dec 8 11:37:18 2017 +0000

    Qt5 set and update the frame geometry
    
    The geometry is used for mouse hit tests for mapping
    LO mouse events to popup positions.
    This way (popup) menus become at at least usable.
    
    Change-Id: Ic2b409d7a8937320c70b9f377374fe7d51e4ebf3
    Reviewed-on: https://gerrit.libreoffice.org/47276
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 95e3363efe3f..cb44b71f6e2c 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -99,6 +99,20 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
         if (pParentWindow != pChildWindow)
             pChildWindow->setTransientParent(pParentWindow);
     }
+
+    // fake an initial geometry, gets updated via configure event or SetPosSize
+    if (m_bDefaultPos || m_bDefaultSize)
+    {
+        Size aDefSize = CalcDefaultSize();
+        maGeometry.nX = -1;
+        maGeometry.nY = -1;
+        maGeometry.nWidth = aDefSize.Width();
+        maGeometry.nHeight = aDefSize.Height();
+        maGeometry.nTopDecoration = 0;
+        maGeometry.nBottomDecoration = 0;
+        maGeometry.nLeftDecoration = 0;
+        maGeometry.nRightDecoration = 0;
+    }
 }
 
 Qt5Frame::~Qt5Frame()
@@ -292,6 +306,9 @@ void Qt5Frame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt1
             nY += aRect.y();
         }
 
+        maGeometry.nX = nX;
+        maGeometry.nY = nY;
+
         m_bDefaultPos = false;
         m_pQWidget->move(nX, nY);
     }
@@ -434,7 +451,15 @@ bool Qt5Frame::MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType,
 
 LanguageType Qt5Frame::GetInputLanguage() { return LANGUAGE_DONTKNOW; }
 
-void Qt5Frame::UpdateSettings(AllSettings& rSettings) {}
+void Qt5Frame::UpdateSettings(AllSettings& rSettings)
+{
+    StyleSettings style(rSettings.GetStyleSettings());
+
+    const int flash_time = QApplication::cursorFlashTime();
+    style.SetCursorBlinkTime(flash_time != 0 ? flash_time / 2 : STYLE_CURSOR_NOBLINKTIME);
+
+    rSettings.SetStyleSettings(style);
+}
 
 void Qt5Frame::Beep() {}
 
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index c1cb8e7ce9ff..526662b15c34 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -82,6 +82,9 @@ void Qt5Widget::resizeEvent(QResizeEvent*)
         m_pFrame->m_pQImage.reset(pImage);
     }
 
+    m_pFrame->maGeometry.nWidth = size().width();
+    m_pFrame->maGeometry.nHeight = size().height();
+
     m_pFrame->CallCallback(SalEvent::Resize, nullptr);
 }
 


More information about the Libreoffice-commits mailing list