Fix for 107261, added SPI_KEYMASK_NUMLOCK to API. Revved to 1.1.10.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Thu, 10 Apr 2003 12:06:33 +0000 (12:06 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Thu, 10 Apr 2003 12:06:33 +0000 (12:06 +0000)
(so 0.0.110).

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@418 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
configure.in
libspi/keymasks.h
registryd/deviceeventcontroller.c

index ca37af8..8c9bbe6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
 2003-04-10  Bill Haneman <bill.haneman@sun.com>
 
+
+       * configure.in: revved to 1.1.10
+       
+       * libspi/keymasks.h:
+       (SPI_KEYMASK_NUMLOCK): Added.
+
+       * registryd/deviceeventcontroller.c:
+       (spi_key_event_matches_listener): AND with a smaller
+       bitmask (as we should).  
+       (spi_dec_translate_mask): 
+       New method, sets the virtual NumLock modifier bit
+       if numlock is on.  Eventually it can handle other virtual
+       modifier bits if needed, or other marshalling from
+       at-spi modifier masks to platform (X) masks.
+       (spi_dec_key_listener_new):
+       Call spi_dec_translate_mask to set up virtual mod bits
+       in the 'mask' field when creating a new listener struct.
+       (spi_dec_emit_modifier_event):
+       Set the virtual (i.e. NumLock) bits before emitting event.
+       (spi_controller_register_with_devices):
+       Query for the NumLock modifier 'physical' bit if Xkb is
+       present, for use in above methods.
+
+       Fix for 107261.
+       
+2003-04-10  Bill Haneman <bill.haneman@sun.com>
+       
        * registryd/deviceeventcontroller.c:
        (spi_keystroke_from_x_key_event):
        Instead of checking to see if the keysym is
index 502d685..b5928d4 100644 (file)
@@ -2,9 +2,9 @@ AC_INIT(idl/Accessibility.idl)
 
 AT_SPI_MAJOR_VERSION=1
 AT_SPI_MINOR_VERSION=1
-AT_SPI_MICRO_VERSION=9
-AT_SPI_INTERFACE_AGE=1
-AT_SPI_BINARY_AGE=109
+AT_SPI_MICRO_VERSION=10
+AT_SPI_INTERFACE_AGE=110
+AT_SPI_BINARY_AGE=110
 AT_SPI_VERSION="$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION.$AT_SPI_MICRO_VERSION"
 AM_INIT_AUTOMAKE(at-spi, $AT_SPI_VERSION)
 AC_SUBST(AT_SPI_MAJOR_VERSION)
index cd29a10..34a3e30 100644 (file)
@@ -45,6 +45,7 @@ typedef unsigned long SpiKeyMaskType;
 #define SPI_KEYMASK_CONTROL   ControlMask
 #define SPI_KEYMASK_SHIFT     ShiftMask
 #define SPI_KEYMASK_SHIFTLOCK LockMask
+#define SPI_KEYMASK_NUMLOCK   (1<<14)
 #define SPI_KEYMASK_UNMODIFIED 0
 
 G_END_DECLS
index bf51240..4b6d508 100644 (file)
@@ -60,7 +60,8 @@ static unsigned int mouse_mask_state = 0;
 static unsigned int mouse_button_mask =
   Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask;
 static unsigned int key_modifier_mask =
-  Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask | ShiftMask | LockMask | ControlMask;
+  Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask | ShiftMask | LockMask | ControlMask | SPI_KEYMASK_NUMLOCK;
+static unsigned int _numlock_physical_mask = Mod2Mask; /* a guess, will be reset */
 
 static GQuark spi_dec_private_quark = 0;
 
@@ -399,6 +400,13 @@ spi_dec_emit_modifier_event (SpiDEController *controller, guint prev_mask,
   fprintf (stderr, "MODIFIER CHANGE EVENT! %x to %x\n", 
           prev_mask, current_mask);
 #endif
+
+  /* set bits for the virtual modifiers like NUMLOCK */
+  if (prev_mask & _numlock_physical_mask) 
+    prev_mask |= SPI_KEYMASK_NUMLOCK;
+  if (current_mask & _numlock_physical_mask) 
+    current_mask |= SPI_KEYMASK_NUMLOCK;
+
   e.type = "keyboard:modifiers";  
   e.source = BONOBO_OBJREF (controller->registry->desktop);
   e.detail1 = prev_mask & key_modifier_mask;
@@ -489,6 +497,24 @@ spi_dec_init_mouse_listener (SpiRegistry *registry)
     }
 }
 
+/**
+ * Eventually we can use this to make the marshalling of mask types
+ * more sane, but for now we just use this to detect 
+ * the use of 'virtual' masks such as Mumlock and convert them to
+ * system-specific mask values (i.e. ModMask).
+ * 
+ **/
+static Accessibility_ControllerEventMask
+spi_dec_translate_mask (Accessibility_ControllerEventMask mask)
+{
+  DEControllerPrivateData *priv;
+
+  if (mask == SPI_KEYMASK_NUMLOCK) {
+    mask = _numlock_physical_mask;
+  }
+  return mask;
+}
+
 static DEControllerKeyListener *
 spi_dec_key_listener_new (CORBA_Object                            l,
                          const Accessibility_KeySet             *keys,
@@ -501,7 +527,7 @@ spi_dec_key_listener_new (CORBA_Object                            l,
   key_listener->listener.object = bonobo_object_dup_ref (l, ev);
   key_listener->listener.type = SPI_DEVICE_TYPE_KBD;
   key_listener->keys = ORBit_copy_value (keys, TC_Accessibility_KeySet);
-  key_listener->mask = mask;
+  key_listener->mask = spi_dec_translate_mask (mask);
   key_listener->listener.typeseq = ORBit_copy_value (typeseq, TC_Accessibility_EventTypeSeq);
   if (mode)
     key_listener->mode = ORBit_copy_value (mode, TC_Accessibility_EventListenerMode);
@@ -1028,6 +1054,8 @@ spi_controller_register_with_devices (SpiDEController *controller)
       XkbSelectEvents (spi_get_display (),
                       XkbUseCoreKbd,
                       XkbStateNotifyMask, XkbStateNotifyMask);     
+      _numlock_physical_mask = XkbKeysymToModifiers (spi_get_display (), 
+                                                    XK_Num_Lock);
     }  
 
   gdk_window_add_filter (NULL, global_filter_fn, controller);
@@ -1126,7 +1154,7 @@ spi_key_event_matches_listener (const Accessibility_DeviceEvent *key_event,
                                DEControllerKeyListener         *listener,
                                CORBA_boolean                    is_system_global)
 {
-  if ((key_event->modifiers == (CORBA_unsigned_short) (listener->mask & 0xFFFF)) &&
+  if ((key_event->modifiers == (CORBA_unsigned_short) (listener->mask & 0xFF)) &&
        spi_key_set_contains_key (listener->keys, key_event) &&
        spi_eventtype_seq_contains_event (listener->listener.typeseq, key_event) && 
       (is_system_global == listener->mode->global))
@@ -1386,7 +1414,6 @@ spi_controller_update_key_grabs (SpiDEController           *controller,
       next = l->next;
 
       re_issue_grab = recv &&
-/*           (recv->type == Accessibility_KEY_RELEASED) && - (?) */
              (recv->modifiers & grab_mask->mod_mask) &&
              (grab_mask->key_val == keycode_for_keysym (recv->id));