Fixed 'make dist', and added:
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_registry.c
1
2 /*
3  *
4  * Global functions serviced by the registry
5  *
6  */
7
8 /**
9  * registerGlobalEventListener:
10  * @listener: the #AccessibleEventListener to be registered against an event type.
11  * @callback: a character string indicating the type of events for which
12  *            notification is requested.  Format is
13  *            EventClass:major_type:minor_type:detail
14  *            where all subfields other than EventClass are optional.
15  *            EventClasses include "Focus", "Window", "Mouse",
16  *            and toolkit events (e.g. "Gtk", "AWT").
17  *            Examples: "focus:", "Gtk:GtkWidget:button_press_event".
18  *
19  * NOTE: this string may be UTF-8, but should not contain byte value 56 (ascii ':'),
20  *            except as a delimiter, since non-UTF-8 string delimiting
21  *            functions are used internally.  In general, listening to
22  *            toolkit-specific events is not recommended.
23  *
24  * Add an in-process callback function to an existing AccessibleEventListener.
25  *
26  * Returns: #TRUE if successful, otherwise #FALSE.
27  *
28  **/
29 boolean
30 registerGlobalEventListener (AccessibleEventListener *listener,
31                              char *eventType)
32 {
33   Accessibility_Registry_registerGlobalEventListener (
34                          registry,
35                          (Accessibility_EventListener)
36                             bonobo_object_corba_objref (bonobo_object (listener)),
37                          eventType,
38                          &ev);
39
40   if (ev._major != CORBA_NO_EXCEPTION)
41     {
42     return FALSE;
43     }
44   else
45     {
46       return TRUE;
47     }
48 }
49
50 /**
51  * getDesktopCount:
52  *
53  * Get the number of virtual desktops.
54  * NOTE: currently multiple virtual desktops are not implemented, this
55  *       function always returns '1'.
56  *
57  * Returns: an integer indicating the number of active virtual desktops.
58  *
59  **/
60 int
61 getDesktopCount ()
62 {
63   return Accessibility_Registry_getDesktopCount (registry, &ev);
64 }
65
66 /**
67  * getDesktop:
68  * @i: an integer indicating which of the accessible desktops is to be returned.
69  *
70  * Get the virtual desktop indicated by index @i.
71  * NOTE: currently multiple virtual desktops are not implemented, this
72  *       function always returns '1'.
73  *
74  * Returns: a pointer to the 'i-th' virtual desktop's #Accessible representation.
75  *
76  **/
77 Accessible*
78 getDesktop (int n)
79 {
80   return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) n, &ev));
81 }
82
83 /**
84  * getDesktopList:
85  * @list: a pointer to an array of #Accessible objects.
86  *
87  * Get the list of virtual desktops.  On return, @list will point
88  *     to a newly-created array of virtual desktop pointers.
89  *     It is the responsibility of the caller to free this array when
90  *     it is no longer needed.
91  *
92  * Not Yet Implemented.
93  *
94  * Returns: an integer indicating how many virtual desktops have been
95  *          placed in the list pointed to by parameter @list.
96  **/
97 int
98 getDesktopList (Accessible **list)
99 {
100   *list = NULL;
101   return 0;
102 }
103
104 /**
105  * registerKeystrokeListener:
106  * @listener: a pointer to the #KeystrokeListener for which
107  *            keystroke events are requested.
108  *
109  * Not Yet Implemented.
110  *
111  **/
112 void
113 registerKeystrokeListener (KeystrokeListener *listener, KeyMaskType keymask)
114 {
115   Accessibility_ControllerEventMask *controller_event_mask =
116           Accessibility_ControllerEventMask__alloc();
117   Accessibility_DeviceEventController device_event_controller = 
118           Accessibility_Registry_getDeviceEventController (registry, &ev);
119   Accessibility_DeviceEventController_ref (device_event_controller, &ev);
120   controller_event_mask->value = (CORBA_unsigned_long) keymask;
121   controller_event_mask->refcount = (CORBA_unsigned_short) 1;
122   /*
123   fprintf (stderr, "controller %p, mask value %lu\n", (void *) device_event_controller,
124            (unsigned long) controller_event_mask->value );
125   */
126   Accessibility_DeviceEventController_generateKeyEvent (device_event_controller,
127                                                         (CORBA_long) 32, &ev);
128   Accessibility_DeviceEventController_registerKeystrokeListener (
129           device_event_controller,
130           (Accessibility_KeystrokeListener)
131               bonobo_object_corba_objref (bonobo_object (listener)),
132           controller_event_mask,
133           &ev);
134 }
135
136 /**
137  * generateKeyEvent:
138  * @keycode: a #long indicating the keycode of the key event
139  *           being synthesized.
140  * @meta: a #long indicating the key modifiers to be sent
141  *        with the event, if any.
142  *
143  * Synthesize a keyboard event (as if a hardware keyboard event occurred in the
144  * current UI context).
145  * Not Yet Implemented.
146  *
147  **/
148 void
149 generateKeyEvent (long keyCode, long meta)
150 {
151   ;
152 }
153
154 /**
155  * generateMouseEvent:
156  * @x: a #long indicating the screen x coordinate of the mouse event.
157  * @y: a #long indicating the screen y coordinate of the mouse event.
158  * @name: a string indicating which mouse event to be synthesized
159  *        (e.g. "button1", "button2", "mousemove").
160  *
161  * Synthesize a mouse event at a specific screen coordinate.
162  * Not Yet Implemented.
163  *
164  **/
165 void
166 generateMouseEvent (long x, long y, char *name)
167 {
168   ;
169 }
170