[mutter/gnome-3-16] backend-native: Reset idle time on lid open events
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-16] backend-native: Reset idle time on lid open events
- Date: Fri, 22 May 2015 15:44:51 +0000 (UTC)
commit b507461c0f75a223a69d27441a9fb47bbe6b8eb5
Author: Rui Matos <tiagomatos gmail com>
Date: Wed May 20 17:05:37 2015 +0200
backend-native: Reset idle time on lid open events
This makes gnome-settings-daemon turn on the backlight and
gnome-shell's screen shield animate.
Note that on X sessions, gnome-settings-daemon uses the same upower
property to force an innocuous key event into the X server so that the
idle time gets reset since Xorg doesn't do this itself on lid events.
https://bugzilla.gnome.org/show_bug.cgi?id=749076
src/backends/native/meta-backend-native.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index 4c2d6a5..a14bd4c 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -29,6 +29,7 @@
#include <meta/main.h>
#include <clutter/evdev/clutter-evdev.h>
+#include <libupower-glib/upower.h>
#include "meta-barrier-native.h"
#include "meta-idle-monitor-native.h"
@@ -40,6 +41,7 @@ struct _MetaBackendNativePrivate
{
MetaLauncher *launcher;
MetaBarrierManagerNative *barrier_manager;
+ UpClient *up_client;
};
typedef struct _MetaBackendNativePrivate MetaBackendNativePrivate;
@@ -53,10 +55,23 @@ meta_backend_native_finalize (GObject *object)
meta_launcher_free (priv->launcher);
+ g_object_unref (priv->up_client);
+
G_OBJECT_CLASS (meta_backend_native_parent_class)->finalize (object);
}
static void
+lid_is_closed_changed_cb (UpClient *client,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ if (up_client_get_lid_is_closed (client))
+ return;
+
+ meta_idle_monitor_native_reset_idletime (meta_idle_monitor_get_core ());
+}
+
+static void
constrain_to_barriers (ClutterInputDevice *device,
guint32 time,
float *new_x,
@@ -267,6 +282,10 @@ meta_backend_native_init (MetaBackendNative *native)
priv->launcher = meta_launcher_new ();
priv->barrier_manager = meta_barrier_manager_native_new ();
+
+ priv->up_client = up_client_new ();
+ g_signal_connect (priv->up_client, "notify::lid-is-closed",
+ G_CALLBACK (lid_is_closed_changed_cb), NULL);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]