Commit 69c32a11 authored by Michael Weiser's avatar Michael Weiser Committed by Sean Davis

Fix dbus inhibition (bug #16365)

Port over necessary routines from mate screensaver and wire them into
idle screensaving and locking decisions. Do not inhibit explicit
locking e.g. via dbus because it's security relevant and we should
do it if requested explicitly.
Signed-off-by: Sean Davis's avatarSean Davis <smd.seandavis@gmail.com>
parent 7e6fe76f
......@@ -391,6 +391,18 @@ gs_listener_activate_saver (GSListener *listener,
return TRUE;
}
gboolean
gs_listener_is_inhibited (GSListener *listener)
{
gboolean inhibited;
g_return_val_if_fail (GS_IS_LISTENER (listener), FALSE);
inhibited = listener_ref_entry_is_present (listener, REF_ENTRY_TYPE_INHIBIT);
return inhibited;
}
static dbus_bool_t
listener_property_set_bool (GSListener *listener,
guint prop_id,
......
......@@ -78,12 +78,7 @@ gboolean gs_listener_acquire (GSListener *listener,
GError **error);
gboolean gs_listener_activate_saver (GSListener *listener,
gboolean active);
gboolean gs_listener_set_session_idle (GSListener *listener,
gboolean idle);
void gs_listener_set_activation_enabled (GSListener *listener,
gboolean enabled);
void gs_listener_set_sleep_activation_enabled (GSListener *listener,
gboolean enabled);
gboolean gs_listener_is_inhibited (GSListener *listener);
G_END_DECLS
......
......@@ -87,10 +87,20 @@ static void listener_lock_cb(GSListener* listener, GSMonitor* monitor) {
}
static void listener_x11_activate_cb(GSListenerX11* listener, GSMonitor* monitor) {
if (gs_listener_is_inhibited(monitor->priv->listener)) {
gs_debug("Idle screen saving inhibited via dbus");
return;
}
gs_listener_activate_saver(monitor->priv->listener, TRUE);
}
static void listener_x11_lock_cb(GSListenerX11* listener, GSMonitor* monitor) {
if (gs_listener_is_inhibited(monitor->priv->listener)) {
gs_debug("Idle locking inhibited via dbus");
return;
}
listener_lock_cb (NULL, monitor);
}
......
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