[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 2 commits - config_host/config_vclplug.h.in configure.ac vcl/inc vcl/qt5 vcl/unx

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 15 08:31:39 UTC 2019


 config_host/config_vclplug.h.in |    2 +
 configure.ac                    |   16 +++++++-----
 vcl/inc/qt5/Qt5Frame.hxx        |   22 ++++++++++++++++
 vcl/qt5/Qt5Frame.cxx            |   52 +++++++++++++++++++++++++++++++++++-----
 vcl/unx/kde5/KDE5SalFrame.cxx   |   17 -------------
 vcl/unx/kde5/KDE5SalFrame.hxx   |    5 ---
 6 files changed, 80 insertions(+), 34 deletions(-)

New commits:
commit 1a1e13333e8145c7a78ddb23b540b0832cadd446
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jun 14 00:46:32 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Jun 15 10:30:56 2019 +0200

    tdf#125921 Qt5 set WM_CLASS for top level windows
    
    Uses the same naming then the gtk3 backend, i.e. "libreoffice"
    for the instance name and different class names for the module
    windows, like "libreoffice-writer".
    
    These names are referenced in the desktop files a StartupWMClass
    and for example used to pin an app to the task bar.
    
    Change-Id: Ic9b8890536f6413ab59d2e0da866e2280ab3181a
    Reviewed-on: https://gerrit.libreoffice.org/74014
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 77a3c443d35c7d966217f02ea9189cb1819c7828)
    Reviewed-on: https://gerrit.libreoffice.org/74082
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/configure.ac b/configure.ac
index 22e41055dc87..171fabeaaf2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11274,7 +11274,9 @@ then
     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
 
     if test "$USING_X11" = TRUE; then
-        QT5_LIBS="$QT5_LIBS -lQt5X11Extras"
+        PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
+        QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
+        QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
         QT5_USING_X11=1
         AC_DEFINE(QT5_USING_X11)
     fi
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index cad660726943..b424334cf741 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -27,6 +27,7 @@
 #include <Qt5MainWindow.hxx>
 #include <Qt5Menu.hxx>
 #include <Qt5SvpGraphics.hxx>
+#include <Qt5System.hxx>
 #include <Qt5Tools.hxx>
 #include <Qt5Widget.hxx>
 
@@ -46,6 +47,7 @@
 
 #if QT5_USING_X11
 #include <QtX11Extras/QX11Info>
+#include <xcb/xproto.h>
 #endif
 
 #include <saldatabasic.hxx>
@@ -1125,9 +1127,29 @@ void Qt5Frame::SetScreenNumber(unsigned int nScreen)
     }
 }
 
-void Qt5Frame::SetApplicationID(const OUString&)
+void Qt5Frame::SetApplicationID(const OUString& rWMClass)
 {
-    // So the hope is that QGuiApplication deals with this properly..
+#if QT5_USING_X11
+    if (QGuiApplication::platformName() != "xcb" || !m_pTopLevel)
+        return;
+
+    OString aResClass = OUStringToOString(rWMClass, RTL_TEXTENCODING_ASCII_US);
+    const char* pResClass
+        = !aResClass.isEmpty() ? aResClass.getStr() : SalGenericSystem::getFrameClassName();
+    OString aResName = SalGenericSystem::getFrameResName();
+
+    // the WM_CLASS data consists of two concated cstrings, including the terminating '\0' chars
+    const uint32_t data_len = aResName.getLength() + 1 + strlen(pResClass) + 1;
+    char* data = new char[data_len];
+    memcpy(data, aResName.getStr(), aResName.getLength() + 1);
+    memcpy(data + aResName.getLength() + 1, pResClass, strlen(pResClass) + 1);
+
+    xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, m_pTopLevel->winId(),
+                        XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, data_len, data);
+    delete[] data;
+#else
+    (void)rWMClass;
+#endif
 }
 
 // Drag'n'drop foo
commit 9c37c306158267d942a0a1debc3845db1c923ceb
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jun 14 02:08:22 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Jun 15 10:30:48 2019 +0200

    KDE5 move screensafer inhibiting code into Qt5
    
    There will presumably be more X11 specific code later to implement some
    "fix" for tdf#119202. Moving the screensafer inhibitor is rather
    uncontroversial in comparion, so start with it and use it to carry the
    matching configure.ac changes.
    
    A little "nightmare" are all the clashing X11 / Qt type undefs, but I
    couldn't find a better solution while the inhibitor continues to
    include the X11 headers in it's header.
    
    Reviewed-on: https://gerrit.libreoffice.org/74015
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit b5323c72ff7e5bcde34089e49fe98e589dcc5acb)
    
    Change-Id: I55c89c76726d30a890178488484e954207267e89
    Reviewed-on: https://gerrit.libreoffice.org/74081
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in
index 0b9ca095e5ec..5245a1ea7fb2 100644
--- a/config_host/config_vclplug.h.in
+++ b/config_host/config_vclplug.h.in
@@ -13,4 +13,6 @@ Settings about which desktops have support enabled.
 #define ENABLE_KDE5 0
 #define ENABLE_QT5 0
 
