ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.166 by root, Fri Dec 8 15:07:08 2006 UTC vs.
Revision 1.167 by root, Sat Dec 9 02:21:25 2006 UTC

359 n |= n >> 16; 359 n |= n >> 16;
360 360
361 return n + 1; 361 return n + 1;
362} 362}
363 363
364/* SDL should provide this, really. */
365#define SDLK_MODIFIER_MIN 300
366#define SDLK_MODIFIER_MAX 314
367
364MODULE = CFPlus PACKAGE = CFPlus 368MODULE = CFPlus PACKAGE = CFPlus
365 369
366PROTOTYPES: ENABLE 370PROTOTYPES: ENABLE
367 371
368BOOT: 372BOOT:
371 static const struct { 375 static const struct {
372 const char *name; 376 const char *name;
373 IV iv; 377 IV iv;
374 } *civ, const_iv[] = { 378 } *civ, const_iv[] = {
375# define const_iv(name) { # name, (IV)name } 379# define const_iv(name) { # name, (IV)name }
380 const_iv (SDLK_MODIFIER_MIN),
381 const_iv (SDLK_MODIFIER_MAX),
382
376 const_iv (SDL_ACTIVEEVENT), 383 const_iv (SDL_ACTIVEEVENT),
377 const_iv (SDL_KEYDOWN), 384 const_iv (SDL_KEYDOWN),
378 const_iv (SDL_KEYUP), 385 const_iv (SDL_KEYUP),
379 const_iv (SDL_MOUSEMOTION), 386 const_iv (SDL_MOUSEMOTION),
380 const_iv (SDL_MOUSEBUTTONDOWN), 387 const_iv (SDL_MOUSEBUTTONDOWN),
389 const_iv (SDL_EVENT_RESERVEDA), 396 const_iv (SDL_EVENT_RESERVEDA),
390 const_iv (SDL_EVENT_RESERVEDB), 397 const_iv (SDL_EVENT_RESERVEDB),
391 const_iv (SDL_VIDEORESIZE), 398 const_iv (SDL_VIDEORESIZE),
392 const_iv (SDL_VIDEOEXPOSE), 399 const_iv (SDL_VIDEOEXPOSE),
393 const_iv (SDL_USEREVENT), 400 const_iv (SDL_USEREVENT),
401
402 const_iv (SDL_APPINPUTFOCUS),
403 const_iv (SDL_APPMOUSEFOCUS),
404 const_iv (SDL_APPACTIVE),
405
394 const_iv (SDLK_KP0), 406 const_iv (SDLK_KP0),
395 const_iv (SDLK_KP1), 407 const_iv (SDLK_KP1),
396 const_iv (SDLK_KP2), 408 const_iv (SDLK_KP2),
397 const_iv (SDLK_KP3), 409 const_iv (SDLK_KP3),
398 const_iv (SDLK_KP4), 410 const_iv (SDLK_KP4),
453 const_iv (SDLK_BREAK), 465 const_iv (SDLK_BREAK),
454 const_iv (SDLK_MENU), 466 const_iv (SDLK_MENU),
455 const_iv (SDLK_POWER), 467 const_iv (SDLK_POWER),
456 const_iv (SDLK_EURO), 468 const_iv (SDLK_EURO),
457 const_iv (SDLK_UNDO), 469 const_iv (SDLK_UNDO),
470
458 const_iv (KMOD_NONE), 471 const_iv (KMOD_NONE),
472 const_iv (KMOD_SHIFT),
459 const_iv (KMOD_LSHIFT), 473 const_iv (KMOD_LSHIFT),
460 const_iv (KMOD_RSHIFT), 474 const_iv (KMOD_RSHIFT),
475 const_iv (KMOD_CTRL),
461 const_iv (KMOD_LCTRL), 476 const_iv (KMOD_LCTRL),
462 const_iv (KMOD_RCTRL), 477 const_iv (KMOD_RCTRL),
478 const_iv (KMOD_ALT),
463 const_iv (KMOD_LALT), 479 const_iv (KMOD_LALT),
464 const_iv (KMOD_RALT), 480 const_iv (KMOD_RALT),
481 const_iv (KMOD_META),
465 const_iv (KMOD_LMETA), 482 const_iv (KMOD_LMETA),
466 const_iv (KMOD_RMETA), 483 const_iv (KMOD_RMETA),
467 const_iv (KMOD_NUM), 484 const_iv (KMOD_NUM),
468 const_iv (KMOD_CAPS), 485 const_iv (KMOD_CAPS),
469 const_iv (KMOD_MODE), 486 const_iv (KMOD_MODE),
470 const_iv (KMOD_CTRL),
471 const_iv (KMOD_SHIFT),
472 const_iv (KMOD_ALT),
473 const_iv (KMOD_META)
474# undef const_iv 487# undef const_iv
475 }; 488 };
476 489
477 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 490 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
478 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 491 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
492
493 assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK);
494 assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE);
479} 495}
480 496
481int 497int
482in_destruct () 498in_destruct ()
483 CODE: 499 CODE:
587 case SDL_KEYDOWN: 603 case SDL_KEYDOWN:
588 case SDL_KEYUP: 604 case SDL_KEYUP:
589 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 605 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
590 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 606 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
591 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); 607 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0);
608 hv_store (hv, "cmod", 4, newSViv (SDL_GetModState ()), 0); /* current mode */
592 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 609 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
593 break; 610 break;
594 611
595 case SDL_ACTIVEEVENT: 612 case SDL_ACTIVEEVENT:
596 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 613 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines