Reverted some unpleasant workarounds in favor of real fixes.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 2 Dec 2002 17:25:58 +0000 (17:25 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 2 Dec 2002 17:25:58 +0000 (17:25 +0000)
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@375 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
configure.in
registryd/deviceeventcontroller.c
test/Makefile.am

index 8517072..3155916 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,31 @@
+2002-12-02  Bill Haneman  <bill.haneman@sun.com>
+
+       Removed some of the more dangerous workarounds from
+       previous commit; they are only needed by GOK, which
+       in reality should be using another method to accomplish
+       the goals.  So on reconsideration some of the workarounds
+       need to be reverted:
+       
+       * registryd/deviceeventcontroller.c:
+       (spi_keycodes_contain, spi_dec_init_keycode_list): 
+       Removed these methods, used only by a nasty hack to try
+       and detect whether a key synthesis should be allowed
+       to reset the XKB latch state or not. This code was only
+       required to work around an interaction between GOK,
+       button events, and XKB.
+       (impl_generate_key_event):
+       Removed hack at end of key generation that tried to
+       "do the right thing" if XKB latch keys were generated
+       in the midst of button press/release pairs.  
+
+       * configure.in:
+       Added a check for HAVE_XINPUT.  Not normally used yet.
+
 2002-11-25  Bill Haneman  <bill.haneman@sun.com>
 
         Workarounds and fixes for mouse event/XKB interaction.
        
-       * registryd/registry.c:
+       * registryd/deviceeventcontroller.c:
        (spi_keycodes_contain, spi_dec_init_keycode_list): 
        New internal methods.
        (spi_dec_set_unlatch_pending):
index 4a1dd4e..b6d9abe 100644 (file)
@@ -178,6 +178,29 @@ if test "x$have_xkb" = "xyes"; then
   AC_DEFINE(HAVE_XKB)
 fi
 
+have_xinput=
+AC_CHECK_LIB(Xi, XOpenDevice, XINPUT_LIBS=-lXi)
+if test "x$XINPUT_LIBS" = x; then
+  save_LIBS="$LIBS"
+  for xinputpath in /usr/X11R6/lib /usr/openwin/lib; do
+    LIBS="-L$xinputpath -lXi"
+    case "$host" in
+    *solaris*) XINPUT_RPATH_FLAGS="-R$xinputpath" ;;
+    esac
+    AC_MSG_CHECKING(for -lXi in $xinputpath)
+    AC_TRY_LINK([], [XOpenDisplay()], [
+       AC_MSG_RESULT(yes)
+       XINPUT_LIBS="$XINPUT_RPATH_FLAGS -L$xinputpath -lXi"
+        LIBS="$save_LIBS"
+       break],[AC_MSG_RESULT(no)])
+  done
+  if test "x$XINPUT_LIBS" = x; then
+    AC_MSG_ERROR(Couldn't find the XInput library. Check config.log for details)
+  fi                          
+    AC_CHECK_HEADER(X11/extensions/XInput.h, have_xinput=yes)
+fi
+AC_SUBST(XINPUT_LIBS)
+
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
index 8849dba..cccd8ff 100644 (file)
@@ -105,7 +105,6 @@ typedef struct {
   int xkb_base_error_code;
   unsigned int xkb_latch_mask;
   unsigned int pending_xkb_mod_relatch_mask;
-  KeyCode *shift_keycodes;
   XkbDescPtr xkb_desc;
 } DEControllerPrivateData;
 
@@ -144,51 +143,6 @@ keycode_for_keysym (long keysym)
   return XKeysymToKeycode (spi_get_display (), (KeySym) keysym);
 }
 
