diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-14 02:08:22 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-14 18:53:07 +0200 |
commit | b5323c72ff7e5bcde34089e49fe98e589dcc5acb (patch) | |
tree | 99ead8a9804dbb847ba0a636aec0b66cc8f75fdb /vcl | |
parent | 846c68876c214d501bf163eede4288d7a307ec8a (diff) |
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.
Change-Id: I55c89c76726d30a890178488484e954207267e89
Reviewed-on: https://gerrit.libreoffice.org/74015
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/Qt5Frame.hxx | 22 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 26 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5SalFrame.cxx | 17 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5SalFrame.hxx | 5 |
4 files changed, 44 insertions, 26 deletions
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 270885249298..3951dbced768 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -45,6 +45,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> @@ -635,11 +639,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 9399da4783fe..efb08a74d832 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> @@ -221,19 +219,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 96c634a20e7a..cf3874af7c8c 100644 --- a/vcl/unx/kde5/KDE5SalFrame.hxx +++ b/vcl/unx/kde5/KDE5SalFrame.hxx @@ -21,11 +21,8 @@ #include <memory> -#undef Status - #include <qt5/Qt5Frame.hxx> #include <qt5/Qt5SvpGraphics.hxx> -#include <unx/screensaverinhibitor.hxx> class QWidget; @@ -33,7 +30,6 @@ class KDE5SalFrame : public Qt5Frame { private: std::unique_ptr<Qt5SvpGraphics> m_pKDE5Graphics; - ScreenSaverInhibitor m_ScreenSaverInhibitor; bool m_bGraphicsInUse; public: @@ -43,7 +39,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(); } |