static unsigned int _numlock_physical_mask = Mod2Mask; /* a guess, will be reset */
static GQuark spi_dec_private_quark = 0;
+static XModifierKeymap* xmkeymap = NULL;
-int (*x_default_error_handler) (Display *display, XErrorEvent *error_event);
+static int (*x_default_error_handler) (Display *display, XErrorEvent *error_event);
typedef enum {
SPI_DEVICE_TYPE_KBD,
}
else
spi_dec_set_unlatch_pending (controller, mask_return);
+
+ CORBA_free (e.any_data._value);
}
return TRUE;
}
int *x, int *y, gboolean *moved)
{
Accessibility_Event e;
+ Accessibility_EventDetails *details;
CORBA_Environment ev;
int win_x_return,win_y_return;
unsigned int mask_return;
Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
&e,
&ev);
+ details = e.any_data._value;
+ CORBA_free (details);
e.type = "mouse:rel";
e.source = BONOBO_OBJREF (controller->registry->desktop);
e.detail1 = *x - last_mouse_pos->x;
Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
&e,
&ev);
+ details = e.any_data._value;
+ CORBA_free (details);
*moved = True;
}
else
Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
&e,
&ev);
+ CORBA_free (e.any_data._value);
}
static gboolean
Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
&e,
&ev);
+ CORBA_free (e.any_data._value);
}
xkb_mod_unlatch_occurred = (xevent->type == ButtonPress ||
priv = (DEControllerPrivateData *)
g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
+ if (xevent->type == MappingNotify)
+ xmkeymap = NULL;
+
if (xevent->type == KeyPress || xevent->type == KeyRelease)
{
if (controller->xevie_display == NULL)
return GDK_FILTER_CONTINUE;
}
-int
+static int
_spi_controller_device_error_handler (Display *display, XErrorEvent *error)
{
if (error->error_code == BadAccess)
DEControllerKeyListener *listener,
CORBA_boolean is_system_global)
{
- if ((key_event->modifiers == (CORBA_unsigned_short) (listener->mask & 0xFF)) &&
+ if (((key_event->modifiers & 0xFF) == (CORBA_unsigned_short) (listener->mask & 0xFF)) &&
spi_key_set_contains_key (listener->keys, key_event) &&
spi_eventtype_seq_contains_event (listener->listener.typeseq, key_event) &&
(is_system_global == listener->mode->global))
{
GList *l, *next;
gboolean update_failed = FALSE;
- KeyCode keycode;
+ KeyCode keycode = 0;
g_return_val_if_fail (controller != NULL, FALSE);
static gboolean
dec_lock_modifiers (SpiDEController *controller, unsigned modifiers)
{
- return XkbLockModifiers (spi_get_display (), XkbUseCoreKbd,
- modifiers, modifiers);
+ DEControllerPrivateData *priv = (DEControllerPrivateData *)
+ g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
+
+ if (priv->have_xkb) {
+ return XkbLockModifiers (spi_get_display (), XkbUseCoreKbd,
+ modifiers, modifiers);
+ } else {
+ int mod_index;
+ for (mod_index=0;mod_index<8;mod_index++)
+ if (modifiers & (1<<mod_index))
+ dec_synth_keycode_press(controller, xmkeymap->modifiermap[mod_index]);
+ return TRUE;
+ }
}
static gboolean
dec_unlock_modifiers (SpiDEController *controller, unsigned modifiers)
{
- return XkbLockModifiers (spi_get_display (), XkbUseCoreKbd,
- modifiers, 0);
+ DEControllerPrivateData *priv = (DEControllerPrivateData *)
+ g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
+
+ if (priv->have_xkb) {
+ return XkbLockModifiers (spi_get_display (), XkbUseCoreKbd,
+ modifiers, 0);
+ } else {
+ int mod_index;
+ for (mod_index=0;mod_index<8;mod_index++)
+ if (modifiers & (1<<mod_index))
+ dec_synth_keycode_release(controller, xmkeymap->modifiermap[mod_index]);
+ return TRUE;
+ }
}
static KeySym
gdk_error_trap_push ();
+ DEControllerPrivateData *priv = (DEControllerPrivateData *)
+ g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
+
+ if (!priv->have_xkb && xmkeymap==NULL) {
+ xmkeymap = XGetModifierMapping(spi_get_display ());
+ }
+
switch (synth_type)
{
case Accessibility_KEY_PRESS:
}
#ifdef HAVE_XEVIE
-Bool isEvent(dpy,event,arg)
- Display *dpy;
- XEvent *event;
- char *arg;
+static Bool isEvent(Display *dpy, XEvent *event, char *arg)
{
return TRUE;
}
-gboolean
+static gboolean
handle_io (GIOChannel *source,
GIOCondition condition,
gpointer data)
{
CORBA_Environment ev;
Accessibility_DeviceEvent key_event;
+ gboolean ret;
g_assert (event->type == KeyPress || event->type == KeyRelease);
spi_controller_update_key_grabs (controller, &key_event);
/* relay to listeners, and decide whether to consume it or not */
- return spi_controller_notify_keylisteners (controller, &key_event, CORBA_TRUE, &ev);
+ ret = spi_controller_notify_keylisteners (controller, &key_event, CORBA_TRUE, &ev);
+ CORBA_free(key_event.event_string);
+ return ret;
}
SpiDEController *