- Timestamp:
- Dec 23, 2003, 5:32:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/io.c
r268 r269 42 42 # include <X11/Xlib.h> 43 43 # include <X11/Xutil.h> 44 #endif 44 # include <X11/keysym.h> 45 #endif 46 47 #include <unistd.h> 45 48 46 49 #include "caca.h" … … 68 71 unsigned int event = 0; 69 72 70 /* Read all available key events */73 /* Read all available key events and push them into the buffer */ 71 74 while(keys < KEY_BUFLEN) 72 75 { … … 77 80 } 78 81 82 /* If no keys were read, return */ 79 83 if(!keys) 80 84 return 0; … … 267 271 == True) 268 272 { 269 if(event.type == KeyPress) 273 KeySym keysym; 274 275 if(event.type != KeyPress) 276 continue; 277 278 if(XLookupString(&event.xkey, &key, 1, NULL, NULL)) 279 return key; 280 281 keysym = XKeycodeToKeysym(x11_dpy, event.xkey.keycode, 0); 282 switch(keysym) 270 283 { 271 //KeySym keysym; 272 //keysym = XKeycodeToKeysym(_caca_dpy, event.xkey.keycode, 0); 273 if(XLookupString(&event.xkey, &key, 1, NULL, NULL)) 274 return key; 284 case XK_F1: return CACA_KEY_F1; 285 case XK_F2: return CACA_KEY_F2; 286 case XK_F3: return CACA_KEY_F3; 287 case XK_F4: return CACA_KEY_F4; 288 case XK_F5: return CACA_KEY_F5; 289 case XK_F6: return CACA_KEY_F6; 290 case XK_F7: return CACA_KEY_F7; 291 case XK_F8: return CACA_KEY_F8; 292 case XK_F9: return CACA_KEY_F9; 293 case XK_F10: return CACA_KEY_F10; 294 case XK_F11: return CACA_KEY_F11; 295 case XK_F12: return CACA_KEY_F12; 296 case XK_F13: return CACA_KEY_F13; 297 case XK_F14: return CACA_KEY_F14; 298 case XK_F15: return CACA_KEY_F15; 299 case XK_Left: return CACA_KEY_LEFT; 300 case XK_Right: return CACA_KEY_RIGHT; 301 case XK_Up: return CACA_KEY_UP; 302 case XK_Down: return CACA_KEY_DOWN; 303 default: return 0; 275 304 } 276 305 }
Note: See TracChangeset
for help on using the changeset viewer.