xdemo.c
changeset 8 96d16dfe787a
parent 4 236f8f747073
child 9 c3fecc82ade6
equal deleted inserted replaced
7:a1aa30f0f904 8:96d16dfe787a
    38 
    38 
    39     while (active) {
    39     while (active) {
    40         XNextEvent (dpy, &xev);
    40         XNextEvent (dpy, &xev);
    41         switch (xev.type) {
    41         switch (xev.type) {
    42         case KeyPress:
    42         case KeyPress:
    43 			if(xev.xkey.keycode == 9)
    43             if (xev.xkey.keycode == 9)
    44 	            active = 0;
    44                 active = 0;
    45 			printf("Keycode = %2u\n", xev.xkey.keycode);
    45             printf ("Keycode = %2u\n", xev.xkey.keycode);
    46             break;
    46             break;
    47         default:
    47         default:
    48             printf ("Unknown Event: %d\n", xev.type);
    48             printf ("Unknown Event: %d\n", xev.type);
    49         }
    49         }
    50     }
    50     }
    51 
    51 
    52     XDestroyWindow (dpy, w);
    52     XDestroyWindow (dpy, w);
    53     XCloseDisplay (dpy);
    53     XCloseDisplay (dpy);
    54     return 0;
    54 
       
    55     return EXIT_SUCCESS;
    55 }
    56 }