//一个小工具,用来读取键盘按键信息。如按下CTRL+F8,显示CTRL+F8,并打印键值
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
gboolean key_value(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
GtkWidget *label = (GtkWidget *)data;
guint keyvalue = event->keyval;
gchar temp[100];
strcpy(temp, "press: ");
if(event->state & GDK_CONTROL_MASK)
strcat(temp, "CTRL+");
if(event->state & GDK_SHIFT_MASK)
strcat(temp, "SHIFT+");
if(event->state & GDK_META_MASK)
strcat(temp, "ALT+");
if(event->state & GDK_LOCK_MASK)
strcat(temp, "LOCK+");
strcat