Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-spi/ChangeLog,v
retrieving revision 1.289
diff -u -r1.289 ChangeLog
--- ChangeLog	7 Mar 2003 15:34:36 -0000	1.289
+++ ChangeLog	10 Mar 2003 12:53:01 -0000
@@ -1,5 +1,21 @@
 2003-03-07  Padraig O'Briain <padraig.obriain@sun.com>
 
+	[needed by GOK, to fix bugs 107985 and 107988]
+	* registryd/deviceeventcontroller.c:
+	(spi_dec_clear_unlatch_pending):
+	New method, unsets the 'unlatch' mask for XkbStateNotifyEvents.
+	(spi_dec_set_unlatch_pending):Revised DEBUG comment.
+	(spi_dec_init_mouse_listener):Emit warning if mouse button
+	passive grab fails.
+	(spi_device_event_controller_forward_mouse_event):
+	Removed unnecessary parens from a conditional.
+	(global_filter_fn):Added TODO comment.
+	(impl_generate_keyboard_event):
+	Cancel a pending relatch if a 'delatching' key was 
+	synthesized.
+	
+2003-03-07  Padraig O'Briain <padraig.obriain@sun.com>
+
 	* atk-bridge/bridge.c:
 	Change atk_signal_child_changed to atk_signal_children_changed. 
 	Reorganize code in spi_atk_bridge_signal_listener().
Index: registryd/deviceeventcontroller.c
===================================================================
RCS file: /cvs/gnome/at-spi/registryd/deviceeventcontroller.c,v
retrieving revision 1.64
diff -u -r1.64 deviceeventcontroller.c
--- registryd/deviceeventcontroller.c	28 Feb 2003 15:17:38 -0000	1.64
+++ registryd/deviceeventcontroller.c	10 Mar 2003 12:53:02 -0000
@@ -186,11 +186,20 @@
   DEControllerPrivateData *priv = 
     g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
 #ifdef SPI_XKB_DEBUG
-  if (priv->xkb_latch_mask) fprintf (stderr, "unlatch pending! %x\n", mask);
+  if (priv->xkb_latch_mask) fprintf (stderr, "unlatch pending! %x\n", 
+				     priv->xkb_latch_mask);
 #endif
   priv->pending_xkb_mod_relatch_mask |= priv->xkb_latch_mask; 
 }
  
+static void
+spi_dec_clear_unlatch_pending (SpiDEController *controller)
+{
+  DEControllerPrivateData *priv = 
+    g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
+  priv->xkb_latch_mask = 0; 
+}
+ 
 static gboolean
 spi_dec_button_update_and_emit (SpiDEController *controller, 
 				guint mask_return)
@@ -468,10 +477,11 @@
 
   if (display)
     {
-      XGrabButton (display, AnyButton, AnyModifier,
+      if (XGrabButton (display, AnyButton, AnyModifier,
 		   gdk_x11_get_default_root_xwindow (),
 		   True, ButtonPressMask | ButtonReleaseMask,
-		   GrabModeSync, GrabModeAsync, None, None);
+		   GrabModeSync, GrabModeAsync, None, None) != Success)
+	fprintf (stderr, "WARNING: could not grab mouse buttons!\n");
       XSync (display, False);
 #ifdef SPI_DEBUG
       fprintf (stderr, "mouse buttons grabbed\n");
@@ -811,7 +821,7 @@
   int button = xbutton_event->button;
   
   unsigned int mouse_button_state = xbutton_event->state;
-  
+
   switch (button)
     {
     case 1:
@@ -881,7 +891,7 @@
   /* if client wants to consume this event, and XKB latch state was
    *   unset by this button event, we reset it
    */
-  if (is_consumed && (xkb_mod_unlatch_occurred))
+  if (is_consumed && xkb_mod_unlatch_occurred)
     spi_dec_set_unlatch_pending (controller, mouse_mask_state);
   
   XAllowEvents (spi_get_display (),
@@ -950,6 +960,7 @@
 			      &= ~(XkbAX_StickyKeysFBMask);
 	        XkbChangeControls (display, priv->xkb_desc, &changes);
 	      }
+	      /* TODO: account for lock as well as latch */
 	      XkbLatchModifiers (display,
 				 XkbUseCoreKbd,
 				 priv->pending_xkb_mod_relatch_mask,
@@ -1797,6 +1808,7 @@
   SpiDEController *controller =
 	SPI_DEVICE_EVENT_CONTROLLER (bonobo_object (servant));
   long key_synth_code;
+  KeySym keysym;
 
 #ifdef SPI_DEBUG
 	fprintf (stderr, "synthesizing keystroke %ld, type %d\n",
@@ -1838,6 +1850,16 @@
   if (gdk_error_trap_pop ())
     {
       DBG (-1, g_warning ("Error emitting keystroke"));
+    }
+  if (synth_type == Accessibility_KEY_SYM) {
+    keysym = keycode;
+  }
+  else {
+    keysym = XkbKeycodeToKeysym (spi_get_display (), keycode, 0, 0);
+  }
+  if (XkbKeysymToModifiers (spi_get_display (), keysym) == 0) 
+    {
+      spi_dec_clear_unlatch_pending (controller);
     }
 }
 
