[gnome-settings-daemon] common: Add egg key parsing test program



commit 551e15f1d98a57469fbac642931424858d46cd97
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 2 14:31:51 2011 +0100

    common: Add egg key parsing test program

 plugins/common/Makefile.am            |    6 +++++-
 plugins/common/test-egg-key-parsing.c |   21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/plugins/common/Makefile.am b/plugins/common/Makefile.am
index 0a0255c..d0d3c26 100644
--- a/plugins/common/Makefile.am
+++ b/plugins/common/Makefile.am
@@ -28,12 +28,16 @@ libcommon_la_LIBADD  = \
 	$(SETTINGS_PLUGIN_LIBS)		\
 	$(XINPUT_LIBS)
 
-noinst_PROGRAMS = test-input-helper
+noinst_PROGRAMS = test-input-helper test-egg-key-parsing
 
 test_input_helper_SOURCES = test-input-helper.c
 test_input_helper_LDADD = libcommon.la
 test_input_helper_CFLAGS = $(libcommon_la_CFLAGS)
 
+test_egg_key_parsing_SOURCES = test-egg-key-parsing.c
+test_egg_key_parsing_LDADD = libcommon.la
+test_egg_key_parsing_CFLAGS = $(libcommon_la_CFLAGS)
+
 scriptsdir = $(datadir)/gnome-settings-daemon- GSD_API_VERSION@
 scripts_DATA = input-device-example.sh
 
diff --git a/plugins/common/test-egg-key-parsing.c b/plugins/common/test-egg-key-parsing.c
new file mode 100644
index 0000000..604b294
--- /dev/null
+++ b/plugins/common/test-egg-key-parsing.c
@@ -0,0 +1,21 @@
+#include <gtk/gtk.h>
+#include "eggaccelerators.h"
+
+#define KEY "XF86AudioRepeat"
+
+int main (int argc, char **argv)
+{
+	guint accel_key;
+	guint *accel_codes;
+	EggVirtualModifierType mods;
+	EggParseError retval;
+
+	gtk_init (&argc, &argv);
+
+	g_message ("gdk_keyval_from_name ('%s') == %d", KEY, gdk_keyval_from_name(KEY));
+	retval = egg_accelerator_parse_virtual (KEY, &accel_key, &accel_codes, &mods);
+	g_message ("egg_accelerator_parse_virtual ('%s') returned '%d' (%s)", KEY, retval,
+		   (retval == EGG_PARSE_ERROR_NONE) ? "success" : "failure");
+
+	return 0;
+}



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