Kaydet (Commit) 68570131 authored tarafından Andrzej Hunt's avatar Andrzej Hunt

Add org.mate.SessionManager support

This is valid for Mate <= 1.10
(As of writing, 1.10 is the current stable release - so we'll have
 to keep shipping this for quite a few years to come.)

Change-Id: I4d1f81c50923148e710eac22f5428b2a1c41f0e9
üst f9967442
...@@ -33,6 +33,7 @@ private: ...@@ -33,6 +33,7 @@ private:
boost::optional<guint> mnFDOCookie; // FDO ScreenSaver Inhibit boost::optional<guint> mnFDOCookie; // FDO ScreenSaver Inhibit
boost::optional<guint> mnFDOPMCookie; // FDO PowerManagement Inhibit boost::optional<guint> mnFDOPMCookie; // FDO PowerManagement Inhibit
boost::optional<guint> mnGSMCookie; boost::optional<guint> mnGSMCookie;
boost::optional<guint> mnMSMCookie;
boost::optional<int> mnXScreenSaverTimeout; boost::optional<int> mnXScreenSaverTimeout;
...@@ -53,11 +54,14 @@ private: ...@@ -53,11 +54,14 @@ private:
// FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ? // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
// (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement) // (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement)
// GSM: org.gnome.SessionManager::Inhibit - gnome 3 // GSM: org.gnome.SessionManager::Inhibit - gnome 3
// MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to GSM
// (This is replaced by the GSM interface from Mate 1.12 onwards)
// //
// Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs GSM (Uninhibit) // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs GSM (Uninhibit)
void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason ); void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason );
void inhibitFDOPM( bool bInhibit, const gchar* appname, const gchar* reason ); void inhibitFDOPM( bool bInhibit, const gchar* appname, const gchar* reason );
void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid ); void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid );
void inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid );
void inhibitXScreenSaver( bool bInhibit, Display* pDisplay ); void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
static void inhibitXAutoLock( bool bInhibit, Display* pDisplay ); static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
#define GSM_DBUS_SERVICE "org.gnome.SessionManager" #define GSM_DBUS_SERVICE "org.gnome.SessionManager"
#define GSM_DBUS_PATH "/org/gnome/SessionManager" #define GSM_DBUS_PATH "/org/gnome/SessionManager"
#define GSM_DBUS_INTERFACE "org.gnome.SessionManager" #define GSM_DBUS_INTERFACE "org.gnome.SessionManager"
// Mate <= 1.10 uses org.mate.SessionManager, > 1.10 will use org.gnome.SessionManager
#define MSM_DBUS_SERVICE "org.mate.SessionManager"
#define MSM_DBUS_PATH "/org/mate/SessionManager"
#define MSM_DBUS_INTERFACE "org.mate.SessionManager"
#endif #endif
#include <sal/log.hxx> #include <sal/log.hxx>
...@@ -54,6 +59,7 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason, ...@@ -54,6 +59,7 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason,
if ( xid != boost::none ) if ( xid != boost::none )
{ {
inhibitGSM( bInhibit, appname, aReason.getStr(), xid.get() ); inhibitGSM( bInhibit, appname, aReason.getStr(), xid.get() );
inhibitMSM( bInhibit, appname, aReason.getStr(), xid.get() );
} }
} }
} }
...@@ -198,6 +204,31 @@ void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const gchar* appname, cons ...@@ -198,6 +204,31 @@ void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const gchar* appname, cons
mnGSMCookie ); mnGSMCookie );
} }
void ScreenSaverInhibitor::inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid )
{
dbusInhibit( bInhibit,
MSM_DBUS_SERVICE, MSM_DBUS_PATH, MSM_DBUS_INTERFACE,
[appname, reason, xid] ( DBusGProxy *proxy, guint& nCookie, GError*& error ) -> bool {
return dbus_g_proxy_call( proxy,
"Inhibit", &error,
G_TYPE_STRING, appname,
G_TYPE_UINT, xid,
G_TYPE_STRING, reason,
G_TYPE_UINT, 8, //Inhibit the session being marked as idle
G_TYPE_INVALID,
G_TYPE_UINT, &nCookie,
G_TYPE_INVALID );
},
[] ( DBusGProxy *proxy, const guint nCookie, GError*& error ) -> bool {
return dbus_g_proxy_call( proxy,
"Uninhibit", &error,
G_TYPE_UINT, nCookie,
G_TYPE_INVALID,
G_TYPE_INVALID );
},
mnMSMCookie );
}
/** /**
* Disable screensavers using the XSetScreenSaver/XGetScreenSaver API. * Disable screensavers using the XSetScreenSaver/XGetScreenSaver API.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment