xdemo.c
changeset 4 236f8f747073
parent 0 af501b0c1716
child 8 96d16dfe787a
--- a/xdemo.c
+++ b/xdemo.c
@@ -21,7 +21,7 @@
     }
 
     XSynchronize (dpy, 1);
-    w = XCreateSimpleWindow (dpy, DefaultRootWindow (dpy), 0, 0, 640, 480, 1, 1, 1);
+    w = XCreateSimpleWindow (dpy, DefaultRootWindow (dpy), 0, 0, 240, 60, 1, 1, 1);
 
     if (w < 0)
         return EXIT_SUCCESS;
@@ -31,7 +31,7 @@
     XRaiseWindow (dpy, w);
     XMapWindow (dpy, w);
 
-    printf ("Press any key to quit\n");
+    printf ("Press ESC to quit\n");
 
     active = 1;
     XSelectInput (dpy, w, KeyPressMask);
@@ -40,7 +40,9 @@
         XNextEvent (dpy, &xev);
         switch (xev.type) {
         case KeyPress:
-            active = 0;
+			if(xev.xkey.keycode == 9)
+	            active = 0;
+			printf("Keycode = %2u\n", xev.xkey.keycode);
             break;
         default:
             printf ("Unknown Event: %d\n", xev.type);