-#define SPI_DEC_MAX_SHIFT_KEYSYMS 15
-static long _shift_keysyms[SPI_DEC_MAX_SHIFT_KEYSYMS] = 
-                                {XK_Shift_L, XK_Shift_R,
-                                XK_Control_L, XK_Control_R,
-                                XK_Caps_Lock, XK_Shift_Lock,
-                                XK_Alt_L, XK_Alt_R,
-                                XK_Meta_L, XK_Meta_R, 
-                                XK_Super_L, XK_Super_R,
-                                XK_Hyper_L, XK_Hyper_R,
-                                0};
-
-static gboolean
-spi_keycodes_contain (KeyCode keycodes[], KeyCode keycode)
-{
-  int i = 0;
-
-  if (keycode)
-    {
-      while (i < SPI_DEC_MAX_SHIFT_KEYSYMS)
-       {
-         if (keycodes[i] == keycode) 
-           return TRUE;
-         ++i;
-       }
-    }
-  return FALSE;
-}
-
-static void
-spi_dec_init_keycode_list (SpiDEController *controller)
-{
-  DEControllerPrivateData *priv = 
-    g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
-  KeyCode keycode;
-  int i;
-  priv->shift_keycodes = g_malloc (sizeof (KeyCode) * 
-                                  SPI_DEC_MAX_SHIFT_KEYSYMS);
-  for (i = 0; _shift_keysyms[i] != 0; ++i)
-    { 
-      keycode = keycode_for_keysym (_shift_keysyms [i]);
-      priv->shift_keycodes [i] = keycode;
-    }
-  priv->shift_keycodes [i] = 0; /* terminate the list */
-}
-
 static DEControllerGrabMask *
 spi_grab_mask_clone (DEControllerGrabMask *grab_mask)
 {
@@ -1888,26 +1842,6 @@ impl_generate_keyboard_event (PortableServer_Servant           servant,
     {
       DBG (-1, g_warning ("Error emitting keystroke"));
     }
-
-  /* now we must determine whether this keystroke is expected 
-   * to delatch XKB. This is a bit of a hack :-( */
-  priv =  g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
-  if (!priv->shift_keycodes) 
-    spi_dec_init_keycode_list (controller);
-  if (!spi_keycodes_contain (priv->shift_keycodes, key_synth_code)) 
-    {
-      priv->pending_xkb_mod_relatch_mask = 0;
-      priv->xkb_latch_mask = 0;
-      fprintf (stderr, "resetting the relatch masks.\n");
-    }
-  else
-    {
-      int x, y;
-      gboolean moved;
-      priv->pending_xkb_mod_relatch_mask = 
-       spi_dec_mouse_check (controller, &x, &y, &moved);
-      fprintf (stderr, "preparing to relatch %x\n");
-    }
 }
 
 /* Accessibility::DEController::generateMouseEvent */
@@ -2045,7 +1979,6 @@ spi_device_event_controller_init (SpiDEController *device_event_controller)
   g_object_set_qdata (G_OBJECT (device_event_controller),
                      spi_dec_private_quark,
                      private);
-  private->shift_keycodes = NULL;
   spi_controller_register_with_devices (device_event_controller);
 }
 
index bc2c579..1edfb52 100644 (file)
@@ -1,11 +1,11 @@
 NULL=
 
-noinst_PROGRAMS = test-simple at app simple-at stress-test keysynth-demo key-listener-test event-listener-test screen-review-test visual-bell
-
-key_listener_test_SOURCES = key-listener-test.c
+noinst_PROGRAMS = test-simple at app simple-at stress-test keysynth-demo key-listener-test event-listener-test screen-review-test visual-bell 
 
 stress_test_SOURCES = stress-test.c
 
+key_listener_test_SOURCES = key-listener-test.c
+
 visual_bell_SOURCES = visual-bell.c
 
 event_listener_test_SOURCES = event-listener-test.c
@@ -34,6 +34,6 @@ DEBUG_CFLAGS=-DSPI_DEBUG
 
 CFLAGS += $(TESTS_CFLAGS) $(DEBUG_CFLAGS)
 
-LDADD = ../libspi/libspi.la ../cspi/libcspi.la $(TESTS_LIBS) $(X_LIBS)
+LDADD = ../libspi/libspi.la ../cspi/libcspi.la $(TESTS_LIBS) $(X_LIBS) $(XINPUT_LIBS)
 
 TESTS = test-simple