gnome-power-manager r3114 - in branches/gnome-2-24: . src



Author: rhughes
Date: Tue Dec  2 15:30:49 2008
New Revision: 3114
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3114&view=rev

Log:
2008-12-02  Richard Hughes  <richard hughsie com>

* src/gpm-button.c: (gpm_button_reset_time):
* src/gpm-button.h:
* src/gpm-manager.c: (gpm_manager_action_suspend),
(gpm_manager_action_hibernate):
Reset the event time after we resume so the duplicate key detection
code works correctly.
Many thanks to Adel Gadllah <drago01 gmail com> for debugging and
testing.


Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/gpm-button.c
   branches/gnome-2-24/src/gpm-button.h
   branches/gnome-2-24/src/gpm-manager.c

Modified: branches/gnome-2-24/src/gpm-button.c
==============================================================================
--- branches/gnome-2-24/src/gpm-button.c	(original)
+++ branches/gnome-2-24/src/gpm-button.c	Tue Dec  2 15:30:49 2008
@@ -268,6 +268,20 @@
 }
 
 /**
+ * gpm_button_reset_time:
+ *
+ * We have to refresh the event time on resume to handle duplicate buttons
+ * properly when the time is significant when we suspend.
+ **/
+gboolean
+gpm_button_reset_time (GpmButton *button)
+{
+	g_return_val_if_fail (GPM_IS_BUTTON (button), FALSE);
+	g_timer_reset (button->priv->timer);
+	return TRUE;
+}
+
+/**
  * emit_button_pressed:
  *
  * @udi: The HAL UDI

Modified: branches/gnome-2-24/src/gpm-button.h
==============================================================================
--- branches/gnome-2-24/src/gpm-button.h	(original)
+++ branches/gnome-2-24/src/gpm-button.h	Tue Dec  2 15:30:49 2008
@@ -68,6 +68,7 @@
 GType		 gpm_button_get_type		(void);
 GpmButton	*gpm_button_new			(void);
 gboolean	 gpm_button_is_lid_closed	(GpmButton *button);
+gboolean	 gpm_button_reset_time		(GpmButton *button);
 
 G_END_DECLS
 

Modified: branches/gnome-2-24/src/gpm-manager.c
==============================================================================
--- branches/gnome-2-24/src/gpm-manager.c	(original)
+++ branches/gnome-2-24/src/gpm-manager.c	Tue Dec  2 15:30:49 2008
@@ -360,6 +360,7 @@
 	gpm_info_explain_reason (manager->priv->info, GPM_EVENT_SUSPEND,
 				_("Suspending computer."), reason);
 	gpm_control_suspend (manager->priv->control, &error);
+	gpm_button_reset_time (manager->priv->button);
 	if (error != NULL) {
 		g_error_free (error);
 	}
@@ -409,6 +410,7 @@
 	gpm_info_explain_reason (manager->priv->info, GPM_EVENT_HIBERNATE,
 				_("Hibernating computer."), reason);
 	gpm_control_hibernate (manager->priv->control, &error);
+	gpm_button_reset_time (manager->priv->button);
 	if (error != NULL) {
 		g_error_free (error);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]