* Boston, MA 02111-1307, USA.
*/
-/*
- * listener.c: test for accessibility implementation
- *
- */
+/* deviceeventcontroler.c: implement the DeviceEventController interface */
+
+#include <config.h>
#ifdef SPI_DEBUG
-#include <stdio.h>
+# include <stdio.h>
#endif
-#include <stdlib.h> /* for getenv() */
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
-#include <config.h>
#include <gdk/gdkx.h> /* TODO: hide dependency (wrap in single porting file) */
#include <gdk/gdkwindow.h>
-#include <bonobo/Bonobo.h>
-#include <libspi/Accessibility.h>
-/*
- * This pulls the definition for the BonoboObject (GType)
- */
-#include "deviceeventcontroller.h"
+#include <libspi/deviceeventcontroller.h>
-/*
- * Our parent Gtk object type
- */
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
+/* Our parent Gtk object type */
+#define PARENT_TYPE BONOBO_TYPE_OBJECT
-/*
- * A pointer to our parent object class
- */
+/* A pointer to our parent object class */
static GObjectClass *spi_device_event_controller_parent_class;
static gboolean kbd_registered = FALSE;
static Window root_window;
typedef enum {
- SPI_DEVICE_TYPE_KBD,
- SPI_DEVICE_TYPE_MOUSE,
- SPI_DEVICE_TYPE_LAST_DEFINED
+ SPI_DEVICE_TYPE_KBD,
+ SPI_DEVICE_TYPE_MOUSE,
+ SPI_DEVICE_TYPE_LAST_DEFINED
} SpiDeviceTypeCategory;
struct _DEControllerListener {
- CORBA_Object object;
- SpiDeviceTypeCategory type;
+ CORBA_Object object;
+ SpiDeviceTypeCategory type;
};
typedef struct _DEControllerListener DEControllerListener;
struct _DEControllerKeyListener {
- DEControllerListener listener;
- Accessibility_KeySet *keys;
- Accessibility_ControllerEventMask *mask;
- Accessibility_KeyEventTypeSeq *typeseq;
- gboolean is_system_global;
+ DEControllerListener listener;
+ Accessibility_KeySet *keys;
+ Accessibility_ControllerEventMask *mask;
+ Accessibility_KeyEventTypeSeq *typeseq;
+ gboolean is_system_global;
};
typedef struct _DEControllerKeyListener DEControllerKeyListener;
*/
static gint
-_compare_listeners (gconstpointer p1, gconstpointer p2)
-{
- DEControllerListener *l1 = (DEControllerListener *) p1;
- DEControllerListener *l2 = (DEControllerListener *) p2;
- return _compare_corba_objects (l1->object, l2->object);
-}
-
-static gint
_compare_corba_objects (gconstpointer p1, gconstpointer p2)
{
CORBA_Environment ev;
}
static gint
+_compare_listeners (gconstpointer p1, gconstpointer p2)
+{
+ DEControllerListener *l1 = (DEControllerListener *) p1;
+ DEControllerListener *l2 = (DEControllerListener *) p2;
+ return _compare_corba_objects (l1->object, l2->object);
+}
+
+static gint
_eventmask_compare_value (gconstpointer p1, gconstpointer p2)
{
long d;
(unsigned long) GDK_ROOT_WINDOW(), GDK_DISPLAY());
#endif
/* We must open a new connection to the server to avoid clashing with the GDK event loop */
- display = XOpenDisplay (getenv ("DISPLAY"));
+ display = XOpenDisplay (g_getenv ("DISPLAY"));
root_window = DefaultRootWindow (display);
XSelectInput (display,
root_window,
{
GObjectClass * object_class = (GObjectClass *) klass;
POA_Accessibility_DeviceEventController__epv *epv = &klass->epv;
- spi_device_event_controller_parent_class = g_type_class_ref (BONOBO_OBJECT_TYPE);
+ spi_device_event_controller_parent_class = g_type_class_peek_parent (klass);
object_class->finalize = spi_device_event_controller_object_finalize;
kbd_registered = _controller_register_with_devices (device_event_controller);
}
-gboolean spi_device_event_controller_check_key_event (SpiDeviceEventController *controller)
+gboolean
+spi_device_event_controller_check_key_event (SpiDeviceEventController *controller)
{
SpiDeviceEventControllerClass *klass = SPI_DEVICE_EVENT_CONTROLLER_GET_CLASS (controller);
if (klass->check_key_event)
return retval;
}
-GType
-spi_device_event_controller_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo tinfo = {
- sizeof (SpiDeviceEventControllerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) spi_device_event_controller_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class data */
- sizeof (SpiDeviceEventController),
- 0, /* n preallocs */
- (GInstanceInitFunc) spi_device_event_controller_init,
- NULL /* value table */
- };
- /*
- * Here we use bonobo_type_unique instead of
- * gtk_type_unique, this auto-generates a load of
- * CORBA structures for us. All derived types must
- * use bonobo_type_unique.
- */
- type = bonobo_type_unique (
- PARENT_TYPE,
- POA_Accessibility_DeviceEventController__init,
- NULL,
- G_STRUCT_OFFSET (SpiDeviceEventControllerClass, epv),
- &tinfo,
- "SpiDeviceEventController");
- }
-
- return type;
-}
+BONOBO_TYPE_FUNC_FULL (SpiDeviceEventController,
+ Accessibility_DeviceEventController,
+ PARENT_TYPE,
+ spi_device_event_controller);