/* Note: these routines are not i18n-savvy, we need to use XIM, other methods here */
if (keysym && g_ascii_isprint((int)keysym))
{
- snprintf (label, 2, "%c", (int) keysym);
+ g_snprintf (label, 2, "%c", (int) keysym);
}
else
{
}
static SPIBoolean
-is_command_key (AccessibleKeystroke *key, void *user_data)
+is_command_key (const AccessibleKeystroke *key, void *user_data)
{
switch (key->keyID)
{
}
static SPIBoolean
-switch_callback (AccessibleKeystroke *key, void *user_data)
+switch_callback (const AccessibleKeystroke *key, void *user_data)
{
static SPIBoolean is_down = FALSE;
if (key->type == SPI_KEY_RELEASED)
{
- g_print ("spacebar up\n");
+ g_print ("switch up\n");
is_down = FALSE;
scan_stop (key->timestamp);
}
else
if (!is_down)
{
- g_print ("spacebar down\n");
+ g_print ("switch down\n");
is_down = TRUE;
scan_start (key->timestamp);
}
static KeyCode shift_keycode = 0;
if (!shift_keycode) shift_keycode = XKeysymToKeycode(GDK_DISPLAY(), (KeySym) 0xFFE1);
/* Note: in a real onscreen keyboard shift keycode should not be hard-coded! */
+
if (*keycode)
{
if (*keycode == CAPSLOCK_KEYCODE)
label_buttons (caps_lock || shift_latched);
}
if (shift_latched)
- SPI_generateKeyEvent (shift_keycode, SPI_KEY_PRESS);
-
- SPI_generateKeyEvent ((long) *keycode, SPI_KEY_PRESSRELEASE);
+ SPI_generateKeyboardEvent (shift_keycode, NULL, SPI_KEY_PRESS);
+
+ g_print ("generating key %d\n", (int) *keycode);
+ SPI_generateKeyboardEvent ((long) *keycode, NULL, SPI_KEY_PRESSRELEASE);
if (shift_latched)
{
- SPI_generateKeyEvent (shift_keycode, SPI_KEY_RELEASE);
+ SPI_generateKeyboardEvent (shift_keycode, NULL, SPI_KEY_RELEASE);
toggle_shift_latch (button);
}
}
/* will listen only to Alt-key combinations */
SPI_registerAccessibleKeystrokeListener (key_listener,
(AccessibleKeySet *) SPI_KEYSET_ALL_KEYS,
- SPI_KEYMASK_ALT,
+ SPI_KEYMASK_ALT | SPI_KEYMASK_CONTROL,
(unsigned long) ( KeyPress | KeyRelease),
SPI_KEYLISTENER_CANCONSUME | SPI_KEYLISTENER_ALL_WINDOWS);
create_vkbd ();
*/
switch_set.keysyms = g_new0 (unsigned long, 1);
switch_set.keycodes = g_new0 (unsigned short, 1);
+ switch_set.keystrings = g_new0 (char *, 1);
switch_set.len = 1;
switch_set.keysyms[0] = (unsigned long) 0;
switch_set.keycodes[0] = (unsigned short) 0;
+ switch_set.keystrings[0] = "";
switch_listener = SPI_createAccessibleKeystrokeListener (switch_callback, NULL);
SPI_registerAccessibleKeystrokeListener (switch_listener,
&switch_set,
SPI_KEYMASK_UNMODIFIED,
(unsigned long) ( SPI_KEY_PRESSED | SPI_KEY_RELEASED ),
- SPI_KEYLISTENER_CANCONSUME);
+ SPI_KEYLISTENER_NOSYNC);
SPI_event_main ();