? changes
? event-listener-test
? event-listener.patch
? keypad-test
? keysynth-test
? out
? out2
? out3
? screen-review-test
? stress-test
? window-listener-test
Index: event-listener-test.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/event-listener-test.c,v
retrieving revision 1.19
diff -u -r1.19 event-listener-test.c
--- event-listener-test.c	2 Jun 2003 19:35:27 -0000	1.19
+++ event-listener-test.c	12 Aug 2003 09:46:25 -0000
@@ -26,8 +26,36 @@
 #include <unistd.h>
 #include "../cspi/spi-private.h" /* A hack for now */
 
+#define XK_MISCELLANY
+#include <X11/keysymdef.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <glib-object.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+#include <spi.h>
+#define XK_MISCELLANY
+#include <X11/keysymdef.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+
+
+static short *get_keypad_keycodes (void);
+
+static AccessibleKeystrokeListener *keypad_key_listener = NULL;
+static AccessibleKeySet            *keypad_keyset = NULL;
+
+static Display *get_display (void);
+
 static void traverse_accessible_tree (Accessible *accessible);
 
+static SPIBoolean report_keypad_key_event  (const AccessibleKeystroke *stroke, void *user_data);
 static void report_event  (const AccessibleEvent *event, void *user_data);
 static void report_detail_event  (const AccessibleEvent *event, void *user_data);
 static void report_detail1_event  (const AccessibleEvent *event, void *user_data);
@@ -47,6 +75,8 @@
 static void timing_test_event (const AccessibleEvent *event, void *user_data);
 static SPIBoolean report_mouse_event  (const AccessibleDeviceEvent *event, void *user_data);
 
+static int	register_numpad_event ();
+
 static AccessibleEventListener *generic_listener;
 static AccessibleEventListener *specific_listener;
 static AccessibleEventListener *detail1_listener;
@@ -109,6 +139,10 @@
       }
   }
 
+  gdk_init (&argc, &argv); /* 
+		* needed in this test program only  
+		* because we are calling GDK_DISPLAY() 
+		*/
   fprintf (stderr, "RUNNING\n");
 
   SPI_init ();
@@ -253,7 +287,11 @@
   SPI_registerGlobalEventListener (generic_listener,
 	                           "window:desktop-destroy");
 #endif
-  
+
+fprintf (stderr,"\nRegister numpad key events...");
+  register_numpad_event ();
+fprintf (stderr,"OK");
+
   timer = g_timer_new ();
   traverse_accessible_tree (SPI_getDesktop (0));
   g_print ("Time for first traversal of %d elements: %lf\n", 
@@ -558,3 +596,135 @@
   SPI_deregisterGlobalEventListenerAll (specific_listener);
   AccessibleEventListener_unref (specific_listener);
 }
