Beispiel #1
0
static void
on_evdev_key_pressed (guint32  time_,
                      guint32  key,
                      guint32  state,
                      gpointer data)
{
  Rebinder *rebinder = data;
  Binding *binding;

  if (!state)
    {
      fakekey_release (rebinder->fake);
      return;
    }

  /* don't look at events with keycodes < 255, they go through X */
  if (key <= 255)
    return;

  /* Custom bindings (from rebinder.conf) */
  binding = find_binding_by_keycode (rebinder, key);

  /* Try to find the keycode in the static binding pool */
  if (binding == NULL)
    binding = find_evdev_binding_by_keycode (key);

  if (binding == NULL)
    return;

  MEX_NOTE (EVDEV, "Sending keysym 0x%08x (%s)", (int) binding->keysym,
            XKeysymToString (binding->keysym));

  fakekey_press_keysym (rebinder->fake, binding->keysym,  0);
}
Beispiel #2
0
void
fvkbd_key_send_xkeysym(KeySym sym)
{
	gint ret;

	ret = fakekey_press_keysym(get_fakekey_instance(), sym, 0);
	fakekey_release(get_fakekey_instance());
	DBG("action: send sym: %x, result:%d\n", (unsigned int)sym, ret);
}
Beispiel #3
0
void
fvkbd_key_send_utf8_string(gchar *string)
{
	gint i,ret = 1;
	gchar *p = string;

	for (i = g_utf8_strlen(string, -1); i > 0; i--) {
		ret = fakekey_press(get_fakekey_instance(),
				(unsigned char *)p, -1, 0);
		fakekey_release(get_fakekey_instance());

		if (ret == 0)
			break;

		p = g_utf8_find_next_char(p, NULL);
	}
	DBG("action: send string: %s, result:%d\n", string, ret);
}