Fix for key events, bug #107256.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Fri, 28 Feb 2003 15:17:39 +0000 (15:17 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Fri, 28 Feb 2003 15:17:39 +0000 (15:17 +0000)
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@407 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
registryd/deviceeventcontroller.c

index bdcf002..37325db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
 
        * registryd/deviceeventcontroller.c:
        (spi_keystroke_from_x_key_event): 
+       Fix string and keysym return codes to match modifier state. 
+       [bug #107256]
+
+2003-02-28  Bill Haneman <bill.haneman@sun.com>
+
+       * registryd/deviceeventcontroller.c:
+       (spi_keystroke_from_x_key_event): 
        Fix segv due to improper use of isprint(c). [bug #107254]
 
 2003-02-24  Bill Haneman <bill.haneman@sun.com>
index fd06a66..8243448 100644 (file)
@@ -1219,8 +1219,7 @@ spi_keystroke_from_x_key_event (XKeyEvent *x_key_event)
   char cbuf [cbuf_bytes+1];
   int nbytes;
 
-  if (!x_key_event) g_error ("invalid key event!");
-  keysym = XLookupKeysym (x_key_event, 0);
+  nbytes = XLookupString (x_key_event, cbuf, cbuf_bytes, &keysym, NULL);  
   key_event.id = (CORBA_long)(keysym);
   key_event.hw_code = (CORBA_short) x_key_event->keycode;
   if (((XEvent *) x_key_event)->type == KeyPress)
@@ -1314,14 +1313,14 @@ spi_keystroke_from_x_key_event (XKeyEvent *x_key_event)
         key_event.event_string = CORBA_string_dup ("Right");
        break;
       default:
-       nbytes = XLookupString (x_key_event, cbuf, cbuf_bytes, &keysym, NULL);
         if (nbytes > 0)
           {
            cbuf[nbytes] = '\0'; /* OK since length is cbuf_bytes+1 */
             key_event.event_string = CORBA_string_dup (cbuf);
-           if (keysym && g_ascii_isprint (keysym))
+           if ((keysym && g_ascii_isprint (keysym)) || (nbytes == 1))
              {
-               key_event.is_text = CORBA_TRUE; /* FIXME: incorrect for some composed chars? */
+               key_event.is_text = CORBA_TRUE; 
+               /* FIXME: incorrect for some composed chars, unicode chars? */
              }
           }
         else