+#define QT5_USING_X11 0
+
 #endif
diff --git a/configure.ac b/configure.ac
index af54cc66fc44..22e41055dc87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11273,6 +11273,12 @@ then
     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
 
+    if test "$USING_X11" = TRUE; then
+        QT5_LIBS="$QT5_LIBS -lQt5X11Extras"
+        QT5_USING_X11=1
+        AC_DEFINE(QT5_USING_X11)
+    fi
+
     dnl Check for Meta Object Compiler
 
     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
@@ -11360,12 +11366,8 @@ then
         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
     fi
 
-    if test "$USING_X11" = TRUE; then
-        PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
-    fi
-
-    KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT $KF5_XCB_CFLAGS"
-    KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
+    KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
+    KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
 
     if test "$USING_X11" = TRUE; then
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index c70171869aa8..d7f8f1aa6e1f 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -19,6 +19,8 @@
 
 #pragma once
 
+#include <config_vclplug.h>
+
 #include <salframe.hxx>
 #include <vclpluginapi.h>
 
@@ -30,6 +32,22 @@
 
 #include <QtCore/QObject>
 
+#if QT5_USING_X11
+#include <unx/screensaverinhibitor.hxx>
+// any better way to get rid of the X11 / Qt type clashes?
+#undef Bool
+#undef CursorShape
+#undef Expose
+#undef KeyPress
+#undef KeyRelease
+#undef FocusIn
+#undef FocusOut
+#undef FontChange
+#undef None
+#undef Status
+#undef Unsorted
+#endif
+
 class Qt5DragSource;
 class Qt5DropTarget;
 class Qt5Graphics;
@@ -87,6 +105,10 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
     sal_uInt32 m_nRestoreScreen;
     QRect m_aRestoreGeometry;
 
+#if QT5_USING_X11
+    ScreenSaverInhibitor m_ScreenSaverInhibitor;
+#endif
+
     void Center();
     Size CalcDefaultSize();
     void SetDefaultSize();
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 7a2c67b809d5..cad660726943 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -44,6 +44,10 @@
 #include <QtWidgets/QMenuBar>
 #include <QtWidgets/QMainWindow>
 
+#if QT5_USING_X11
+#include <QtX11Extras/QX11Info>
+#endif
+
 #include <saldatabasic.hxx>
 #include <window.h>
 #include <vcl/layout.hxx>
@@ -634,11 +638,25 @@ void Qt5Frame::ShowFullScreen(bool bFullScreen, sal_Int32 nScreen)
     }
 }
 
-void Qt5Frame::StartPresentation(bool)
+void Qt5Frame::StartPresentation(bool bStart)
 {
-    // meh - so there's no Qt platform independent solution - defer to
-    // KDE5 impl. For everyone else:
-    // https://forum.qt.io/topic/38504/solved-qdialog-in-fullscreen-disable-os-screensaver
+// meh - so there's no Qt platform independent solution
+// https://forum.qt.io/topic/38504/solved-qdialog-in-fullscreen-disable-os-screensaver
+#if QT5_USING_X11
+    boost::optional<unsigned int> aRootWindow;
+    boost::optional<Display*> aDisplay;
+
+    if (QX11Info::isPlatformX11())
+    {
+        aRootWindow = QX11Info::appRootWindow();
+        aDisplay = QX11Info::display();
+    }
+
+    m_ScreenSaverInhibitor.inhibit(bStart, "presentation", QX11Info::isPlatformX11(), aRootWindow,
+                                   aDisplay);
+#else
+    (void)bStart;
+#endif
 }
 
 void Qt5Frame::SetAlwaysOnTop(bool bOnTop)
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 06efc52ff535..69516132e0dc 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -20,11 +20,9 @@
 #include <memory>
 #include <QtGui/QColor>
 #include <QtWidgets/QStyle>
-#include <QtCore/QDebug>
 #include <QtWidgets/QToolTip>
 #include <QtWidgets/QApplication>
 #include <QtWidgets/QMenuBar>
-#include <QtX11Extras/QX11Info>
 
 #include <KConfig>
 #include <KConfigGroup>
@@ -222,19 +220,4 @@ 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 441039829846..4b609bdf85a2 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -21,10 +21,7 @@
 
 #include <memory>
 
-#undef Status
-
 #include <qt5/Qt5Frame.hxx>
-#include <unx/screensaverinhibitor.hxx>
 
 #include "KDE5SalGraphics.hxx"
 
@@ -35,7 +32,6 @@ class KDE5SalFrame : public Qt5Frame
 {
 private:
     std::unique_ptr<KDE5SalGraphics> m_pKDE5Graphics;
-    ScreenSaverInhibitor m_ScreenSaverInhibitor;
     bool m_bGraphicsInUse;
 
 public:
@@ -45,7 +41,6 @@ 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 SalPointerState GetPointerState() override { return SalPointerState(); }
     virtual KeyIndicatorState GetIndicatorState() override { return KeyIndicatorState(); }


More information about the Libreoffice-commits mailing list