#define XK_LATIN1
#include <X11/keysymdef.h>
-#ifdef HAVE_XEVIE
-#include <X11/Xproto.h>
-#include <X11/X.h>
-#include <X11/extensions/Xevie.h>
-#endif /* HAVE_XEVIE */
-
#include <glib.h>
#include <dbus/dbus.h>
#include "introspection.h"
-KeySym ucs2keysym (long ucs);
-long keysym2ucs(KeySym keysym);
-
static void spi_dec_x11_emit_modifier_event (SpiDEController *controller,
guint prev_mask,
guint current_mask);
* Long-term fix is to extend the X keymap here instead of replace entries.
*/
priv->reserved_reset_timeout = g_timeout_add (500, spi_dec_reset_reserved, priv);
+ g_source_set_name_by_id (priv->reserved_reset_timeout, "[at-spi2-core] spi_dec_reset_reserved");
}
if (modmask)
*modmask = 0;
{
unsigned int time = CurrentTime;
unsigned int bounce_delay;
+#ifdef THIS_IS_BROKEN
unsigned int elapsed_msec;
struct timeval tv;
+#endif
DEControllerPrivateData *priv = controller->priv;
spi_x_error_trap ();
bounce_delay = xkb_get_bouncekeys_delay (controller);
if (bounce_delay)
{
+#ifdef THIS_IS_BROKEN
gettimeofday (&tv, NULL);
elapsed_msec =
(tv.tv_sec - priv->last_release_time.tv_sec) * 1000
+ (tv.tv_usec - priv->last_release_time.tv_usec) / 1000;
-#ifdef SPI_XKB_DEBUG
+# ifdef SPI_XKB_DEBUG
fprintf (stderr, "%d ms elapsed (%ld usec)\n", elapsed_msec,
(long) (tv.tv_usec - priv->last_release_time.tv_usec));
-#endif
-#ifdef THIS_IS_BROKEN
+# endif
if (elapsed_msec < bounce_delay)
time = bounce_delay - elapsed_msec + 1;
#else
{
unsigned int time = CurrentTime;
unsigned int slow_delay;
+#ifdef THIS_IS_BROKEN_DUNNO_WHY
unsigned int elapsed_msec;
struct timeval tv;
+#endif
DEControllerPrivateData *priv = controller->priv;
spi_x_error_trap ();
slow_delay = xkb_get_slowkeys_delay (controller);
if (slow_delay)
{
+#ifdef THIS_IS_BROKEN_DUNNO_WHY
gettimeofday (&tv, NULL);
elapsed_msec =
(tv.tv_sec - priv->last_press_time.tv_sec) * 1000
+ (tv.tv_usec - priv->last_press_time.tv_usec) / 1000;
-#ifdef SPI_XKB_DEBUG
+# ifdef SPI_XKB_DEBUG
fprintf (stderr, "%d ms elapsed (%ld usec)\n", elapsed_msec,
(long) (tv.tv_usec - priv->last_press_time.tv_usec));
-#endif
-#ifdef THIS_IS_BROKEN_DUNNO_WHY
+# endif
if (elapsed_msec < slow_delay)
time = slow_delay - elapsed_msec + 1;
#else
static KeySym
keysym_for_unichar (SpiDEController *controller, gunichar unichar)
{
- return ucs2keysym ((long) unichar);
+ return (KeySym) ucs2keysym ((long) unichar);
}
static gboolean
const gchar *c;
KeySym keysym;
- maxlen = strlen (keystring) + 1;
- keysyms = g_new0 (KeySym, maxlen);
if (!(keystring && *keystring && g_utf8_validate (keystring, -1, &c))) {
retval = FALSE;
}
#ifdef SPI_DEBUG
fprintf (stderr, "[keystring synthesis attempted on %s]\n", keystring);
#endif
+ maxlen = strlen (keystring) + 1;
+ keysyms = g_new0 (KeySym, maxlen);
+
while (keystring && (unichar = g_utf8_get_char (keystring))) {
char bytes[6];
gint mbytes;
}
}
XSynchronize (spi_get_display (), FALSE);
+
+ g_free (keysyms);
}
- g_free (keysyms);
if (synth_type == Accessibility_KEY_SYM) {
keysym = keycode;
return retval;
}
-#ifdef HAVE_XEVIE
-static Bool
-isEvent(Display *dpy, XEvent *event, char *arg)
-{
- return TRUE;
-}
-
-static gboolean
-handle_io (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
-{
- SpiDEController *controller = (SpiDEController *) data;
- DEControllerPrivateData *priv = controller->priv;
- gboolean is_consumed = FALSE;
- XEvent ev;
-
- while (XCheckIfEvent(priv->xevie_display, &ev, isEvent, NULL))
- {
- if (ev.type == KeyPress || ev.type == KeyRelease)
- is_consumed = spi_device_event_controller_forward_key_event (controller, &ev);
-
- if (! is_consumed)
- XevieSendEvent(priv->xevie_display, &ev, XEVIE_UNMODIFIED);
- }
-
- return TRUE;
-}
-#endif /* HAVE_XEVIE */
-
static void
spi_dec_x11_init (SpiDEController *controller)
{
DEControllerPrivateData *priv = controller->priv;
- spi_events_init (spi_get_display());
-#ifdef HAVE_XEVIE
- GIOChannel *ioc;
- int fd;
-#endif /* HAVE_XEVIE */
spi_events_init (spi_get_display ());
-#ifdef HAVE_XEVIE
- priv->xevie_display = XOpenDisplay(NULL);
-
- if (XevieStart(priv->xevie_display) == TRUE)
- {
-#ifdef SPI_KEYEVENT_DEBUG
- fprintf (stderr, "XevieStart() success \n");
-#endif
- XevieSelectInput(priv->xevie_display, KeyPressMask | KeyReleaseMask);
-
- fd = ConnectionNumber(priv->xevie_display);
- ioc = g_io_channel_unix_new (fd);
- g_io_add_watch (ioc, G_IO_IN | G_IO_HUP, handle_io, controller);
- g_io_channel_unref (ioc);
- }
- else
- {
-#ifdef SPI_KEYEVENT_DEBUG
- fprintf (stderr, "XevieStart() failed, only one client is allowed to do event int exception\n");
-#endif
- }
-#endif /* HAVE_XEVIE */
gettimeofday (&priv->last_press_time, NULL);
gettimeofday (&priv->last_release_time, NULL);
static void
spi_dec_x11_finalize (SpiDEController *controller)
{
- DEControllerPrivateData *priv = controller->priv;
+ DEControllerPrivateData *priv = controller->priv;
+
/* disconnect any special listeners, get rid of outstanding keygrabs */
XUngrabKey (spi_get_display (), AnyKey, AnyModifier, DefaultRootWindow (spi_get_display ()));
-#ifdef HAVE_XEVIE
- if (priv->xevie_display != NULL)
- {
- XevieEnd(priv->xevie_display);
-#ifdef SPI_KEYEVENT_DEBUG
- printf("XevieEnd(dpy) finished \n");
-#endif
- }
-#endif
-
if (priv->xkb_desc)
- XkbFreeKeyboard (priv->xkb_desc, 0, True);
+ XkbFreeKeyboard (priv->xkb_desc, 0, True);
/* TODO: Should free the keymap */
}
spi_device_event_controller_forward_key_event (SpiDEController *controller,
const XEvent *event)
{
- DEControllerPrivateData *priv = controller->priv;
+ DEControllerPrivateData *priv = controller->priv;
Accessibility_DeviceEvent key_event;
gboolean ret;
{
pressed_event = spi_keystroke_from_x_key_event ((XKeyEvent *) event);
check_release_handler = g_timeout_add (CHECK_RELEASE_DELAY, check_release, &pressed_event);
+ g_source_set_name_by_id (check_release_handler, "[at-spi2-core] check_release");
}
static void