X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=registryd%2Fdeviceeventcontroller.c;h=cd25642c1ad16538772abade29fc6197ebe98112;hb=f546ac72097fabd106a0cf277d4db389b811014c;hp=9d2e6e1c5612f70c9d8b8841b1bbb85672a3b913;hpb=783e63cad5945ddb6df3ee129d20d5b53c6cce04;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index 9d2e6e1..cd25642 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -20,37 +20,25 @@ * Boston, MA 02111-1307, USA. */ -/* - * listener.c: test for accessibility implementation - * - */ +/* deviceeventcontroler.c: implement the DeviceEventController interface */ + +#include #ifdef SPI_DEBUG -#include +# include #endif -#include /* for getenv() */ #include #include -#include #include /* TODO: hide dependency (wrap in single porting file) */ #include -#include -#include -/* - * This pulls the definition for the BonoboObject (GType) - */ -#include "deviceeventcontroller.h" +#include -/* - * 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; @@ -60,24 +48,24 @@ static Display *display; 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; @@ -94,14 +82,6 @@ static void controller_register_device_listener (SpiDeviceEventController *contr */ 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; @@ -117,6 +97,14 @@ _compare_corba_objects (gconstpointer p1, gconstpointer p2) } 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; @@ -243,7 +231,7 @@ _controller_register_with_devices (SpiDeviceEventController *controller) (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, @@ -539,7 +527,7 @@ spi_device_event_controller_class_init (SpiDeviceEventControllerClass *klass) { 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; @@ -560,7 +548,8 @@ spi_device_event_controller_init (SpiDeviceEventController *device_event_control 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) @@ -578,39 +567,8 @@ spi_device_event_controller_new (void *registryp) 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);