#include <stdio.h>
#endif
+#include <stdlib.h> /* for getenv() */
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
#include <config.h>
/*
* A pointer to our parent object class
*/
-static GObjectClass *device_event_controller_parent_class;
+static GObjectClass *spi_device_event_controller_parent_class;
static gboolean kbd_registered = FALSE;
DEVICE_TYPE_LAST_DEFINED
} DeviceTypeCategory;
-static gboolean _controller_register_with_devices (DeviceEventController *controller);
-static gboolean _controller_grab_keyboard (DeviceEventController *controller);
+static gboolean _controller_register_with_devices (SpiDeviceEventController *controller);
+static gboolean _controller_grab_keyboard (SpiDeviceEventController *controller);
-static void _controller_register_device_listener (DeviceEventController *controller,
+static void _controller_register_device_listener (SpiDeviceEventController *controller,
const CORBA_Object l,
- const Accessibility_ControllerEventMask *mask,
DeviceTypeCategory type,
+ const Accessibility_KeySet *keys,
+ const Accessibility_ControllerEventMask *mask,
CORBA_Environment *ev);
/*
}
static void
-_controller_register_device_listener (DeviceEventController *controller,
+_controller_register_device_listener (SpiDeviceEventController *controller,
const CORBA_Object l,
- const Accessibility_ControllerEventMask *mask,
DeviceTypeCategory type,
+ const Accessibility_KeySet *keys,
+ const Accessibility_ControllerEventMask *mask,
CORBA_Environment *ev)
{
Accessibility_ControllerEventMask *mask_ptr = NULL;
}
static void
-_controller_deregister_device_listener (DeviceEventController *controller,
+_controller_deregister_device_listener (SpiDeviceEventController *controller,
const CORBA_Object l,
const Accessibility_ControllerEventMask *mask,
DeviceTypeCategory type,
}
static gboolean
-_controller_register_with_devices (DeviceEventController *controller)
+_controller_register_with_devices (SpiDeviceEventController *controller)
{
gboolean retval = FALSE;
}
static gboolean
-_check_key_event (DeviceEventController *controller)
+_check_key_event (SpiDeviceEventController *controller)
{
static gboolean initialized = FALSE;
static gboolean is_active = FALSE;
}
static gboolean
-_controller_grab_keyboard (DeviceEventController *controller)
+_controller_grab_keyboard (SpiDeviceEventController *controller)
{
GList *maskList = controller->keymask_list;
int i;
* Implemented GObject::finalize
*/
static void
-device_event_controller_object_finalize (GObject *object)
+spi_device_event_controller_object_finalize (GObject *object)
{
#ifdef SPI_DEBUG
- fprintf(stderr, "device_event_controller_object_finalize called\n");
+ fprintf(stderr, "spi_device_event_controller_object_finalize called\n");
#endif
- device_event_controller_parent_class->finalize (object);
+ spi_device_event_controller_parent_class->finalize (object);
}
/*
const Accessibility_KeySet *keys,
const Accessibility_ControllerEventMask *mask,
const Accessibility_KeyEventTypeSeq *type,
- const CORBA_boolean is_synchronous,
+ const CORBA_boolean is_system_global,
CORBA_Environment *ev)
{
- DeviceEventController *controller = DEVICE_EVENT_CONTROLLER (
+ SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER (
bonobo_object_from_servant (servant));
#ifdef SPI_DEBUG
fprintf (stderr, "registering keystroke listener %p with maskVal %lu\n",
(void *) l, (unsigned long) mask->value);
#endif
- /* TODO: change this to an enum, indicating if event can be consumed */
- if (is_synchronous)
- _controller_register_device_listener(controller, l, mask, DEVICE_TYPE_KBD, ev);
+ /* TODO: change this to an enum, indicating if event is caught at OS level */
+ if (is_system_global)
+ _controller_register_device_listener(controller, l, DEVICE_TYPE_KBD, keys, mask, ev);
else
; /* register with toolkit instead */
}
+
/*
* CORBA Accessibility::DeviceEventController::deregisterKeystrokeListener
* method implementation
const CORBA_boolean is_synchronous,
CORBA_Environment *ev)
{
- DeviceEventController *controller = DEVICE_EVENT_CONTROLLER (
+ SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER (
bonobo_object_from_servant (servant));
#ifdef SPI_DEBUG
fprintf (stderr, "deregistering keystroke listener %p with maskVal %lu\n",
const Accessibility_MouseListener *l,
CORBA_Environment *ev)
{
- DeviceEventController *controller = DEVICE_EVENT_CONTROLLER (
+ SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER (
bonobo_object_from_servant (servant));
#ifdef SPI_DEBUG
fprintf (stderr, "registering mouse listener %p\n", l);
#endif
- _controller_register_device_listener(controller, l, mask, DEVICE_TYPE_MOUSE, ev);
+ _controller_register_device_listener(controller, DEVICE_TYPE_MOUSE, l, keys, mask, ev);
}
*/
static void
impl_generate_key_event (PortableServer_Servant servant,
const CORBA_long keycode,
- const CORBA_long synth_type,
+ const Accessibility_KeySynthType synth_type,
CORBA_Environment *ev)
{
long key_synth_code;
}
static void
-device_event_controller_class_init (DeviceEventControllerClass *klass)
+spi_device_event_controller_class_init (SpiDeviceEventControllerClass *klass)
{
GObjectClass * object_class = (GObjectClass *) klass;
POA_Accessibility_DeviceEventController__epv *epv = &klass->epv;
- device_event_controller_parent_class = g_type_class_ref (BONOBO_OBJECT_TYPE);
+ spi_device_event_controller_parent_class = g_type_class_ref (BONOBO_OBJECT_TYPE);
- object_class->finalize = device_event_controller_object_finalize;
+ object_class->finalize = spi_device_event_controller_object_finalize;
epv->registerKeystrokeListener = impl_register_keystroke_listener;
epv->deregisterKeystrokeListener = impl_deregister_keystroke_listener;
}
static void
-device_event_controller_init (DeviceEventController *device_event_controller)
+spi_device_event_controller_init (SpiDeviceEventController *device_event_controller)
{
device_event_controller->key_listeners = NULL;
device_event_controller->mouse_listeners = NULL;
kbd_registered = _controller_register_with_devices (device_event_controller);
}
-gboolean device_event_controller_check_key_event (DeviceEventController *controller)
+gboolean spi_device_event_controller_check_key_event (SpiDeviceEventController *controller)
{
- DeviceEventControllerClass *klass = DEVICE_EVENT_CONTROLLER_GET_CLASS (controller);
+ SpiDeviceEventControllerClass *klass = SPI_DEVICE_EVENT_CONTROLLER_GET_CLASS (controller);
if (klass->check_key_event)
return (klass->check_key_event) (controller);
}
+SpiDeviceEventController *
+spi_device_event_controller_new (void *registryp)
+{
+ SpiRegistry *registry = SPI_REGISTRY (registryp);
+ SpiDeviceEventController *retval =
+ SPI_DEVICE_EVENT_CONTROLLER (g_object_new (SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL));
+ retval->registry = registry;
+ bonobo_object_ref (registry);
+ return retval;
+}
+
GType
-device_event_controller_get_type (void)
+spi_device_event_controller_get_type (void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo tinfo = {
- sizeof (DeviceEventControllerClass),
+ sizeof (SpiDeviceEventControllerClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
- (GClassInitFunc) device_event_controller_class_init,
+ (GClassInitFunc) spi_device_event_controller_class_init,
(GClassFinalizeFunc) NULL,
NULL, /* class data */
- sizeof (DeviceEventController),
+ sizeof (SpiDeviceEventController),
0, /* n preallocs */
- (GInstanceInitFunc) device_event_controller_init,
+ (GInstanceInitFunc) spi_device_event_controller_init,
NULL /* value table */
};
/*
PARENT_TYPE,
POA_Accessibility_DeviceEventController__init,
NULL,
- G_STRUCT_OFFSET (DeviceEventControllerClass, epv),
+ G_STRUCT_OFFSET (SpiDeviceEventControllerClass, epv),
&tinfo,
- "DeviceEventController");
+ "SpiDeviceEventController");
}
return type;