Files
libreoffice/vcl/qt5/QtX11Support.cxx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.6 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <QtX11Support.hxx>
#include <config_vclplug.h>
#include <QtCore/QVersionNumber>
#include <QtInstance.hxx>
#include <QtTools.hxx>
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 <glogow@fbihome.de> Change-Id: Ifd546b4f4210aaf7f09ebaa8c36d2a031763d492 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136091 Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-06-18 21:11:28 +02:00
#if CHECK_QT5_USING_X11
#include <QtX11Extras/QX11Info>
#endif
#include <unx/gensys.h>
void QtX11Support::setApplicationID(const xcb_window_t nWinId, std::u16string_view rWMClass)
{
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 <glogow@fbihome.de> Change-Id: Ifd546b4f4210aaf7f09ebaa8c36d2a031763d492 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136091 Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-06-18 21:11:28 +02:00
#if CHECK_QT5_USING_X11
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 concatenated 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, nWinId, XCB_ATOM_WM_CLASS,
XCB_ATOM_STRING, 8, data_len, data);
delete[] data;
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 <glogow@fbihome.de> Change-Id: Ifd546b4f4210aaf7f09ebaa8c36d2a031763d492 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136091 Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-06-18 21:11:28 +02:00
#else
Q_UNUSED(nWinId);
Q_UNUSED(rWMClass);
#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */