[Xfce4-commits] [apps/xfce4-screensaver] 01/01: Fix idle-actionation-enabled flag
noreply at xfce.org
noreply at xfce.org
Wed Nov 14 11:26:43 CET 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit a6eb58d3a1d36b8cf2c12ebe33d014c90bed96d9
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Wed Nov 14 05:26:37 2018 -0500
Fix idle-actionation-enabled flag
---
README.md | 1 -
src/gs-listener-x11.c | 45 ++++++++++++++++++++++++---------------------
src/gs-listener-x11.h | 14 ++++++++------
src/gs-monitor.c | 1 +
4 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/README.md b/README.md
index a0962d3..44eecaf 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,6 @@ Known Issues
============
- Time before locking after the screensaver, /lock-delay, is currently ignored. Instead, the screen is immediately locked.
- - Activate when idle, /idle-activation-enabled, is currently ignored. Unless the screensaver is inhibited, the screensaver will always activate after the idle timeout.
- Allow embedding a keyboard into the window, /embedded-keyboard-enabled, may be non-functional. Onboard crashes when embedded.
- Allow the session status message to be displayed, /status-message-enabled, is currently ignored. The status message is always displayed when received.
diff --git a/src/gs-listener-x11.c b/src/gs-listener-x11.c
index 99723d6..6d4549a 100644
--- a/src/gs-listener-x11.c
+++ b/src/gs-listener-x11.c
@@ -52,8 +52,9 @@ struct GSListenerX11Private {
int scrnsaver_event_base;
#endif
- gint lock_timeout;
- guint lock_timer_id;
+ gint lock_timeout;
+ guint lock_timer_id;
+ gboolean idle_activation_enabled;
};
enum {
@@ -103,30 +104,26 @@ lock_timer (GSListenerX11 *listener) {
gint state;
get_x11_idle_info (&idle_time, &state);
- switch (state) {
- case ScreenSaverOff:
- gs_debug("Lock Timeout: %is, Idle: %is, Screensaver: Enabled, Lock State: Unlocked",
- listener->priv->lock_timeout, idle_time);
- break;
-
- case ScreenSaverDisabled:
- gs_debug("Lock Timeout: %is, Idle: %is, Screensaver: Disabled, Lock State: Unlocked",
- listener->priv->lock_timeout, idle_time);
- break;
-
- case ScreenSaverOn:
- gs_debug("Lock Timeout: %is, Idle: %is, Screensaver: Enabled, Lock State: Locked",
- listener->priv->lock_timeout, idle_time);
- break;
- }
-
- if (idle_time >= listener->priv->lock_timeout && state != ScreenSaverDisabled) {
+ gs_debug("Lock Timeout: %is, Idle: %is, Idle Activation: %s, Screensaver: %s, Lock State: %s",
+ listener->priv->lock_timeout,
+ idle_time,
+ listener->priv->idle_activation_enabled ? "Enabled" : "Disabled",
+ state == ScreenSaverDisabled ? "Disabled" : "Enabled",
+ state == ScreenSaverOn ? "Locked" : "Unlocked");
+
+ if (listener->priv->idle_activation_enabled &&
+ idle_time >= listener->priv->lock_timeout &&
+ state != ScreenSaverDisabled) {
g_signal_emit(listener, signals[LOCK], 0);
} else {
switch (state) {
case ScreenSaverOff:
// Reset the lock timer
- reset_lock_timer(listener, listener->priv->lock_timeout - idle_time);
+ if (idle_time < listener->priv->lock_timeout) {
+ reset_lock_timer(listener, listener->priv->lock_timeout - idle_time);
+ } else {
+ reset_lock_timer(listener, 30);
+ }
return FALSE;
break;
@@ -249,6 +246,12 @@ gs_listener_x11_set_lock_after (GSListenerX11 *listener,
reset_lock_timer(listener, listener->priv->lock_timeout);
}
+void
+gs_listener_x11_set_activation_enabled (GSListenerX11 *listener,
+ gboolean enabled) {
+ listener->priv->idle_activation_enabled = enabled;
+}
+
static void
gs_listener_x11_init (GSListenerX11 *listener) {
listener->priv = gs_listener_x11_get_instance_private (listener);
diff --git a/src/gs-listener-x11.h b/src/gs-listener-x11.h
index 7ca1430..d7c833d 100644
--- a/src/gs-listener-x11.h
+++ b/src/gs-listener-x11.h
@@ -47,12 +47,14 @@ typedef struct
void (* lock) (GSListenerX11 *listener);
} GSListenerX11Class;
-GType gs_listener_x11_get_type (void);
-
-GSListenerX11 *gs_listener_x11_new (void);
-gboolean gs_listener_x11_acquire (GSListenerX11 *listener);
-void gs_listener_x11_set_lock_after (GSListenerX11 *listener,
- gint lock_after);
+GType gs_listener_x11_get_type (void);
+
+GSListenerX11 *gs_listener_x11_new (void);
+gboolean gs_listener_x11_acquire (GSListenerX11 *listener);
+void gs_listener_x11_set_lock_after (GSListenerX11 *listener,
+ gint lock_after);
+void gs_listener_x11_set_activation_enabled (GSListenerX11 *listener,
+ gboolean enabled);
G_END_DECLS
diff --git a/src/gs-monitor.c b/src/gs-monitor.c
index 1fae0ec..f3b28bf 100644
--- a/src/gs-monitor.c
+++ b/src/gs-monitor.c
@@ -187,6 +187,7 @@ static void _gs_monitor_update_from_prefs(GSMonitor* monitor, GSPrefs* prefs) {
/* enable activation when allowed */
gs_listener_set_activation_enabled(monitor->priv->listener, monitor->priv->prefs->idle_activation_enabled);
+ gs_listener_x11_set_activation_enabled(monitor->priv->listener_x11, monitor->priv->prefs->idle_activation_enabled);
gs_listener_x11_set_lock_after(monitor->priv->listener_x11, monitor->priv->prefs->timeout);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list