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.273 by root, Wed Aug 20 13:30:02 2008 UTC vs.
Revision 1.277 by root, Mon Sep 1 06:18:09 2008 UTC

90 90
91#define MIN_FONT_HEIGHT 10 91#define MIN_FONT_HEIGHT 10
92 92
93/* mask out modifiers we are not interested in */ 93/* mask out modifiers we are not interested in */
94#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META) 94#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META)
95
96#define KMOD_LRAM 0x10000 // our extension
95 97
96static AV *texture_av; 98static AV *texture_av;
97 99
98static struct 100static struct
99{ 101{
527 return 0; 529 return 0;
528 530
529 return 1; 531 return 1;
530} 532}
531 533
534/******************************************************************************/
535
536/* process keyboard modifiers */
537static int
538mod_munge (int mod)
539{
540 mod &= MOD_MASK;
541
542 if (mod & (KMOD_META | KMOD_ALT))
543 mod |= KMOD_LRAM;
544
545 return mod;
546}
547
532static void 548static void
533deliantra_main () 549deliantra_main ()
534{ 550{
535 char *argv[] = { 0 }; 551 char *argv[] = { 0 };
536 call_argv ("::main", G_DISCARD | G_VOID, argv); 552 call_argv ("::main", G_DISCARD | G_VOID, argv);
537 dSP;
538} 553}
539 554
540#ifdef __MACOSX__ 555#ifdef __MACOSX__
541 /* to due surprising braindamage on the side of SDL design, we 556 /* to due surprising braindamage on the side of SDL design, we
542 * do some mind-boggling hack here: SDL requires a custom main() 557 * do some mind-boggling hack here: SDL requires a custom main()
603 const_iv (SDL_USEREVENT), 618 const_iv (SDL_USEREVENT),
604 619
605 const_iv (SDL_APPINPUTFOCUS), 620 const_iv (SDL_APPINPUTFOCUS),
606 const_iv (SDL_APPMOUSEFOCUS), 621 const_iv (SDL_APPMOUSEFOCUS),
607 const_iv (SDL_APPACTIVE), 622 const_iv (SDL_APPACTIVE),
623
624
625 const_iv (SDLK_UNKNOWN),
626 const_iv (SDLK_FIRST),
627 const_iv (SDLK_BACKSPACE),
628 const_iv (SDLK_TAB),
629 const_iv (SDLK_CLEAR),
630 const_iv (SDLK_RETURN),
631 const_iv (SDLK_PAUSE),
632 const_iv (SDLK_ESCAPE),
633 const_iv (SDLK_SPACE),
634 const_iv (SDLK_EXCLAIM),
635 const_iv (SDLK_QUOTEDBL),
636 const_iv (SDLK_HASH),
637 const_iv (SDLK_DOLLAR),
638 const_iv (SDLK_AMPERSAND),
639 const_iv (SDLK_QUOTE),
640 const_iv (SDLK_LEFTPAREN),
641 const_iv (SDLK_RIGHTPAREN),
642 const_iv (SDLK_ASTERISK),
643 const_iv (SDLK_PLUS),
644 const_iv (SDLK_COMMA),
645 const_iv (SDLK_MINUS),
646 const_iv (SDLK_PERIOD),
647 const_iv (SDLK_SLASH),
648 const_iv (SDLK_0),
649 const_iv (SDLK_1),
650 const_iv (SDLK_2),
651 const_iv (SDLK_3),
652 const_iv (SDLK_4),
653 const_iv (SDLK_5),
654 const_iv (SDLK_6),
655 const_iv (SDLK_7),
656 const_iv (SDLK_8),
657 const_iv (SDLK_9),
658 const_iv (SDLK_COLON),
659 const_iv (SDLK_SEMICOLON),
660 const_iv (SDLK_LESS),
661 const_iv (SDLK_EQUALS),
662 const_iv (SDLK_GREATER),
663 const_iv (SDLK_QUESTION),
664 const_iv (SDLK_AT),
665
666 const_iv (SDLK_LEFTBRACKET),
667 const_iv (SDLK_BACKSLASH),
668 const_iv (SDLK_RIGHTBRACKET),
669 const_iv (SDLK_CARET),
670 const_iv (SDLK_UNDERSCORE),
671 const_iv (SDLK_BACKQUOTE),
672 const_iv (SDLK_DELETE),
608 673
609 const_iv (SDLK_FIRST), 674 const_iv (SDLK_FIRST),
610 const_iv (SDLK_LAST), 675 const_iv (SDLK_LAST),
611 const_iv (SDLK_KP0), 676 const_iv (SDLK_KP0),
612 const_iv (SDLK_KP1), 677 const_iv (SDLK_KP1),
688 const_iv (KMOD_RMETA), 753 const_iv (KMOD_RMETA),
689 const_iv (KMOD_NUM), 754 const_iv (KMOD_NUM),
690 const_iv (KMOD_CAPS), 755 const_iv (KMOD_CAPS),
691 const_iv (KMOD_MODE), 756 const_iv (KMOD_MODE),
692 757
758 const_iv (KMOD_LRAM),
759
693 const_iv (MIX_DEFAULT_FORMAT), 760 const_iv (MIX_DEFAULT_FORMAT),
694 761
695 const_iv (SDL_INIT_TIMER), 762 const_iv (SDL_INIT_TIMER),
696 const_iv (SDL_INIT_AUDIO), 763 const_iv (SDL_INIT_AUDIO),
697 const_iv (SDL_INIT_VIDEO), 764 const_iv (SDL_INIT_VIDEO),
884 { 951 {
885 case SDL_KEYDOWN: 952 case SDL_KEYDOWN:
886 case SDL_KEYUP: 953 case SDL_KEYUP:
887 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 954 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
888 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 955 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
889 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod & MOD_MASK), 0); 956 hv_store (hv, "mod", 3, newSViv (mod_munge (ev.key.keysym.mod)), 0);
890 hv_store (hv, "cmod", 4, newSViv (SDL_GetModState () & MOD_MASK), 0); /* current mode */ 957 hv_store (hv, "cmod", 4, newSViv (mod_munge (SDL_GetModState ())), 0); /* current mode */
891 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 958 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
892 break; 959 break;
893 960
894 case SDL_ACTIVEEVENT: 961 case SDL_ACTIVEEVENT:
895 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 962 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);
913 x = ev.motion.x; 980 x = ev.motion.x;
914 y = ev.motion.y; 981 y = ev.motion.y;
915 SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION)); 982 SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION));
916 } 983 }
917 984
918 hv_store (hv, "mod", 3, newSViv (SDL_GetModState () & MOD_MASK), 0); 985 hv_store (hv, "mod", 3, newSViv (mod_munge (SDL_GetModState ())), 0);
919 hv_store (hv, "state", 5, newSViv (state), 0); 986 hv_store (hv, "state", 5, newSViv (state), 0);
920 hv_store (hv, "x", 1, newSViv (x), 0); 987 hv_store (hv, "x", 1, newSViv (x), 0);
921 hv_store (hv, "y", 1, newSViv (y), 0); 988 hv_store (hv, "y", 1, newSViv (y), 0);
922 hv_store (hv, "xrel", 4, newSViv (xrel), 0); 989 hv_store (hv, "xrel", 4, newSViv (xrel), 0);
923 hv_store (hv, "yrel", 4, newSViv (yrel), 0); 990 hv_store (hv, "yrel", 4, newSViv (yrel), 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines