/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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/.
*/
enum ApplicationInhibitFlags
{
APPLICATION_INHIBIT_LOGOUT = (1 << 0),
APPLICATION_INHIBIT_IDLE = (1 << 3) // Inhibit the session being marked as idle
};
class VCL_PLUGIN_PUBLIC SessionManagerInhibitor
{ public: void inhibit(bool bInhibit, std::u16string_view sReason, ApplicationInhibitFlags eType, unsignedint window_system_id = 0, constchar* application_id = nullptr); #if USING_X11 // calls the above and direct X11-specific API calls in addition void inhibit(bool bInhibit, std::u16string_view sReason, ApplicationInhibitFlags eType, unsignedint window_system_id, std::optional<Display*> pDisplay, constchar* application_id = nullptr); #endif
private: // These are all used as guint, however this header may be included // in kde/tde/etc backends, where we would ideally avoid having // any glib dependencies, hence the direct use of unsigned int.
std::optional<unsignedint> mnFDOSSCookie; // FDO ScreenSaver Inhibit
std::optional<unsignedint> mnFDOPMCookie; // FDO PowerManagement Inhibit
std::optional<unsignedint> mnGSMCookie;
// There are a bunch of different dbus based inhibition APIs. Some call // themselves ScreenSaver inhibition, some are PowerManagement inhibition, // but they appear to have the same effect. There doesn't appear to be one // all encompassing standard, hence we should just try all of them. // // The current APIs we have: (note: the list of supported environments is incomplete) // FDSSO: org.freedesktop.ScreenSaver::Inhibit - appears to be supported only by KDE? // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ? // (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement) // GSM: org.gnome.SessionManager::Inhibit - gnome 3, MATE // // Note: the Uninhibit call has different spelling in FDOSS (UnInhibit) vs GSM (Uninhibit)
SAL_DLLPRIVATE void inhibitFDOSS(bool bInhibit, constchar* appname, constchar* reason);
SAL_DLLPRIVATE void inhibitFDOPM(bool bInhibit, constchar* appname, constchar* reason);
SAL_DLLPRIVATE void inhibitGSM(bool bInhibit, constchar* appname, constchar* reason,
ApplicationInhibitFlags eType, unsignedint window_system_id);
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.