+
+
+int
+register_numpad_event ()
+{
+  SPIBoolean retval = FALSE;
+	
+  /* prepare the keyboard snoopers */
+  keypad_key_listener = SPI_createAccessibleKeystrokeListener (report_keypad_key_event, NULL);
+  keypad_keyset = SPI_createAccessibleKeySet (16, NULL, get_keypad_keycodes (), NULL);
+
+  retval = SPI_registerAccessibleKeystrokeListener(keypad_key_listener,
+			       		  keypad_keyset,
+					  SPI_KEYMASK_UNMODIFIED,
+					  (unsigned long) ( SPI_KEY_PRESSED |
+							    SPI_KEY_RELEASED ),
+					  SPI_KEYLISTENER_ALL_WINDOWS);
+  fprintf (stderr, "Keypad key registry: result %s\n", retval ? "succeeded" : 
+	"failed");
+
+  retval = SPI_registerAccessibleKeystrokeListener(keypad_key_listener,
+			       		  keypad_keyset,
+					  SPI_KEYMASK_SHIFT,
+					  (unsigned long) ( SPI_KEY_PRESSED |
+							    SPI_KEY_RELEASED ),
+					  SPI_KEYLISTENER_ALL_WINDOWS);
+
+  fprintf (stderr, "Shift-Keypad key registry: result %s\n", retval ? "succeeded" : 
+	"failed");
+
+  retval = SPI_registerAccessibleKeystrokeListener(keypad_key_listener,
+			       		  keypad_keyset,
+					  SPI_KEYMASK_MOD2,
+					  (unsigned long) ( SPI_KEY_PRESSED |
+							    SPI_KEY_RELEASED ),
+					  SPI_KEYLISTENER_ALL_WINDOWS);
+
+  fprintf (stderr, "Mod2-Keypad key registry: result %s\n", retval ? "succeeded" : 
+	"failed");
+
+  retval = SPI_registerAccessibleKeystrokeListener(keypad_key_listener,
+			       		  keypad_keyset,
+					  SPI_KEYMASK_MOD3,
+					  (unsigned long) ( SPI_KEY_PRESSED |
+							    SPI_KEY_RELEASED ),
+					  SPI_KEYLISTENER_ALL_WINDOWS);
+
+  fprintf (stderr, "Mod3-Keypad key registry: result %s\n", retval ? "succeeded" : 
+	"failed");
+
+  retval = SPI_registerAccessibleKeystrokeListener(keypad_key_listener,
+			       		  keypad_keyset,
+					  SPI_KEYMASK_MOD2 | SPI_KEYMASK_SHIFT,
+					  (unsigned long) ( SPI_KEY_PRESSED |
+							    SPI_KEY_RELEASED ),
+					  SPI_KEYLISTENER_ALL_WINDOWS);
+
+  fprintf (stderr, "Mod2-Shift-Keypad key registry: result %s\n", retval ? "succeeded" : 
+	"failed");
+
+  retval = SPI_registerAccessibleKeystrokeListener(keypad_key_listener,
+			       		  keypad_keyset,
+					  SPI_KEYMASK_MOD3 | SPI_KEYMASK_SHIFT,
+					  (unsigned long) ( SPI_KEY_PRESSED |
+							    SPI_KEY_RELEASED ),
+					  SPI_KEYLISTENER_ALL_WINDOWS);
+
+  fprintf (stderr, "Mod3-Shift-Keypad key registry: result %s\n", retval ? "succeeded" : 
+	"failed");
+
+  return 1;
+}
+
+static Display*
+get_display (void)
+{
+	return GDK_DISPLAY ();
+}
+
+static short*
+get_keypad_keycodes (void)
+{
+	short *keycodes = (short *) g_new0 (short *, 16);
+	int i;
+
+	keycodes [0] = XKeysymToKeycode (get_display (), XK_KP_0);
+	keycodes [1] = XKeysymToKeycode (get_display (), XK_KP_1);
+	keycodes [2] = XKeysymToKeycode (get_display (), XK_KP_2);
+	keycodes [3] = XKeysymToKeycode (get_display (), XK_KP_3);
+	keycodes [4] = XKeysymToKeycode (get_display (), XK_KP_4);
+	keycodes [5] = XKeysymToKeycode (get_display (), XK_KP_5);
+	keycodes [6] = XKeysymToKeycode (get_display (), XK_KP_6);
+	keycodes [7] = XKeysymToKeycode (get_display (), XK_KP_7);
+	keycodes [8] = XKeysymToKeycode (get_display (), XK_KP_8);
+	keycodes [9] = XKeysymToKeycode (get_display (), XK_KP_9);
+	keycodes [10] = XKeysymToKeycode (get_display (), XK_KP_Divide);
+	keycodes [11] = XKeysymToKeycode (get_display (), XK_KP_Multiply);
+	keycodes [12] = XKeysymToKeycode (get_display (), XK_KP_Add);
+	keycodes [13] = XKeysymToKeycode (get_display (), XK_KP_Subtract);
+	keycodes [14] = XKeysymToKeycode (get_display (), XK_KP_Decimal);
+	keycodes [15] = XKeysymToKeycode (get_display (), XK_KP_Enter);
+
+	for (i = 0; i < 16; ++i)
+	{
+		fprintf (stderr, "keycode[%d] = %d\n", i, (int) keycodes[i]);
+	}
+
+	return keycodes;
+}
+
+static void
+print_key_event (const AccessibleKeystroke *key, char *prefix)
+{
+  fprintf (stderr, "\n%s KeyEvent %s%c [keysym 0x%x] (keycode %d); string=%s; time=%lx\n",
+	   prefix,
+	  (key->modifiers & SPI_KEYMASK_ALT)?"Alt-":"",
+	  ((key->modifiers & SPI_KEYMASK_SHIFT)^(key->modifiers & SPI_KEYMASK_SHIFTLOCK))?
+	  (char) toupper((int) key->keyID) : (char) tolower((int) key->keyID),
+	   key->keyID,
+	  (int) key->keycode,
+   	  key->keystring,
+	  (long int) key->timestamp);	
+}
+
+static SPIBoolean
+report_keypad_key_event (const AccessibleKeystroke *key, void *user_data)
+{
+  print_key_event (key, "keypad");
+  return FALSE;
+}
+
+
