[at-spi2-core] Fix mouse:button events



commit e30d4dec86a55b00b1e51751cc9af818a8e6d694
Author: Mike Gorse <mgorse novell com>
Date:   Mon Jan 11 08:45:11 2010 -0500

    Fix mouse:button events
    
    From Gerd Kohlberger <lowfi chello at>:
    Bug#25962: Button events don't contain button number and state

 registryd/deviceeventcontroller.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index 1afd2ef..d094f2c 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -393,12 +393,11 @@ spi_dec_clear_unlatch_pending (SpiDEController *controller)
   priv->xkb_latch_mask = 0;
 }
 
-static void emit(SpiDEController *controller, const char *interface, const char *name, int a1, int a2)
+static void emit(SpiDEController *controller, const char *interface, const char *name, const char *minor, int a1, int a2)
 {
   DBusMessage *signal = NULL;
   DBusMessageIter iter, iter_variant;
   int nil = 0;
-  const char *minor = "";
   const char *path = SPI_DBUS_PATH_DESKTOP;
 
   signal = dbus_message_new_signal (path, interface, name);
@@ -420,7 +419,7 @@ spi_dec_button_update_and_emit (SpiDEController *controller,
 				guint mask_return)
 {
   Accessibility_DeviceEvent mouse_e;
-  gchar event_detail[24];
+  gchar event_detail[3];
   gboolean is_consumed = FALSE;
 
   if ((mask_return & mouse_button_mask) !=
@@ -499,7 +498,7 @@ spi_dec_button_update_and_emit (SpiDEController *controller,
 	fprintf (stderr, "Button %d %s\n",
 		 button_number, (is_down) ? "Pressed" : "Released");
 #endif
-	snprintf (event_detail, 22, "%d%c", button_number,
+	snprintf (event_detail, 3, "%d%c", button_number,
 		  (is_down) ? 'p' : 'r');
 	/* TODO: FIXME distinguish between physical and 
 	 * logical buttons 
@@ -519,7 +518,7 @@ spi_dec_button_update_and_emit (SpiDEController *controller,
 	if (!is_consumed)
 	  {
 	    dbus_uint32_t x = last_mouse_pos->x, y = last_mouse_pos->y;
-	    emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Button", x, y);
+	    emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Button", event_detail, x, y);
 	  }
 	else
 	  spi_dec_set_unlatch_pending (controller, mask_return);
@@ -563,10 +562,10 @@ spi_dec_mouse_check (SpiDEController *controller,
     {
       // TODO: combine these two signals?
       dbus_uint32_t ix = *x, iy = *y;
-      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Abs", ix, iy);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Abs", "", ix, iy);
       ix -= last_mouse_pos->x;
       iy -= last_mouse_pos->y;
-      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Rel", ix, iy);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Rel", "", ix, iy);
       last_mouse_pos->x = *x;
       last_mouse_pos->y = *y;
       *moved = True;
@@ -598,7 +597,7 @@ spi_dec_emit_modifier_event (SpiDEController *controller, guint prev_mask,
 
   d1 = prev_mask & key_modifier_mask;
   d2 = current_mask & key_modifier_mask;
-      emit(controller, SPI_DBUS_INTERFACE_EVENT_KEYBOARD, "Modifiers", d1, d2);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_KEYBOARD, "Modifiers", "", d1, d2);
 }
 
 static gboolean
@@ -1100,7 +1099,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller,
 						 XEvent *xevent)
 {
   Accessibility_DeviceEvent mouse_e;
-  gchar event_detail[24];
+  gchar event_detail[3];
   gboolean is_consumed = FALSE;
   gboolean xkb_mod_unlatch_occurred;
   XButtonEvent *xbutton_event = (XButtonEvent *) xevent;
@@ -1138,7 +1137,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller,
 	   (xevent->type == ButtonPress) ? "Press" : "Release",
 	   mouse_button_state);
 #endif
-  snprintf (event_detail, 22, "%d%c", button,
+  snprintf (event_detail, 3, "%d%c", button,
 	    (xevent->type == ButtonPress) ? 'p' : 'r');
 
   /* TODO: FIXME distinguish between physical and logical buttons */
@@ -1163,8 +1162,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller,
 	spi_controller_notify_mouselisteners (controller, &mouse_e);
       ix = last_mouse_pos->x;
       iy = last_mouse_pos->y;
-      /* TODO - Work out which part of the spec this emit is fulfilling */
-      //emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "button", event_detail, ix, iy);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "Button", event_detail, ix, iy);
     }
 
   xkb_mod_unlatch_occurred = (xevent->type == ButtonPress ||



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]