基于GTK 与 Fakekey(将模拟键盘与PC机键盘链接在一起)
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <fakekey/fakekey.h>
#include <X11/keysym.h>
Display* disp ;
FakeKey *fk;
GtkWidget *win = NULL;
static char *numkeyboard_display[]=
{
"1\0", "2\0", "3\0", "+","4\0", "5\0", "6\0","-", "7\0", "8\0", "9\0", ".", "0\0", "←\0", "→\0", "Backspace\0", "Delete\0", "Enter\0"
};
static gushort numkeyboard_send[] =
{
XK_1, XK_2, XK_3, XK_plus, XK_4, XK_5, XK_6, XK_minus, XK_7, XK_8, XK_9, XK_period, XK_0, XK_Left, XK_Right, XK_BackSpace, XK_Delete, XK_Return
};
gboolean numbt_release (GtkWidget *widget, GdkEventButton *event,
gpointer user_data)
{
gint i = GPOINTER_TO_UINT(user_data);
fakekey_press_keysym(fk,