gnome-power-manager r2857 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2857 - in trunk: . src
- Date: Fri,  1 Aug 2008 08:39:16 +0000 (UTC)
Author: rhughes
Date: Fri Aug  1 08:39:15 2008
New Revision: 2857
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2857&view=rev
Log:
2008-08-01  Richard Hughes  <richard hughsie com>
* src/gpm-button.c: (gpm_button_xevent_key):
Make sure we convert from a keysym to keycode.
Modified:
   trunk/ChangeLog
   trunk/src/gpm-button.c
Modified: trunk/src/gpm-button.c
==============================================================================
--- trunk/src/gpm-button.c	(original)
+++ trunk/src/gpm-button.c	Fri Aug  1 08:39:15 2008
@@ -166,11 +166,19 @@
  * Return value: TRUE if we parsed and grabbed okay
  **/
 static gboolean
-gpm_button_xevent_key (GpmButton *button, guint keycode, const gchar *hal_key)
+gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *hal_key)
 {
 	gchar *key = NULL;
 	gboolean ret;
 	gchar *keycode_str;
+	guint keycode;
+
+	/* convert from keysym to keycode */
+	keycode = XKeysymToKeycode (GDK_DISPLAY (), keysym);
+	if (keycode == 0) {
+		gpm_warning ("could not map keysym %x to keycode", keysym);
+		return FALSE;
+	}
 
 	/* is the key string already in our DB? */
 	keycode_str = g_strdup_printf ("0x%x", keycode);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]