2002-03-04 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_registry.c
index 287bc0e..cc0dca2 100644 (file)
@@ -310,10 +310,10 @@ SPI_freeDesktopList (Accessible **desktop_list)
  * Returns: #TRUE if successful, otherwise #FALSE.
  **/
 SPIBoolean
-SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
-                                        AccessibleKeySet *keys,
-                                        AccessibleKeyMaskType modmask,
-                                        AccessibleKeyEventMask eventmask,
+SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener  *listener,
+                                        AccessibleKeySet             *keys,
+                                        AccessibleKeyMaskType         modmask,
+                                        AccessibleKeyEventMask        eventmask,
                                         AccessibleKeyListenerSyncType sync_type)
 {
   gint                                i, mask;
@@ -416,7 +416,7 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
  **/
 SPIBoolean
 SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
-                                          AccessibleKeyMaskType modmask)
+                                          AccessibleKeyMaskType        modmask)
 {
   Accessibility_ControllerEventMask   controller_event_mask;
   Accessibility_KeySet                key_set;
@@ -458,6 +458,11 @@ SPI_deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener
  * SPI_generateKeyboardEvent:
  * @keyval: a long integer indicating the keycode or keysym of the key event
  *           being synthesized.
+ * @keystring: an (optional) UTF-8 string which, if @keyval is NULL,
+ *           indicates a 'composed' keyboard input string which is 
+ *           being synthesized; this type of keyboard event synthesis does
+ *           not emulate hardware keypresses but injects the string 
+ *           as though a composing input method (such as XIM) were used.
  * @synth_type: a #AccessibleKeySynthType flag indicating whether @keyval
  *           is to be interpreted as a keysym rather than a keycode
  *           (CSPI_KEYSYM), or whether to synthesize
@@ -501,6 +506,8 @@ SPI_generateKeyboardEvent (long int keyval,
       case SPI_KEY_STRING:
          keysynth_type = Accessibility_KEY_STRING;
          break;
+      default:
+          return FALSE;
     }
 
   Accessibility_DeviceEventController_generateKeyboardEvent (device_event_controller,
@@ -521,18 +528,31 @@ SPI_generateKeyboardEvent (long int keyval,
  * @x: a #long indicating the screen x coordinate of the mouse event.
  * @y: a #long indicating the screen y coordinate of the mouse event.
  * @name: a string indicating which mouse event to be synthesized
- *        (e.g. "button1", "button2", "mousemove").
+ *        (e.g. "b1p", "b1c", "b2r", "rel", "abs").
  *
  * Synthesize a mouse event at a specific screen coordinate.
  * Most AT clients should use the #AccessibleAction interface when
  * tempted to generate mouse events, rather than this method.
- * Not Yet Implemented.
+ * Event names: b1p = button 1 press; b2r = button 2 release;
+ *              b3c = button 3 click; b2d = button 2 double-click;
+ *              abs = absolute motion; rel = relative motion.
  *
  * Returns: #TRUE if successful, otherwise #FALSE.
  **/
 SPIBoolean
 SPI_generateMouseEvent (long x, long y, char *name)
 {
-  return FALSE;
+  Accessibility_DeviceEventController device_event_controller = 
+         Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
+
+  cspi_return_val_if_ev ("getting event controller for mouse event gen", FALSE);
+
+  Accessibility_DeviceEventController_generateMouseEvent (device_event_controller,
+                                                         x, y, name, cspi_ev ());
+  cspi_return_val_if_ev ("generating mouse event", FALSE);
+
+  cspi_release_unref (device_event_controller);
+
+  return TRUE;
 }