2.34.0
[platform/upstream/at-spi2-core.git] / registryd / deviceeventcontroller-x11.c
index d9d9a6c..df16bd8 100644 (file)
@@ -6,19 +6,19 @@
  * Copyright 2001, 2002 Ximian, Inc.
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 /* deviceeventcontroller-x11.c: X-specific DeviceEventController support */
@@ -140,6 +140,14 @@ keysym_mod_mask (KeySym keysym, KeyCode keycode)
                 (sym_rtn == keysym)) {
                retval = Mod3Mask;
        }
+       else if (XkbLookupKeySym (display, keycode, Mod4Mask, &mods_rtn, &sym_rtn) &&
+                (sym_rtn == keysym)) {
+               retval = Mod4Mask;
+       }
+       else if (XkbLookupKeySym (display, keycode, Mod5Mask, &mods_rtn, &sym_rtn) &&
+                (sym_rtn == keysym)) {
+               retval = Mod5Mask;
+       }
        else if (XkbLookupKeySym (display, keycode, 
                                  ShiftMask | Mod2Mask, &mods_rtn, &sym_rtn) &&
                 (sym_rtn == keysym)) {
@@ -155,6 +163,11 @@ keysym_mod_mask (KeySym keysym, KeyCode keycode)
                 (sym_rtn == keysym)) {
                retval = (Mod4Mask | ShiftMask);
        }
+       else if (XkbLookupKeySym (display, keycode,
+                                 ShiftMask | Mod5Mask, &mods_rtn, &sym_rtn) &&
+                (sym_rtn == keysym)) {
+               retval = (Mod5Mask | ShiftMask);
+       }
        else
                retval = 0xFFFF;
        return retval;
@@ -1018,8 +1031,10 @@ spi_dec_x11_synth_keycode_press (SpiDEController *controller,
 {
        unsigned int time = CurrentTime;
        unsigned int bounce_delay;
+#ifdef THIS_IS_BROKEN 
        unsigned int elapsed_msec;
        struct timeval tv;
+#endif
        DEControllerPrivateData *priv = controller->priv;
 
        spi_x_error_trap ();
@@ -1028,15 +1043,15 @@ spi_dec_x11_synth_keycode_press (SpiDEController *controller,
                bounce_delay = xkb_get_bouncekeys_delay (controller); 
                 if (bounce_delay)
                {
+#ifdef THIS_IS_BROKEN
                        gettimeofday (&tv, NULL);
                        elapsed_msec =
                                (tv.tv_sec - priv->last_release_time.tv_sec) * 1000
                                + (tv.tv_usec - priv->last_release_time.tv_usec) / 1000;
-#ifdef SPI_XKB_DEBUG                   
+# ifdef SPI_XKB_DEBUG
                        fprintf (stderr, "%d ms elapsed (%ld usec)\n", elapsed_msec,
                                 (long) (tv.tv_usec - priv->last_release_time.tv_usec));
-#endif
-#ifdef THIS_IS_BROKEN
+# endif
                        if (elapsed_msec < bounce_delay)
                                time = bounce_delay - elapsed_msec + 1;
 #else
@@ -1062,8 +1077,10 @@ spi_dec_x11_synth_keycode_release (SpiDEController *controller,
 {
        unsigned int time = CurrentTime;
        unsigned int slow_delay;
+#ifdef THIS_IS_BROKEN_DUNNO_WHY
        unsigned int elapsed_msec;
        struct timeval tv;
+#endif
        DEControllerPrivateData *priv = controller->priv;
 
        spi_x_error_trap ();
@@ -1072,15 +1089,15 @@ spi_dec_x11_synth_keycode_release (SpiDEController *controller,
                slow_delay = xkb_get_slowkeys_delay (controller);
                if (slow_delay)
                {
+#ifdef THIS_IS_BROKEN_DUNNO_WHY
                        gettimeofday (&tv, NULL);
                        elapsed_msec =
                                (tv.tv_sec - priv->last_press_time.tv_sec) * 1000
                                + (tv.tv_usec - priv->last_press_time.tv_usec) / 1000;
-#ifdef SPI_XKB_DEBUG                   
+# ifdef SPI_XKB_DEBUG
                        fprintf (stderr, "%d ms elapsed (%ld usec)\n", elapsed_msec,
                                 (long) (tv.tv_usec - priv->last_press_time.tv_usec));
-#endif
-#ifdef THIS_IS_BROKEN_DUNNO_WHY
+# endif
                        if (elapsed_msec < slow_delay)
                                time = slow_delay - elapsed_msec + 1;
 #else