summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-10-20 17:24:44 +0200
committerAndrzej Hunt <andrzej@ahunt.org>2015-10-20 18:14:40 +0200
commit68570131013cfcf29f4c934a727053c2903e35b1 (patch)
tree5107da1ca65bbf48617e4cab233397924cfb57b0 /vcl
parentf99674421d91d417abd965612fffd1d139473e7f (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/screensaverinhibitor.hxx4
-rw-r--r--vcl/unx/generic/window/screensaverinhibitor.cxx31
2 files changed, 35 insertions, 0 deletions
diff --git a/vcl/inc/unx/screensaverinhibitor.hxx b/vcl/inc/unx/screensaverinhibitor.hxx
index f00e61f31df9..286c18d00707 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -33,6 +33,7 @@ private:
boost::optional<guint> mnFDOCookie; // FDO ScreenSaver Inhibit
boost::optional<guint> mnFDOPMCookie; // FDO PowerManagement Inhibit
boost::optional<guint> mnGSMCookie;
+ boost::optional<guint> mnMSMCookie;
boost::optional<int> mnXScreenSaverTimeout;
@@ -53,11 +54,14 @@ private:
// FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
// (KDE: doesn't inhibit screensaver, but does inhibit PowerManagement)
// 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)
void inhibitFDO( 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 inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, const guint xid );
void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx b/vcl/unx/generic/window/screensaverinhibitor.cxx
index e26b17d37602..5346ac44f38c 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -29,6 +29,11 @@
#define GSM_DBUS_SERVICE "org.gnome.SessionManager"
#define GSM_DBUS_PATH "/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
#include <sal/log.hxx>
@@ -54,6 +59,7 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const OUString& sReason,
if ( xid != boost::none )
{
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
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.
*