bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / unx / screensaverinhibitor.hxx
blob7100a88773993e77f9352cc9eb9ca833b9fa3882
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 <boost/optional.hpp>
21 class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
23 public:
24 void inhibit( bool bInhibit, const OUString& sReason,
25 bool bIsX11, const boost::optional<unsigned int>& xid, boost::optional<Display*> pDisplay );
27 private:
28 // These are all used as guint, however this header may be included
29 // in kde/tde/etc backends, where we would ideally avoid having
30 // any glib dependencies, hence the direct use of unsigned int.
31 boost::optional<unsigned int> mnFDOCookie; // FDO ScreenSaver Inhibit
32 boost::optional<unsigned int> mnFDOPMCookie; // FDO PowerManagement Inhibit
33 boost::optional<unsigned int> mnGSMCookie;
34 boost::optional<unsigned int> mnMSMCookie;
36 boost::optional<int> mnXScreenSaverTimeout;
38 #if !defined(__sun) && !defined(AIX)
39 BOOL mbDPMSWasEnabled;
40 CARD16 mnDPMSStandbyTimeout;
41 CARD16 mnDPMSSuspendTimeout;
42 CARD16 mnDPMSOffTimeout;
43 #endif
45 // There are a bunch of different dbus based inhibition APIs. Some call
46 // themselves ScreenSaver inhibition, some are PowerManagement inhibition,
47 // but they appear to have the same effect. There doesn't appear to be one
48 // all encompassing standard, hence we should just try all of them.
50 // The current APIs we have: (note: the list of supported environments is incomplete)
51 // FDO: org.freedesktop.ScreenSaver::Inhibit - appears to be supported only by KDE?
52 // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
53 // (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement)
54 // GSM: org.gnome.SessionManager::Inhibit - gnome 3
55 // MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to GSM
56 // (This is replaced by the GSM interface from Mate 1.12 onwards)
58 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs GSM (Uninhibit)
59 void inhibitFDO( bool bInhibit, const char* appname, const char* reason );
60 void inhibitFDOPM( bool bInhibit, const char* appname, const char* reason );
61 void inhibitGSM( bool bInhibit, const char* appname, const char* reason, const unsigned int xid );
62 void inhibitMSM( bool bInhibit, const char* appname, const char* reason, const unsigned int xid );
64 void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
65 static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
66 void inhibitDPMS( bool bInhibit, Display* pDisplay );
69 #endif // INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */