[gnome-settings-daemon] orientation: Add missing setting of the timeout id
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] orientation: Add missing setting of the timeout id
- Date: Mon, 6 Jun 2011 17:48:52 +0000 (UTC)
commit 8e9925c1e94dd38e5f9b190065e849b52fba2b45
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jun 3 18:36:33 2011 +0100
orientation: Add missing setting of the timeout id
And unsetting, when exiting the timeout. Also avoid crashes
when the orientation is bizarrely undefined.
plugins/orientation/gsd-orientation-manager.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/plugins/orientation/gsd-orientation-manager.c b/plugins/orientation/gsd-orientation-manager.c
index fdf4689..34870e4 100644
--- a/plugins/orientation/gsd-orientation-manager.c
+++ b/plugins/orientation/gsd-orientation-manager.c
@@ -271,6 +271,10 @@ do_rotation (GsdOrientationManager *manager)
g_debug ("Orientation changed, but we are locked");
return;
}
+ if (manager->priv->prev_orientation == ORIENTATION_UNDEFINED) {
+ g_debug ("Not trying to rotate, orientation is undefined");
+ return;
+ }
rotation = orientation_to_rotation (manager->priv->prev_orientation);
@@ -286,6 +290,7 @@ check_value_change_cb (GsdOrientationManager *manager)
if (get_current_values (manager, &x, &y, &z) == FALSE) {
g_warning ("Failed to get X/Y/Z values from device '%d'", manager->priv->device_id);
+ manager->priv->orient_timeout_id = 0;
return FALSE;
}
@@ -301,6 +306,8 @@ check_value_change_cb (GsdOrientationManager *manager)
set_device_enabled (manager->priv->device_id, FALSE);
+ manager->priv->orient_timeout_id = 0;
+
return FALSE;
}
@@ -309,6 +316,7 @@ check_value_change_cb (GsdOrientationManager *manager)
if (manager->priv->num_checks > MAX_CHECKS) {
manager->priv->num_checks = 0;
set_device_enabled (manager->priv->device_id, FALSE);
+ manager->priv->orient_timeout_id = 0;
return FALSE;
}
@@ -356,7 +364,8 @@ client_uevent_cb (GUdevClient *client,
return;
}
- g_timeout_add (150, (GSourceFunc) check_value_change_cb, manager);
+ manager->priv->orient_timeout_id = g_timeout_add
+ (150, (GSourceFunc) check_value_change_cb, manager);
}
static char *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]