Changeset 273
- Timestamp:
- Dec 24, 2003, 4:35:07 PM (19 years ago)
- Location:
- libcaca/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/caca_internals.h
r268 r273 68 68 extern Display *x11_dpy; 69 69 extern Window x11_window; 70 extern int x11_font_width, x11_font_height; 70 71 #endif 71 72 -
libcaca/trunk/src/graphics.c
r272 r273 82 82 Display *x11_dpy; 83 83 Window x11_window; 84 int x11_font_width, x11_font_height; 84 85 static GC x11_gc; 85 86 static Pixmap x11_pixmap; … … 88 89 static Font x11_font; 89 90 static XFontStruct *x11_font_struct; 90 static int x11_font_ width, x11_font_height, x11_font_offset;91 static int x11_font_offset; 91 92 #endif 92 93 … … 605 606 } 606 607 607 XSelectInput(x11_dpy, x11_window, KeyPressMask); 608 XSelectInput(x11_dpy, x11_window, 609 KeyPressMask | ButtonPressMask | PointerMotionMask); 608 610 609 611 XSync(x11_dpy, False); -
libcaca/trunk/src/io.c
r269 r273 129 129 #endif 130 130 131 /* If it's already a special event, return it */ 132 if((keybuf[0] & ~0xff) != 0) 133 return _pop_key(); 134 135 /* If it's not an escape sequence, return the key */ 131 136 if(keybuf[0] != '\x1b') 132 137 return CACA_EVENT_KEY_PRESS | _pop_key(); … … 248 253 #if defined(USE_X11) 249 254 XEvent event; 255 static int x11_x = 0, x11_y = 0; 256 long int event_mask = KeyPressMask | ButtonPressMask | PointerMotionMask; 250 257 char key; 251 258 #endif … … 268 275 #if defined(USE_X11) 269 276 case CACA_DRIVER_X11: 270 while(XCheckWindowEvent(x11_dpy, x11_window, KeyPressMask, &event)277 while(XCheckWindowEvent(x11_dpy, x11_window, event_mask, &event) 271 278 == True) 272 279 { 273 280 KeySym keysym; 281 282 if(event.type == MotionNotify) 283 { 284 x11_x = event.xmotion.x; 285 x11_y = event.xmotion.y; 286 continue; 287 } 288 289 if(event.type == ButtonPress) 290 { 291 unsigned int x = x11_x / x11_font_width; 292 unsigned int y = x11_y / x11_font_height; 293 294 if(x >= _caca_width) 295 x = _caca_width - 1; 296 if(y >= _caca_height) 297 y = _caca_height - 1; 298 299 return CACA_EVENT_MOUSE_CLICK 300 | (1 << 16) | (x << 8) | (y << 0); 301 } 274 302 275 303 if(event.type != KeyPress)
Note: See TracChangeset
for help on using the changeset viewer.