bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / unx / screensaverinhibitor.hxx
blobf57d78b9758a7cdcb283fa04dae75109e9bb548f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
11 #define INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
13 #include <X11/Xlib.h>
14 #include <X11/Xmd.h>
16 #include <rtl/ustring.hxx>
17 #include <vcl/dllapi.h>
19 #include <optional>
20 #include <string_view>
22 class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
24 public:
25 void inhibit(bool bInhibit, std::u16string_view sReason, bool bIsX11,
26 const std::optional<unsigned int>& xid, std::optional<Display*> pDisplay);
28 private:
29 // These are all used as guint, however this header may be included
30 // in kde/tde/etc backends, where we would ideally avoid having
31 // any glib dependencies, hence the direct use of unsigned int.
32 std::optional<unsigned int> mnFDOCookie; // FDO ScreenSaver Inhibit
33 std::optional<unsigned int> mnFDOPMCookie; // FDO PowerManagement Inhibit
34 std::optional<unsigned int> mnGSMCookie;
35 std::optional<unsigned int> mnMSMCookie;
37 std::optional<int> mnXScreenSaverTimeout;
39 #if !defined(__sun) && !defined(AIX)
40 BOOL mbDPMSWasEnabled;
41 CARD16 mnDPMSStandbyTimeout;
42 CARD16 mnDPMSSuspendTimeout;
43 CARD16 mnDPMSOffTimeout;
44 #endif
46 // There are a bunch of different dbus based inhibition APIs. Some call
47 // themselves ScreenSaver inhibition, some are PowerManagement inhibition,
48 // but they appear to have the same effect. There doesn't appear to be one
49 // all encompassing standard, hence we should just try all of them.
51 // The current APIs we have: (note: the list of supported environments is incomplete)
52 // FDO: org.freedesktop.ScreenSaver::Inhibit - appears to be supported only by KDE?
53 // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
54 // (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement)
55 // GSM: org.gnome.SessionManager::Inhibit - gnome 3
56 // MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to GSM
57 // (This is replaced by the GSM interface from Mate 1.12 onwards)
59 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs GSM (Uninhibit)
60 void inhibitFDO(bool bInhibit, const char* appname, const char* reason);
61 void inhibitFDOPM(bool bInhibit, const char* appname, const char* reason);
62 void inhibitGSM(bool bInhibit, const char* appname, const char* reason, const unsigned int xid);
63 void inhibitMSM(bool bInhibit, const char* appname, const char* reason, const unsigned int xid);
65 void inhibitXScreenSaver(bool bInhibit, Display* pDisplay);
66 static void inhibitXAutoLock(bool bInhibit, Display* pDisplay);
67 void inhibitDPMS(bool bInhibit, Display* pDisplay);
70 #endif // INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */