vcl/inc/qt5/QtFrame.hxx  |    6 ++----
 vcl/qt5/QtFrame.cxx      |    4 ++++
 vcl/qt5/QtX11Support.cxx |   12 +++++++++++-
 3 files changed, 17 insertions(+), 5 deletions(-)

New commits:
commit e4d23c27288b99c3ed3cfa332ff308b31c01f97d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Jun 18 21:11:28 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Jun 19 02:09:29 2022 +0200

    qt: Fix qt6 build after fbc61e06584ff8e6d9240f8b67be8dc28ecab5b9
    
    Failed like this:
    
        In file included from 
/home/michi/development/git/libreoffice/vcl/qt6/QtX11Support.cxx:10:
        
/home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtX11Support.cxx:15:10: 
fatal error: QtX11Extras/QX11Info: No such file or directory
           15 | #include <QtX11Extras/QX11Info>
              |          ^~~~~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[1]: *** 
[/home/michi/development/git/libreoffice/solenv/gbuild/LinkTarget.mk:334: 
/home/michi/development/git/libreoffice/workdir/CxxObject/vcl/qt6/QtX11Support.o]
 Error 1
        make[1]: *** Waiting for unfinished jobs....
        In file included from 
/home/michi/development/git/libreoffice/vcl/qt6/QtFrame.cxx:10:
        /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx: In 
member function ‘virtual void QtFrame::StartPresentation(bool)’:
        
/home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:746:5: 
error: ‘m_ScreenSaverInhibitor’ was not declared in this scope
          746 |     m_ScreenSaverInhibitor.inhibit(bStart, u"presentation", 
bIsX11, aRootWindow, aDisplay);
              |     ^~~~~~~~~~~~~~~~~~~~~~
        make[1]: *** 
[/home/michi/development/git/libreoffice/solenv/gbuild/LinkTarget.mk:334: 
/home/michi/development/git/libreoffice/workdir/CxxObject/vcl/qt6/QtFrame.o] 
Error 1
        make: *** [Makefile:288: build] Error 2
    
    As mentioned in [1], `QX11Info` has been removed in Qt 6.
    
    The `ScreenSaverInhibitor` related code (except for the `QX11Info` part)
    can be used for Qt 6 as well, so adapt the checks in
    the header accordingly.
    
    [1] https://www.qt.io/blog/qt-extras-modules-in-qt-6
    
    Co-authored-by: Jan-Marek Glogowski <glo...@fbihome.de>
    
    Change-Id: Ifd546b4f4210aaf7f09ebaa8c36d2a031763d492
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136091
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 562c7d3ba89a..963572ca819b 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -33,7 +33,7 @@
 
 #include <QtCore/QObject>
 
-#if CHECK_QT5_USING_X11
+#if CHECK_ANY_QT_USING_X11
 #include <unx/screensaverinhibitor.hxx>
 // any better way to get rid of the X11 / Qt type clashes?
 #undef Bool
@@ -101,10 +101,8 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
     sal_uInt32 m_nRestoreScreen;
     QRect m_aRestoreGeometry;
 
-#if CHECK_QT5_USING_X11
-    ScreenSaverInhibitor m_ScreenSaverInhibitor;
-#endif
 #if CHECK_ANY_QT_USING_X11
+    ScreenSaverInhibitor m_ScreenSaverInhibitor;
     ModKeyFlags m_nKeyModifiers;
 #endif
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 006ad4a8bfc1..9ccfd8ec5147 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -728,6 +728,7 @@ void QtFrame::ShowFullScreen(bool bFullScreen, sal_Int32 
nScreen)
 
 void QtFrame::StartPresentation(bool bStart)
 {
+#if CHECK_ANY_QT_USING_X11
     // meh - so there's no Qt platform independent solution
     // 
https://forum.qt.io/topic/38504/solved-qdialog-in-fullscreen-disable-os-screensaver
     assert(m_aSystemData.platform != SystemEnvData::Platform::Invalid);
@@ -744,6 +745,9 @@ void QtFrame::StartPresentation(bool bStart)
 #endif
 
     m_ScreenSaverInhibitor.inhibit(bStart, u"presentation", bIsX11, 
aRootWindow, aDisplay);
+#else
+    Q_UNUSED(bStart)
+#endif
 }
 
 void QtFrame::SetAlwaysOnTop(bool bOnTop)
diff --git a/vcl/qt5/QtX11Support.cxx b/vcl/qt5/QtX11Support.cxx
index 93f3085ffab3..d6f372fdadf5 100644
--- a/vcl/qt5/QtX11Support.cxx
+++ b/vcl/qt5/QtX11Support.cxx
@@ -12,11 +12,14 @@
 #include <config_vclplug.h>
 
 #include <QtCore/QVersionNumber>
-#include <QtX11Extras/QX11Info>
 
 #include <QtInstance.hxx>
 #include <QtTools.hxx>
 
+#if CHECK_QT5_USING_X11
+#include <QtX11Extras/QX11Info>
+#endif
+
 #if QT5_HAVE_XCB_ICCCM
 #include <xcb/xcb_icccm.h>
 #endif
@@ -41,16 +44,19 @@ xcb_atom_t QtX11Support::lookupAtom(xcb_connection_t* 
pConn, const char* const s
 
 void QtX11Support::fetchAtoms()
 {
+#if CHECK_QT5_USING_X11
     if (m_bDidAtomLookups)
         return;
     m_bDidAtomLookups = true;
 
     xcb_connection_t* pXcbConn = QX11Info::connection();
     m_nWindowGroupAtom = lookupAtom(pXcbConn, m_sWindowGroupName);
+#endif
 }
 
 void QtX11Support::setApplicationID(const xcb_window_t nWinId, 
std::u16string_view rWMClass)
 {
+#if CHECK_QT5_USING_X11
     OString aResClass = OUStringToOString(rWMClass, RTL_TEXTENCODING_ASCII_US);
     const char* pResClass
         = !aResClass.isEmpty() ? aResClass.getStr() : 
SalGenericSystem::getFrameClassName();
@@ -65,6 +71,10 @@ void QtX11Support::setApplicationID(const xcb_window_t 
nWinId, std::u16string_vi
     xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, nWinId, 
XCB_ATOM_WM_CLASS,
                         XCB_ATOM_STRING, 8, data_len, data);
     delete[] data;
+#else
+    Q_UNUSED(nWinId);
+    Q_UNUSED(rWMClass);
+#endif
 }
 
 bool QtX11Support::fixICCCMwindowGroup(const xcb_window_t nWinId)

Reply via email to