2001-11-20 Michael Meeks <michael@ximian.com>
+ * libspi/registry.c
+ (impl_accessibility_registry_deregister_global_event_listener):
+ segv. protection.
+
+ * libspi/deviceeventcontroller.c
+ (spi_device_event_controller_check_key_event): return
+ FALSE on no virtual method.
+
+ * libspi/*..h: make includes work on a correctly pathed install.
+
+ * libspi/*.h: include glib/gmacros.h, use G_BEGIN / END _DECLS.
+
+ * libspi/application.h: kill unused ( and whacked out )
+ gboolean *spi_application_set_id (AtkObject *app, long id);
+
+2001-11-20 Michael Meeks <michael@ximian.com>
+
* libspi/*.[ch]: further convert to bonobo's type func
macros, remove redundnant casts etc.
INCLUDES = -I $(top_srcdir) \
-I $(top_builddir) \
- -I $(top_srcdir)/libspi \
- -I $(top_builddir)/libspi \
$(LIBSPI_CFLAGS)
LDFLAGS = $(LIBSPI_LIBS) -lXtst @LT_VERSION_INFO@
#ifndef SPI_ACCESSIBLE_H_
#define SPI_ACCESSIBLE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+#include <glib/gmacros.h>
#include <bonobo/bonobo-object.h>
#include <atk/atkobject.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_ACCESSIBLE_TYPE (spi_accessible_get_type ())
#define SPI_ACCESSIBLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_ACCESSIBLE_TYPE, SpiAccessible))
#define SPI_ACCESSIBLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_ACCESSIBLE_TYPE, SpiAccessibleClass))
SpiAccessible *spi_accessible_new (AtkObject *o);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_ACCESSIBLE_H_ */
#ifndef SPI_ACCESSIBLE_EVENT_LISTENER_H_
#define SPI_ACCESSIBLE_EVENT_LISTENER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#include <libspi/listener.h>
-#include "listener.h"
+G_BEGIN_DECLS
#define SPI_ACCESSIBLE_EVENT_SPI_LISTENER_TYPE (spi_event_listener_get_type ())
#define SPI_ACCESSIBLE_EVENT_SPI_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_ACCESSIBLE_EVENT_SPI_LISTENER_TYPE, SpiEventListener))
void spi_event_listener_remove_callback (SpiEventListener *listener,
VoidSpiEventListenerCB callback);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_ACCESSIBLE_EVENT_SPI_LISTENER_H_ */
#ifndef SPI_ACTION_H_
#define SPI_ACTION_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_ACTION_TYPE (spi_action_get_type ())
#define SPI_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_ACTION_TYPE, SpiAction))
#define SPI_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_ACTION_TYPE, SpiActionClass))
SpiAction *
spi_action_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_ACTION_H_ */
#ifndef SPI_APPLICATION_H_
#define SPI_APPLICATION_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+#include <glib/gmacros.h>
#include <atk/atkobject.h>
-#include <accessible.h>
-#include <application.h>
+#include <libspi/accessible.h>
+#include <libspi/application.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_APPLICATION_TYPE (spi_application_get_type ())
#define SPI_APPLICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_APPLICATION_TYPE, SpiApplication))
#define SPI_APPLICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_APPLICATION_TYPE, SpiApplicationClass))
GHashTable *generic_event_names;
} SpiApplicationClass;
-GType spi_application_get_type (void);
-gboolean *spi_application_set_id (AtkObject *app, long id);
-SpiApplication *spi_application_new (AtkObject *app_root);
-
+GType spi_application_get_type (void);
+SpiApplication *spi_application_new (AtkObject *app_root);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_APPLICATION_H_ */
#ifndef SPI_COMPONENT_H_
#define SPI_COMPONENT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_COMPONENT_TYPE (spi_component_get_type ())
#define SPI_COMPONENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_COMPONENT_TYPE, SpiComponent))
#define SPI_COMPONENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_COMPONENT_TYPE, SpiComponentClass))
GType spi_component_get_type (void);
SpiComponent *spi_component_interface_new (AtkObject *o);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_COMPONENT_H_ */
#ifndef SPI_DESKTOP_H_
#define SPI_DESKTOP_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-xobject.h>
#include <atk/atkobject.h>
-#include <accessible.h>
-#include <application.h>
+#include <libspi/accessible.h>
+#include <libspi/application.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_DESKTOP_TYPE (spi_desktop_get_type ())
#define SPI_DESKTOP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_DESKTOP_TYPE, SpiDesktop))
#define SPI_DESKTOP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_DESKTOP_TYPE, SpiDesktopClass))
void spi_desktop_remove_application (SpiApplication *app);
SpiDesktop *spi_desktop_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_DESKTOP_H_ */
/* register with: keyboard hardware code handler */
/* register with: (translated) keystroke handler */
#ifdef SPI_DEBUG
- fprintf (stderr, "About to request events on window %ld of display %x\n",
+ fprintf (stderr, "About to request events on window %ld of display %p\n",
(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 */
_check_key_event (SpiDeviceEventController *controller)
{
static gboolean initialized = FALSE;
- static gboolean is_active = FALSE;
XEvent *x_event = g_new0 (XEvent, 1);
XKeyEvent *x_key_event;
KeySym keysym;
gboolean is_consumed = FALSE;
- char key_name[16];
- int i;
Accessibility_KeyStroke key_event;
static CORBA_Environment ev;
(int) x_key_event->state);
#endif
#ifdef SPI_DEBUG
- fprintf(stderr, "%s%c",
- (x_key_event->state & Mod1Mask)?"Alt-":"",
- ((x_key_event->state & ShiftMask)^(x_key_event->state & LockMask))?
- (char) toupper((int) keysym) : (char) tolower((int)keysym));
+ fprintf (stderr, "%s%c",
+ (x_key_event->state & Mod1Mask)?"Alt-":"",
+ ((x_key_event->state & ShiftMask)^(x_key_event->state & LockMask))?
+ g_ascii_toupper (keysym) : g_ascii_tolower (keysym));
#endif /* SPI_DEBUG */
}
else
* method implementation
*/
static void
-impl_generate_mouse_event (PortableServer_Servant servant,
- const CORBA_long x,
- const CORBA_long y,
- const CORBA_char * eventName,
- CORBA_Environment *ev)
+impl_generate_mouse_event (PortableServer_Servant servant,
+ const CORBA_long x,
+ const CORBA_long y,
+ const CORBA_char *eventName,
+ CORBA_Environment *ev)
{
#ifdef SPI_DEBUG
fprintf (stderr, "generating mouse %s event at %ld, %ld\n", eventName, x, y);
SpiDeviceEventControllerClass *klass = SPI_DEVICE_EVENT_CONTROLLER_GET_CLASS (controller);
if (klass->check_key_event)
return (klass->check_key_event) (controller);
+ return FALSE;
}
SpiDeviceEventController *
#ifndef SPI_DEVICE_EVENT_CONTROLLER_H_
#define SPI_DEVICE_EVENT_CONTROLLER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <libspi/Accessibility.h>
-#include "keystrokelistener.h"
-#include "registry.h"
+#include <libspi/keystrokelistener.h>
+#include <libspi/registry.h>
+
+G_BEGIN_DECLS
#define SPI_DEVICE_EVENT_CONTROLLER_TYPE (spi_device_event_controller_get_type ())
#define SPI_DEVICE_EVENT_CONTROLLER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_DEVICE_EVENT_CONTROLLER_TYPE, SpiDeviceEventController))
GType spi_device_event_controller_get_type (void);
SpiDeviceEventController *spi_device_event_controller_new (void *registry);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* DEVICEEVENTCONTROLLER_H_ */
#ifndef SPI_EDITABLE_TEXT_H_
#define SPI_EDITABLE_TEXT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
-#include "text.h"
+#include <libspi/text.h>
+
+G_BEGIN_DECLS
#define SPI_EDITABLE_TEXT_TYPE (spi_editable_text_get_type ())
#define SPI_EDITABLE_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_EDITABLE_TEXT_TYPE, SpiEditableText))
SpiEditableText *
spi_editable_text_interface_new ( AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_EDITABLE_TEXT_H_ */
#ifndef SPI_ACCESSIBLE_EVENT_LISTENER_H_
#define SPI_ACCESSIBLE_EVENT_LISTENER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#include <libspi/listener.h>
-#include "listener.h"
+G_BEGIN_DECLS
#define SPI_ACCESSIBLE_EVENT_SPI_LISTENER_TYPE (spi_event_listener_get_type ())
#define SPI_ACCESSIBLE_EVENT_SPI_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_ACCESSIBLE_EVENT_SPI_LISTENER_TYPE, SpiEventListener))
void spi_event_listener_remove_callback (SpiEventListener *listener,
VoidSpiEventListenerCB callback);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_ACCESSIBLE_EVENT_SPI_LISTENER_H_ */
#ifndef SPI_HYPERLINK_H_
#define SPI_HYPERLINK_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_HYPERLINK_TYPE (spi_hyperlink_get_type ())
#define SPI_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_HYPERLINK_TYPE, SpiHyperlink))
#define SPI_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_HYPERLINK_TYPE, SpiHyperlinkClass))
SpiHyperlink *
spi_hyperlink_new ();
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_HYPERLINK_H_ */
#ifndef SPI_HYPERTEXT_H_
#define SPI_HYPERTEXT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_HYPERTEXT_TYPE (spi_hypertext_get_type ())
#define SPI_HYPERTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_HYPERTEXT_TYPE, SpiHypertext))
#define SPI_HYPERTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_HYPERTEXT_TYPE, SpiHypertextClass))
GType spi_hypertext_get_type (void);
SpiHypertext *spi_hypertext_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_HYPERTEXT_H_ */
#ifndef SPI_IMAGE_H_
#define SPI_IMAGE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_IMAGE_TYPE (spi_image_get_type ())
#define SPI_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_IMAGE_TYPE, SpiImage))
#define SPI_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_IMAGE_TYPE, SpiImageClass))
SpiImage *
spi_image_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_IMAGE_H_ */
#ifndef _SPI_KEYMASKS_H_
#define _SPI_KEYMASKS_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <X11/Xlib.h>
+#include <glib/gmacros.h>
+
+G_BEGIN_DECLS
typedef unsigned long SpiKeyMaskType;
#define SPI_KEYMASK_SHIFTLOCK LockMask
#define SPI_KEYMASK_UNMODIFIED 0
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
#endif
#ifndef SPI_KEYSTROKE_LISTENER_H_
#define SPI_KEYSTROKE_LISTENER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atkobject.h>
#include <libspi/Accessibility.h>
-#include "keymasks.h"
+#include <libspi/keymasks.h>
+
+G_BEGIN_DECLS
#define SPI_KEYSTROKE_LISTENER_TYPE (spi_keystroke_listener_get_type ())
#define SPI_KEYSTROKE_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_KEYSTROKE_LISTENER_TYPE, SpiKeystrokeListener))
BooleanKeystrokeListenerCB callback);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* KEYSTROKE_SPI_LISTENER_H_ */
#ifndef SPI_LISTENER_H_
#define SPI_LISTENER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atkobject.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_LISTENER_TYPE (spi_listener_get_type ())
#define SPI_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_LISTENER_TYPE, SpiListener))
#define SPI_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_LISTENER_TYPE, SpiListenerClass))
GType spi_listener_get_type (void);
SpiListener *spi_listener_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_LISTENER_H_ */
* Anyone want to help?
*/
#include <X11/Xlib.h>
+#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <libspi/registry.h>
static void
parse_event_type (EventTypeStruct *etype, char *event_name)
{
- guint nbytes = 0;
gchar **split_string;
split_string = g_strsplit(event_name, ":", 4);
SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
SpiListenerStruct *ls = g_malloc (sizeof (SpiListenerStruct));
EventTypeStruct etype;
- gboolean is_toolkit_specific = TRUE;
fprintf(stderr, "registering for events of type %s\n", event_name);
listeners = ®istry->toolkit_listeners;
break;
default:
+ listeners = NULL;
break;
}
+ if (!listeners)
+ return;
+
ls.event_type_hash = etype.hash;
list = g_list_find_custom (*listeners, &ls, compare_listener_hash);
}
}
-static gboolean _device_event_controller_hook (gpointer p)
+static gboolean
+_device_event_controller_hook (gpointer p)
{
SpiRegistry *registry = (SpiRegistry *)p;
SpiDeviceEventController *controller = registry->device_event_controller;
#ifndef SPI_REGISTRY_H_
#define SPI_REGISTRY_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <glib/gmain.h>
-#include <libspi/Accessibility.h>
-#include "listener.h"
-#include "desktop.h"
-#include "deviceeventcontroller.h"
+#include <libspi/listener.h>
+#include <libspi/desktop.h>
+#include <libspi/deviceeventcontroller.h>
+
+G_BEGIN_DECLS
#define SPI_REGISTRY_TYPE (spi_registry_get_type ())
#define SPI_REGISTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_REGISTRY_TYPE, SpiRegistry))
POA_Accessibility_Registry__epv epv;
} SpiRegistryClass;
-GType spi_registry_get_type (void);
-SpiRegistry *spi_registry_new (void);
+GType spi_registry_get_type (void);
+SpiRegistry *spi_registry_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_REGISTRY_H_ */
#ifndef SPI_RELATION_H_
#define SPI_RELATION_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_RELATION_TYPE (spi_relation_get_type ())
#define SPI_RELATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_RELATION_TYPE, SpiRelation))
#define SPI_RELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_RELATION_TYPE, SpiRelationClass))
SpiRelation *
spi_relation_new (AtkRelation *relation);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_RELATION_H_ */
#ifndef SPI_SELECTION_H_
#define SPI_SELECTION_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_SELECTION_TYPE (spi_selection_get_type ())
#define SPI_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_SELECTION_TYPE, SpiSelection))
#define SPI_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_SELECTION_TYPE, SpiSelectionClass))
SpiSelection *
spi_selection_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_SELECTION_H_ */
#ifndef SPI_TABLE_H_
#define SPI_TABLE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_TABLE_TYPE (spi_table_get_type ())
#define SPI_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_TABLE_TYPE, SpiTable))
#define SPI_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_TABLE_TYPE, SpiTableClass))
SpiTable *
spi_table_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_TABLE_H_ */
#ifndef SPI_TEXT_H_
#define SPI_TEXT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
-#include "accessible.h"
+#include <libspi/accessible.h>
+
+G_BEGIN_DECLS
#define SPI_TEXT_TYPE (spi_text_get_type ())
#define SPI_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_TEXT_TYPE, SpiText))
GType spi_text_get_type (void);
SpiText *spi_text_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_TEXT_H_ */
#ifndef SPI_VALUE_H_
#define SPI_VALUE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <atk/atk.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_VALUE_TYPE (spi_value_get_type ())
#define SPI_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_VALUE_TYPE, SpiValue))
#define SPI_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_VALUE_TYPE, SpiValueClass))
POA_Accessibility_Value__epv epv;
};
-GType
-spi_value_get_type (void);
-
-SpiValue *
-spi_value_interface_new (AtkObject *obj);
+GType spi_value_get_type (void);
+SpiValue *spi_value_interface_new (AtkObject *obj);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_VALUE_H_ */
#ifndef SPI_DESKTOP_H_
#define SPI_DESKTOP_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-xobject.h>
#include <atk/atkobject.h>
-#include <accessible.h>
-#include <application.h>
+#include <libspi/accessible.h>
+#include <libspi/application.h>
#include <libspi/Accessibility.h>
+G_BEGIN_DECLS
+
#define SPI_DESKTOP_TYPE (spi_desktop_get_type ())
#define SPI_DESKTOP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_DESKTOP_TYPE, SpiDesktop))
#define SPI_DESKTOP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_DESKTOP_TYPE, SpiDesktopClass))
void spi_desktop_remove_application (SpiApplication *app);
SpiDesktop *spi_desktop_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_DESKTOP_H_ */
/* register with: keyboard hardware code handler */
/* register with: (translated) keystroke handler */
#ifdef SPI_DEBUG
- fprintf (stderr, "About to request events on window %ld of display %x\n",
+ fprintf (stderr, "About to request events on window %ld of display %p\n",
(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 */
_check_key_event (SpiDeviceEventController *controller)
{
static gboolean initialized = FALSE;
- static gboolean is_active = FALSE;
XEvent *x_event = g_new0 (XEvent, 1);
XKeyEvent *x_key_event;
KeySym keysym;
gboolean is_consumed = FALSE;
- char key_name[16];
- int i;
Accessibility_KeyStroke key_event;
static CORBA_Environment ev;
(int) x_key_event->state);
#endif
#ifdef SPI_DEBUG
- fprintf(stderr, "%s%c",
- (x_key_event->state & Mod1Mask)?"Alt-":"",
- ((x_key_event->state & ShiftMask)^(x_key_event->state & LockMask))?
- (char) toupper((int) keysym) : (char) tolower((int)keysym));
+ fprintf (stderr, "%s%c",
+ (x_key_event->state & Mod1Mask)?"Alt-":"",
+ ((x_key_event->state & ShiftMask)^(x_key_event->state & LockMask))?
+ g_ascii_toupper (keysym) : g_ascii_tolower (keysym));
#endif /* SPI_DEBUG */
}
else
* method implementation
*/
static void
-impl_generate_mouse_event (PortableServer_Servant servant,
- const CORBA_long x,
- const CORBA_long y,
- const CORBA_char * eventName,
- CORBA_Environment *ev)
+impl_generate_mouse_event (PortableServer_Servant servant,
+ const CORBA_long x,
+ const CORBA_long y,
+ const CORBA_char *eventName,
+ CORBA_Environment *ev)
{
#ifdef SPI_DEBUG
fprintf (stderr, "generating mouse %s event at %ld, %ld\n", eventName, x, y);
SpiDeviceEventControllerClass *klass = SPI_DEVICE_EVENT_CONTROLLER_GET_CLASS (controller);
if (klass->check_key_event)
return (klass->check_key_event) (controller);
+ return FALSE;
}
SpiDeviceEventController *
#ifndef SPI_DEVICE_EVENT_CONTROLLER_H_
#define SPI_DEVICE_EVENT_CONTROLLER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <bonobo/bonobo-object.h>
#include <libspi/Accessibility.h>
-#include "keystrokelistener.h"
-#include "registry.h"
+#include <libspi/keystrokelistener.h>
+#include <libspi/registry.h>
+
+G_BEGIN_DECLS
#define SPI_DEVICE_EVENT_CONTROLLER_TYPE (spi_device_event_controller_get_type ())
#define SPI_DEVICE_EVENT_CONTROLLER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_DEVICE_EVENT_CONTROLLER_TYPE, SpiDeviceEventController))
GType spi_device_event_controller_get_type (void);
SpiDeviceEventController *spi_device_event_controller_new (void *registry);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* DEVICEEVENTCONTROLLER_H_ */
* Anyone want to help?
*/
#include <X11/Xlib.h>
+#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <libspi/registry.h>
static void
parse_event_type (EventTypeStruct *etype, char *event_name)
{
- guint nbytes = 0;
gchar **split_string;
split_string = g_strsplit(event_name, ":", 4);
SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant));
SpiListenerStruct *ls = g_malloc (sizeof (SpiListenerStruct));
EventTypeStruct etype;
- gboolean is_toolkit_specific = TRUE;
fprintf(stderr, "registering for events of type %s\n", event_name);
listeners = ®istry->toolkit_listeners;
break;
default:
+ listeners = NULL;
break;
}
+ if (!listeners)
+ return;
+
ls.event_type_hash = etype.hash;
list = g_list_find_custom (*listeners, &ls, compare_listener_hash);
}
}
-static gboolean _device_event_controller_hook (gpointer p)
+static gboolean
+_device_event_controller_hook (gpointer p)
{
SpiRegistry *registry = (SpiRegistry *)p;
SpiDeviceEventController *controller = registry->device_event_controller;
#ifndef SPI_REGISTRY_H_
#define SPI_REGISTRY_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <glib/gmain.h>
-#include <libspi/Accessibility.h>
-#include "listener.h"
-#include "desktop.h"
-#include "deviceeventcontroller.h"
+#include <libspi/listener.h>
+#include <libspi/desktop.h>
+#include <libspi/deviceeventcontroller.h>
+
+G_BEGIN_DECLS
#define SPI_REGISTRY_TYPE (spi_registry_get_type ())
#define SPI_REGISTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_REGISTRY_TYPE, SpiRegistry))
POA_Accessibility_Registry__epv epv;
} SpiRegistryClass;
-GType spi_registry_get_type (void);
-SpiRegistry *spi_registry_new (void);
+GType spi_registry_get_type (void);
+SpiRegistry *spi_registry_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* SPI_REGISTRY_H_ */