LibreOffice Module vcl (master)  1
screensaverinhibitor.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #ifndef INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
11 #define INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
12 
13 #include <X11/Xlib.h>
14 #include <X11/Xmd.h>
15 
16 #include <rtl/ustring.hxx>
17 #include <vcl/dllapi.h>
18 
19 #include <boost/optional.hpp>
20 
22 {
23 public:
24  void inhibit( bool bInhibit, const OUString& sReason,
25  bool bIsX11, const boost::optional<unsigned int>& xid, boost::optional<Display*> pDisplay );
26 
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
35 
37 
38 #if !defined(__sun) && !defined(AIX)
43 #endif
44 
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.
49  //
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)
57  //
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 );
63 
64  void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
65  static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
66  void inhibitDPMS( bool bInhibit, Display* pDisplay );
67 };
68 
69 #endif // INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
70 
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const wchar_t *typedef BOOL
boost::optional< unsigned int > mnGSMCookie
boost::optional< unsigned int > mnMSMCookie
boost::optional< unsigned int > mnFDOPMCookie
Display
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
boost::optional< int > mnXScreenSaverTimeout
boost::optional< unsigned int > mnFDOCookie