Changeset 324
- Timestamp:
- Jan 7, 2004, 6:19:36 PM (19 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/configure.ac
r313 r324 75 75 [ac_cv_my_have_x11="no"], 76 76 [[-lXt -L${x_libraries}]]) 77 AC_CHECK_HEADERS(X11/XKBlib.h) 77 78 if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then 78 79 AC_MSG_ERROR([cannot find X11 development files]) -
libcaca/trunk/src/caca.c
r322 r324 138 138 139 139 /* Activate mouse */ 140 newmask = ALL_MOUSE_EVENTS;140 newmask = REPORT_MOUSE_POSITION | ALL_MOUSE_EVENTS; 141 141 mousemask(newmask, &oldmask); 142 mouseinterval(-1); /* No click emulation */ 142 143 } 143 144 else -
libcaca/trunk/src/graphics.c
r322 r324 157 157 static XFontStruct *x11_font_struct; 158 158 static int x11_font_offset; 159 #if defined(HAVE_X11_XKBLIB_H) 160 static Bool x11_detect_autorepeat; 161 #endif 159 162 #endif 160 163 … … 715 718 } 716 719 720 /* Disable autorepeat */ 721 #if defined(HAVE_X11_XKBLIB_H) 722 XkbSetDetectableAutoRepeat(x11_dpy, True, &x11_detect_autorepeat); 723 if(!x11_detect_autorepeat) 724 XAutoRepeatOff(x11_dpy); 725 #endif 726 717 727 XSelectInput(x11_dpy, x11_window, 718 KeyPressMask | ButtonPressMask | PointerMotionMask); 728 KeyPressMask | KeyReleaseMask | ButtonPressMask 729 | ButtonReleaseMask | PointerMotionMask); 719 730 720 731 XSync(x11_dpy, False); … … 763 774 { 764 775 XSync(x11_dpy, False); 776 #if defined(HAVE_X11_XKBLIB_H) 777 if(!x11_detect_autorepeat) 778 XAutoRepeatOn(x11_dpy); 779 #endif 765 780 XFreePixmap(x11_dpy, x11_pixmap); 766 781 XFreeFont(x11_dpy, x11_font_struct); -
libcaca/trunk/src/io.c
r322 r324 155 155 /* Check for mouse press and release events */ 156 156 if(xevent.type == ButtonPress) 157 return CACA_EVENT_MOUSE_PRESS | 1; 157 return CACA_EVENT_MOUSE_PRESS 158 | ((XButtonEvent *)&xevent)->button; 158 159 159 160 if(xevent.type == ButtonRelease) 160 return CACA_EVENT_MOUSE_RELEASE | 1; 161 return CACA_EVENT_MOUSE_RELEASE 162 | ((XButtonEvent *)&xevent)->button; 161 163 162 164 /* Check for key press and release events */ … … 222 224 _pop_key(); 223 225 getmouse(&mevent); 224 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 226 227 switch(mevent.bstate) 228 { 229 case BUTTON1_PRESSED: 230 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 231 break; 232 case BUTTON1_RELEASED: 233 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 234 break; 235 case BUTTON1_CLICKED: 236 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 237 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 238 break; 239 case BUTTON1_DOUBLE_CLICKED: 240 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 241 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 242 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 243 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 244 break; 245 case BUTTON1_TRIPLE_CLICKED: 246 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 247 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 248 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 249 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 250 _push_key(CACA_EVENT_MOUSE_PRESS | 1); 251 _push_key(CACA_EVENT_MOUSE_RELEASE | 1); 252 break; 253 case BUTTON1_RESERVED_EVENT: 254 break; 255 256 case BUTTON2_PRESSED: 257 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 258 break; 259 case BUTTON2_RELEASED: 260 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 261 break; 262 case BUTTON2_CLICKED: 263 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 264 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 265 break; 266 case BUTTON2_DOUBLE_CLICKED: 267 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 268 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 269 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 270 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 271 break; 272 case BUTTON2_TRIPLE_CLICKED: 273 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 274 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 275 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 276 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 277 _push_key(CACA_EVENT_MOUSE_PRESS | 2); 278 _push_key(CACA_EVENT_MOUSE_RELEASE | 2); 279 break; 280 case BUTTON2_RESERVED_EVENT: 281 break; 282 283 case BUTTON3_PRESSED: 284 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 285 break; 286 case BUTTON3_RELEASED: 287 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 288 break; 289 case BUTTON3_CLICKED: 290 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 291 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 292 break; 293 case BUTTON3_DOUBLE_CLICKED: 294 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 295 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 296 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 297 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 298 break; 299 case BUTTON3_TRIPLE_CLICKED: 300 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 301 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 302 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 303 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 304 _push_key(CACA_EVENT_MOUSE_PRESS | 3); 305 _push_key(CACA_EVENT_MOUSE_RELEASE | 3); 306 break; 307 case BUTTON3_RESERVED_EVENT: 308 break; 309 310 case BUTTON4_PRESSED: 311 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 312 break; 313 case BUTTON4_RELEASED: 314 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 315 break; 316 case BUTTON4_CLICKED: 317 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 318 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 319 break; 320 case BUTTON4_DOUBLE_CLICKED: 321 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 322 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 323 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 324 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 325 break; 326 case BUTTON4_TRIPLE_CLICKED: 327 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 328 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 329 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 330 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 331 _push_key(CACA_EVENT_MOUSE_PRESS | 4); 332 _push_key(CACA_EVENT_MOUSE_RELEASE | 4); 333 break; 334 case BUTTON4_RESERVED_EVENT: 335 break; 336 337 default: 338 break; 339 } 340 225 341 return CACA_EVENT_MOUSE_MOTION | (mevent.x << 12) | mevent.y; 226 342 } … … 250 366 { 251 367 _pop_key(); 368 if(event & CACA_EVENT_KEY_PRESS) 369 _push_key(CACA_EVENT_KEY_RELEASE 370 | (event & ~CACA_EVENT_KEY_PRESS)); 252 371 return event; 253 372 } … … 261 380 /* If it's not an escape sequence, return the key */ 262 381 if(keybuf[0] != '\x1b') 263 return CACA_EVENT_KEY_PRESS | _pop_key(); 382 { 383 event = _pop_key(); 384 _push_key(CACA_EVENT_KEY_RELEASE | event); 385 return CACA_EVENT_KEY_PRESS | event; 386 } 264 387 265 388 /* … … 275 398 { CACA_KEY_F1, CACA_KEY_F2, CACA_KEY_F3, CACA_KEY_F4 }; 276 399 _pop_key(); 277 return CACA_EVENT_KEY_PRESS | keylist[_pop_key() - 'P']; 400 event = keylist[_pop_key() - 'P']; 401 _push_key(CACA_EVENT_KEY_RELEASE | event); 402 return CACA_EVENT_KEY_PRESS | event; 278 403 } 279 404 else if(keybuf[0] == '[' && keybuf[1] >= 'A' && keybuf[1] <= 'D') … … 283 408 { CACA_KEY_UP, CACA_KEY_DOWN, CACA_KEY_RIGHT, CACA_KEY_LEFT }; 284 409 _pop_key(); 285 return CACA_EVENT_KEY_PRESS | keylist[_pop_key() - 'A']; 410 event = keylist[_pop_key() - 'A']; 411 _push_key(CACA_EVENT_KEY_RELEASE | event); 412 return CACA_EVENT_KEY_PRESS | event; 286 413 } 287 414 else if(keybuf[0] == '[' && keybuf[1] == 'M' && 288 415 keybuf[2] && keybuf[3] && keybuf[3]) 289 416 { 417 int button; 418 290 419 /* ^[[Mxxx */ 291 420 _pop_key(); 292 421 _pop_key(); 293 _push_key(CACA_EVENT_MOUSE_PRESS | (_pop_key() - ' ')); 422 button = (1 + _pop_key() - ' ') & 0xf; 423 _push_key(CACA_EVENT_MOUSE_PRESS | button); 424 _push_key(CACA_EVENT_MOUSE_RELEASE | button); 294 425 return CACA_EVENT_MOUSE_MOTION 295 426 | ((_pop_key() - '!') << 12) | ((_pop_key() - '!') << 0); … … 303 434 _pop_key(); 304 435 _pop_key(); 305 event = CACA_EVENT_KEY_PRESS | keylist[_pop_key() - '5']; 306 _pop_key(); 307 return event; 436 event = keylist[_pop_key() - '5']; 437 _pop_key(); 438 _push_key(CACA_EVENT_KEY_RELEASE | event); 439 return CACA_EVENT_KEY_PRESS | event; 308 440 } 309 441 else if(keybuf[0] == '[' && keybuf[1] == '2' && keybuf[3] == '~' && … … 315 447 _pop_key(); 316 448 _pop_key(); 317 event = CACA_EVENT_KEY_PRESS | keylist[_pop_key() - '0']; 318 _pop_key(); 319 return event; 449 event = keylist[_pop_key() - '0']; 450 _pop_key(); 451 _push_key(CACA_EVENT_KEY_RELEASE | event); 452 return CACA_EVENT_KEY_PRESS | event; 320 453 } 321 454 322 455 /* Unknown escape sequence: return the ESC key */ 456 _push_key(CACA_EVENT_KEY_RELEASE | '\x1b'); 323 457 return CACA_EVENT_KEY_PRESS | '\x1b'; 324 458 } -
libcaca/trunk/test
- Property svn:ignore
-
old new 9 9 hsv.exe 10 10 hsv 11 spritedit.exe 12 spritedit 13 event.exe 14 event
-
- Property svn:ignore
-
libcaca/trunk/test/Makefile.am
r323 r324 3 3 ############################################################################### 4 4 5 noinst_PROGRAMS = dithering hsv optipal spritedit5 noinst_PROGRAMS = dithering event hsv optipal spritedit 6 6 7 7 dithering_SOURCES = dithering.c 8 8 dithering_LDADD = ../src/libcaca.a @CACA_LIBS@ 9 9 dithering_CPPFLAGS = -I$(top_srcdir)/src 10 11 event_SOURCES = event.c 12 event_LDADD = ../src/libcaca.a @CACA_LIBS@ 13 event_CPPFLAGS = -I$(top_srcdir)/src 10 14 11 15 hsv_SOURCES = hsv.c
Note: See TracChangeset
for help on using the changeset viewer.