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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 5 06:07:21 UTC 2018


 configure.ac                  |    4 ++++
 vcl/qt5/Qt5Frame.cxx          |   30 +++++++++++++++++++++---------
 vcl/unx/kde5/KDE5SalFrame.cxx |   16 ++++++++++++++++
 vcl/unx/kde5/KDE5SalFrame.hxx |    3 +++
 4 files changed, 44 insertions(+), 9 deletions(-)

New commits:
commit f970499651c85d429cc31518ed65c37c33c9936b
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Tue Sep 4 21:05:03 2018 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Sep 5 08:06:56 2018 +0200

    kde5: add screensaver disable and fixups
    
    - call X11 screensaver disable for preso
    - add SAL_NO_MOUSEGRABS check for mouse capture
    - call min/max size methods on correct widget
    
    Change-Id: I0dc838d9254d3a7f8848ec8283b0c10d00f36b42
    Reviewed-on: https://gerrit.libreoffice.org/60009
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/configure.ac b/configure.ac
index b72e4fd4e8bc..0e9d452ca591 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11273,6 +11273,10 @@ then
     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
 
+    if test "$USING_X11" = TRUE; then
+        KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
+    fi
+
     AC_LANG_PUSH([C++])
     save_CXXFLAGS=$CXXFLAGS
     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 198c75b04b82..895c9742cd89 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -317,13 +317,23 @@ void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/)
 void Qt5Frame::SetMinClientSize(long nWidth, long nHeight)
 {
     if (!isChild())
-        m_pQWidget->setMinimumSize(nWidth, nHeight);
+    {
+        if (m_pTopLevel)
+            m_pTopLevel->setMinimumSize(nWidth, nHeight);
+        else
+            m_pQWidget->setMinimumSize(nWidth, nHeight);
+    }
 }
 
 void Qt5Frame::SetMaxClientSize(long nWidth, long nHeight)
 {
     if (!isChild())
-        m_pQWidget->setMaximumSize(nWidth, nHeight);
+    {
+        if (m_pTopLevel)
+            m_pTopLevel->setMaximumSize(nWidth, nHeight);
+        else
+            m_pQWidget->setMaximumSize(nWidth, nHeight);
+    }
 }
 
 void Qt5Frame::Center()
@@ -572,19 +582,21 @@ void Qt5Frame::SetPointer(PointerStyle ePointerStyle)
 
 void Qt5Frame::CaptureMouse(bool bMouse)
 {
-    QWidget* const pWidget = m_pTopLevel ? m_pTopLevel : m_pQWidget;
+    static const char* pEnv = getenv("SAL_NO_MOUSEGRABS");
+    if (pEnv && *pEnv)
+        return;
+
     if (bMouse)
-        pWidget->grabMouse();
+        m_pQWidget->grabMouse();
     else
-        pWidget->releaseMouse();
+        m_pQWidget->releaseMouse();
 }
 
 void Qt5Frame::SetPointerPos(long nX, long nY)
 {
-    QWidget* const pWidget = m_pTopLevel ? m_pTopLevel : m_pQWidget;
-    QCursor aCursor = pWidget->cursor();
-    aCursor.setPos(pWidget->mapToGlobal(QPoint(nX, nY)));
-    pWidget->setCursor(aCursor);
+    QCursor aCursor = m_pQWidget->cursor();
+    aCursor.setPos(m_pQWidget->mapToGlobal(QPoint(nX, nY)));
+    m_pQWidget->setCursor(aCursor);
 }
 
 void Qt5Frame::Flush()
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index dffc759d44a2..9c82f6ca53b1 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -24,6 +24,7 @@
 #include <QtWidgets/QToolTip>
 #include <QtWidgets/QApplication>
 #include <QtWidgets/QMenuBar>
+#include <QtX11Extras/QX11Info>
 
 #include <KConfig>
 #include <KConfigGroup>
@@ -221,4 +222,19 @@ void KDE5SalFrame::ReleaseGraphics(SalGraphics* pSalGraph)
     m_bGraphicsInUse = false;
 }
 
+void KDE5SalFrame::StartPresentation(bool bStart)
+{
+    // disable screensaver for running preso
+    boost::optional<unsigned int> aWindow;
+    boost::optional<Display*> aDisplay;
+    if (QX11Info::isPlatformX11())
+    {
+        aWindow = QX11Info::appRootWindow();
+        aDisplay = QX11Info::display();
+    }
+
+    m_ScreenSaverInhibitor.inhibit(bStart, "presentation", QX11Info::isPlatformX11(), aWindow,
+                                   aDisplay);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index 6135d630adb3..e39dab65503d 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -24,6 +24,7 @@
 #undef Status
 
 #include <qt5/Qt5Frame.hxx>
+#include <unx/screensaverinhibitor.hxx>
 
 #include "KDE5SalGraphics.hxx"
 
@@ -34,6 +35,7 @@ class KDE5SalFrame : public Qt5Frame
 {
 private:
     std::unique_ptr<KDE5SalGraphics> m_pKDE5Graphics;
+    ScreenSaverInhibitor m_ScreenSaverInhibitor;
     bool m_bGraphicsInUse;
 
 public:
@@ -43,6 +45,7 @@ public:
     virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
     virtual void UpdateSettings(AllSettings& rSettings) override;
 
+    virtual void StartPresentation(bool bStart) override;
     virtual LanguageType GetInputLanguage() override { return LANGUAGE_SYSTEM; }
     virtual const SystemEnvData* GetSystemData() const override { return nullptr; }
     virtual SalPointerState GetPointerState() override { return SalPointerState(); }


More information about the Libreoffice-commits mailing list