]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Change key handling, er, quite a bit.
authorwarp <warp@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Oct 2003 08:43:23 +0000 (08:43 +0000)
committerwarp <warp@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Oct 2003 08:43:23 +0000 (08:43 +0000)
Note, Windows is broken by this, it needs fixing up ASAP.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3580 d7cf8633-e32d-0410-b094-e92efae38249

keys.c
keys.h
menu.c
menu.h
vid_glx.c
vid_wgl.c

diff --git a/keys.c b/keys.c
index 1ef992dab668913b8e1cdc8f8861ecece896ea77..02a3f8080b13986014b2967a38ee5aa28e3f4429 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -29,7 +29,6 @@ key up events are sent even if in console mode
 #define MAXCMDLINE 256
 char key_lines[32][MAXCMDLINE];
 int key_linepos;
-int shift_down = false;
 int key_insert;        // insert key toggle (for editing)
 
 int edit_line = 0;
@@ -41,7 +40,6 @@ keydest_t key_dest;
 char *keybindings[256];
 qboolean consolekeys[256];     // if true, can't be rebound while in console
 qboolean menubound[256];       // if true, can't be rebound while in menu
-int keyshift[256];             // key to map to if shift held down in console
 int key_repeats[256];  // if > 1, it is autorepeating
 qboolean keydown[256];
 
@@ -182,7 +180,7 @@ Key_Console
 Interactive line editing and console scrollback
 ====================
 */
-void Key_Console (int key)
+void Key_Console (int key, char ascii)
 {
        // LordHavoc: copied most of this from Q2 to improve keyboard handling
        switch (key)
@@ -416,7 +414,7 @@ void Key_Console (int key)
        }
 
        // non printable
-       if (key < 32 || key > 127)
+       if (ascii < 32 || ascii > 126)
                return;
 
        if (key_linepos < MAXCMDLINE-1)
@@ -437,7 +435,7 @@ void Key_Console (int key)
 
                // only null terminate if at the end
                i = key_lines[edit_line][key_linepos];
-               key_lines[edit_line][key_linepos] = key;
+               key_lines[edit_line][key_linepos] = ascii;
                key_linepos++;
 
                if (!i)
@@ -452,7 +450,7 @@ qboolean chat_team = false;
 char chat_buffer[256];
 int chat_bufferlen = 0;
 
-void Key_Message (int key)
+void Key_Message (int key, char ascii)
 {
        if (key == K_ENTER || key == K_KP_ENTER)
        {
@@ -477,10 +475,6 @@ void Key_Message (int key)
                return;
        }
 
-       // non printable
-       if (key < 32 || key > 127)
-               return;
-
        if (key == K_BACKSPACE)
        {
                if (chat_bufferlen)
@@ -491,10 +485,14 @@ void Key_Message (int key)
                return;
        }
 
+       // non printable
+       if (ascii < 32 || ascii > 126)
+               return;
+
        if (chat_bufferlen == sizeof(chat_buffer) - 1)
                return; // all full
 
-       chat_buffer[chat_bufferlen++] = key;
+       chat_buffer[chat_bufferlen++] = ascii;
        chat_buffer[chat_bufferlen] = 0;
 }
 
@@ -747,32 +745,6 @@ void Key_Init (void)
        consolekeys['`'] = false;
        consolekeys['~'] = false;
 
-       for (i = 0;i < 256;i++)
-               keyshift[i] = i;
-       for (i = 'a';i <= 'z';i++)
-               keyshift[i] = i - 'a' + 'A';
-       keyshift['1'] = '!';
-       keyshift['2'] = '@';
-       keyshift['3'] = '#';
-       keyshift['4'] = '$';
-       keyshift['5'] = '%';
-       keyshift['6'] = '^';
-       keyshift['7'] = '&';
-       keyshift['8'] = '*';
-       keyshift['9'] = '(';
-       keyshift['0'] = ')';
-       keyshift['-'] = '_';
-       keyshift['='] = '+';
-       keyshift[','] = '<';
-       keyshift['.'] = '>';
-       keyshift['/'] = '?';
-       keyshift[';'] = ':';
-       keyshift['\''] = '"';
-       keyshift['['] = '{';
-       keyshift[']'] = '}';
-       keyshift['`'] = '~';
-       keyshift['\\'] = '|';
-
        menubound[K_ESCAPE] = true;
        for (i=0 ; i<12 ; i++)
                menubound[K_F1+i] = true;
@@ -794,7 +766,7 @@ Called by the system between frames for both key up and key down events
 Should NOT be called during an interrupt!
 ===================
 */
-void Key_Event (int key, qboolean down)
+void Key_Event (int key, char ascii, qboolean down)
 {
        char    *kb;
        char    cmd[1024];
@@ -820,9 +792,6 @@ void Key_Event (int key, qboolean down)
        else
                key_repeats[key] = 0;
 
-       if (key == K_SHIFT)
-               shift_down = down;
-
 //
 // handle escape specialy, so the user can never unbind it
 //
@@ -833,10 +802,10 @@ void Key_Event (int key, qboolean down)
                switch (key_dest)
                {
                case key_message:
-                       Key_Message (key);
+                       Key_Message (key, 0);
                        break;
                case key_menu:
-                       MR_Keydown (key);
+                       MR_Keydown (key, 0);
                        break;
                case key_game:
                        MR_ToggleMenu_f ();
@@ -876,11 +845,7 @@ void Key_Event (int key, qboolean down)
                //if (!down)
                //      return;
 
-               // FIXME: this does not support non-QWERTY keyboards
-               if (shift_down)
-                       key = keyshift[key];
-
-               Key_Console (key);
+               Key_Console (key, ascii);
        }
        else
        {
@@ -899,15 +864,6 @@ void Key_Event (int key, qboolean down)
                                sprintf (cmd, "-%s %i\n", kb+1, key);
                                Cbuf_AddText (cmd);
                        }
-                       if (keyshift[key] != key)
-                       {
-                               kb = keybindings[keyshift[key]];
-                               if (kb && kb[0] == '+')
-                               {
-                                       sprintf (cmd, "-%s %i\n", kb+1, key);
-                                       Cbuf_AddText (cmd);
-                               }
-                       }
                        return;
                }
 
@@ -945,22 +901,18 @@ void Key_Event (int key, qboolean down)
                if (!down)
                        return;         // other systems only care about key down events
 
-               // FIXME: this does not support non-QWERTY keyboards
-               if (shift_down)
-                       key = keyshift[key];
-
                switch (key_dest)
                {
                case key_message:
-                       Key_Message (key);
+                       Key_Message (key, ascii);
                        break;
                case key_menu:
-                       MR_Keydown (key);
+                       MR_Keydown (key, ascii);
                        break;
 
                case key_game:
                //case key_console:
-                       Key_Console (key);
+                       Key_Console (key, ascii);
                        break;
                default:
                        Sys_Error ("Bad key_dest");
diff --git a/keys.h b/keys.h
index 9e85a321d3d336695e543ce9f326d368d7e36a58..4140f29cf34507224ae499b9a53ad4640649ddfc 100644 (file)
--- a/keys.h
+++ b/keys.h
@@ -162,7 +162,7 @@ typedef enum {key_game, key_message, key_menu} keydest_t;
 extern int key_consoleactive;
 extern keydest_t key_dest;
 
-void Key_Event (int key, qboolean down);
+void Key_Event (int key, char ascii, qboolean down);
 void Key_Init (void);
 void Key_WriteBindings (qfile_t *f);
 void Key_SetBinding (int keynum, char *binding);
diff --git a/menu.c b/menu.c
index 52e0f7cb05c1f908bffb9ba32e54b40243cb0dcc..539ae07018c0bf142fc69531f79d2056551a28e7 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -66,22 +66,22 @@ void M_LanConfig_Draw (void);
 void M_GameOptions_Draw (void);
 void M_ServerList_Draw (void);
 
-void M_Main_Key (int key);
-       void M_SinglePlayer_Key (int key);
-               void M_Load_Key (int key);
-               void M_Save_Key (int key);
-       void M_MultiPlayer_Key (int key);
-               void M_Setup_Key (int key);
-       void M_Options_Key (int key);
-       void M_Options_Effects_Key (int key);
-       void M_Options_ColorControl_Key (int key);
-               void M_Keys_Key (int key);
-               void M_Video_Key (int key);
-       void M_Help_Key (int key);
-       void M_Quit_Key (int key);
-void M_LanConfig_Key (int key);
-void M_GameOptions_Key (int key);
-void M_ServerList_Key (int key);
+void M_Main_Key (int key, char ascii);
+       void M_SinglePlayer_Key (int key, char ascii);
+               void M_Load_Key (int key, char ascii);
+               void M_Save_Key (int key, char ascii);
+       void M_MultiPlayer_Key (int key, char ascii);
+               void M_Setup_Key (int key, char ascii);
+       void M_Options_Key (int key, char ascii);
+       void M_Options_Effects_Key (int key, char ascii);
+       void M_Options_ColorControl_Key (int key, char ascii);
+               void M_Keys_Key (int key, char ascii);
+               void M_Video_Key (int key, char ascii);
+       void M_Help_Key (int key, char ascii);
+       void M_Quit_Key (int key, char ascii);
+void M_LanConfig_Key (int key, char ascii);
+void M_GameOptions_Key (int key, char ascii);
+void M_ServerList_Key (int key, char ascii);
 
 qboolean       m_entersound;           // play after drawing a frame, so caching
                                                                // won't disrupt the sound
@@ -308,7 +308,7 @@ void M_Menu_Demos_f (void)
        m_entersound = true;
 }
 
-void M_Demo_Key (int k)
+void M_Demo_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -404,7 +404,7 @@ void M_Main_Draw (void)
 }
 
 
-void M_Main_Key (int key)
+void M_Main_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -600,7 +600,7 @@ void M_SinglePlayer_Draw (void)
 }
 
 
-void M_SinglePlayer_Key (int key)
+void M_SinglePlayer_Key (int key, char ascii)
 {
        if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
        {
@@ -755,7 +755,7 @@ void M_Save_Draw (void)
 }
 
 
-void M_Load_Key (int k)
+void M_Load_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -793,7 +793,7 @@ void M_Load_Key (int k)
 }
 
 
-void M_Save_Key (int k)
+void M_Save_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -858,7 +858,7 @@ void M_MultiPlayer_Draw (void)
 }
 
 
-void M_MultiPlayer_Key (int key)
+void M_MultiPlayer_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -988,7 +988,7 @@ void M_Setup_Draw (void)
 }
 
 
-void M_Setup_Key (int k)
+void M_Setup_Key (int k, char ascii)
 {
        int                     l;
 
@@ -1057,7 +1057,7 @@ forward:
                break;
 
        default:
-               if (k < 32 || k > 127)
+               if (ascii < 32 || ascii > 126)
                        break;
                if (setup_cursor == 0)
                {
@@ -1065,7 +1065,7 @@ forward:
                        if (l < 15)
                        {
                                setup_myname[l+1] = 0;
-                               setup_myname[l] = k;
+                               setup_myname[l] = ascii;
                        }
                }
        }
@@ -1295,7 +1295,7 @@ void M_Options_Draw (void)
 }
 
 
-void M_Options_Key (int k)
+void M_Options_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -1473,7 +1473,7 @@ void M_Options_Effects_Draw (void)
 }
 
 
-void M_Options_Effects_Key (int k)
+void M_Options_Effects_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -1701,7 +1701,7 @@ void M_Options_ColorControl_Draw (void)
 }
 
 
-void M_Options_ColorControl_Key (int k)
+void M_Options_ColorControl_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -2065,7 +2065,7 @@ void M_Keys_Draw (void)
 }
 
 
-void M_Keys_Key (int k)
+void M_Keys_Key (int k, char ascii)
 {
        char    cmd[80];
        int             keys[NUMKEYS];
@@ -2241,7 +2241,7 @@ void M_Menu_Video_AdjustSliders (int dir)
 }
 
 
-void M_Video_Key (int key)
+void M_Video_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -2317,7 +2317,7 @@ void M_Help_Draw (void)
 }
 
 
-void M_Help_Key (int key)
+void M_Help_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -2431,7 +2431,7 @@ void M_Menu_Quit_f (void)
 }
 
 
-void M_Quit_Key (int key)
+void M_Quit_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -2564,7 +2564,7 @@ void M_LanConfig_Draw (void)
 }
 
 
-void M_LanConfig_Key (int key)
+void M_LanConfig_Key (int key, char ascii)
 {
        int             l;
 
@@ -2628,7 +2628,7 @@ void M_LanConfig_Key (int key)
                break;
 
        default:
-               if (key < 32 || key > 127)
+               if (ascii < 32 || ascii > 126)
                        break;
 
                if (lanConfig_cursor == 2)
@@ -2637,11 +2637,11 @@ void M_LanConfig_Key (int key)
                        if (l < 21)
                        {
                                lanConfig_joinname[l+1] = 0;
-                               lanConfig_joinname[l] = key;
+                               lanConfig_joinname[l] = ascii;
                        }
                }
 
-               if (key < '0' || key > '9')
+               if (ascii < '0' || ascii > '9')
                        break;
                if (lanConfig_cursor == 0)
                {
@@ -2649,7 +2649,7 @@ void M_LanConfig_Key (int key)
                        if (l < 5)
                        {
                                lanConfig_portname[l+1] = 0;
-                               lanConfig_portname[l] = key;
+                               lanConfig_portname[l] = ascii;
                        }
                }
        }
@@ -3288,7 +3288,7 @@ void M_NetStart_Change (int dir)
        }
 }
 
-void M_GameOptions_Key (int key)
+void M_GameOptions_Key (int key, char ascii)
 {
        gamelevels_t *g;
        int l;
@@ -3359,7 +3359,7 @@ void M_GameOptions_Key (int key)
                break;
 
        default:
-               if (key < 32 || key > 127)
+               if (ascii < 32 || ascii > 126)
                        break;
                if (gameoptions_cursor == 8)
                {
@@ -3367,7 +3367,7 @@ void M_GameOptions_Key (int key)
                        if (l < 37)
                        {
                                memcpy(hostnamebuf, hostname.string, l);
-                               hostnamebuf[l] = key;
+                               hostnamebuf[l] = ascii;
                                hostnamebuf[l+1] = 0;
                                Cvar_Set("hostname", hostnamebuf);
                        }
@@ -3430,7 +3430,7 @@ void M_ServerList_Draw (void)
 }
 
 
-void M_ServerList_Key(int k)
+void M_ServerList_Key(int k, char ascii)
 {
        switch (k)
        {
@@ -3472,7 +3472,7 @@ void M_ServerList_Key(int k)
 //=============================================================================
 /* Menu Subsystem */
 
-void M_Keydown(int key);
+void M_Keydown(int key, char ascii);
 void M_Draw(void);
 void M_ToggleMenu_f(void);
 void M_Shutdown(void);
@@ -3651,7 +3651,7 @@ void M_Draw (void)
 }
 
 
-void M_Keydown (int key)
+void M_Keydown (int key, char ascii)
 {
        switch (m_state)
        {
@@ -3659,71 +3659,71 @@ void M_Keydown (int key)
                return;
 
        case m_main:
-               M_Main_Key (key);
+               M_Main_Key (key, ascii);
                return;
 
        case m_demo:
-               M_Demo_Key (key);
+               M_Demo_Key (key, ascii);
                return;
 
        case m_singleplayer:
-               M_SinglePlayer_Key (key);
+               M_SinglePlayer_Key (key, ascii);
                return;
 
        case m_load:
-               M_Load_Key (key);
+               M_Load_Key (key, ascii);
                return;
 
        case m_save:
-               M_Save_Key (key);
+               M_Save_Key (key, ascii);
                return;
 
        case m_multiplayer:
-               M_MultiPlayer_Key (key);
+               M_MultiPlayer_Key (key, ascii);
                return;
 
        case m_setup:
-               M_Setup_Key (key);
+               M_Setup_Key (key, ascii);
                return;
 
        case m_options:
-               M_Options_Key (key);
+               M_Options_Key (key, ascii);
                return;
 
        case m_options_effects:
-               M_Options_Effects_Key (key);
+               M_Options_Effects_Key (key, ascii);
                return;
 
        case m_options_colorcontrol:
-               M_Options_ColorControl_Key (key);
+               M_Options_ColorControl_Key (key, ascii);
                return;
 
        case m_keys:
-               M_Keys_Key (key);
+               M_Keys_Key (key, ascii);
                return;
 
        case m_video:
-               M_Video_Key (key);
+               M_Video_Key (key, ascii);
                return;
 
        case m_help:
-               M_Help_Key (key);
+               M_Help_Key (key, ascii);
                return;
 
        case m_quit:
-               M_Quit_Key (key);
+               M_Quit_Key (key, ascii);
                return;
 
        case m_lanconfig:
-               M_LanConfig_Key (key);
+               M_LanConfig_Key (key, ascii);
                return;
 
        case m_gameoptions:
-               M_GameOptions_Key (key);
+               M_GameOptions_Key (key, ascii);
                return;
 
        case m_slist:
-               M_ServerList_Key (key);
+               M_ServerList_Key (key, ascii);
                return;
        }
 }
@@ -3771,13 +3771,14 @@ void MP_Error(void)
        MR_SetRouting (TRUE);
 }
 
-void MP_Keydown (int key)
+void MP_Keydown (int key, char ascii)
 {
        PRVM_Begin;
        PRVM_SetProg(PRVM_MENUPROG);
 
        // pass key
        prog->globals[OFS_PARM0] = (float) key;
+       prog->globals[OFS_PARM1] = (float) ascii;
        PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key) required\n");
 
        PRVM_End;
diff --git a/menu.h b/menu.h
index 05c1b2a9402c659072f49bd06fbcea347ed94fd5..04d774c7310c9fa37003fb34c11ece0738bc994f 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -71,7 +71,7 @@ void MP_Shutdown (void);*/
 //
 void MR_Init (void);
 void MR_Restart (void);
-void (*MR_Keydown) (int key);
+void (*MR_Keydown) (int key, char ascii);
 void (*MR_Draw) (void);
 void (*MR_ToggleMenu_f) (void);
 void (*MR_Shutdown) (void);
index 8b9c02812b2955210126ce32ef55192b255e7516..edcfbe623ce023762b9ee0695c57892525835036 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -108,7 +108,7 @@ static Colormap vidx11_colormap;
 
 /*-----------------------------------------------------------------------*/
 
-static int XLateKey(XKeyEvent *ev)
+static int XLateKey(XKeyEvent *ev, char *ascii)
 {
        int key = 0;
        char buf[64];
@@ -116,6 +116,7 @@ static int XLateKey(XKeyEvent *ev)
 
        keysym = XLookupKeysym (ev, 0);
        XLookupString(ev, buf, sizeof buf, &shifted, 0);
+       *ascii = buf[0];
 
        switch(keysym)
        {
@@ -203,33 +204,7 @@ static int XLateKey(XKeyEvent *ev)
                case XK_KP_Subtract: key = K_KP_MINUS; break;
                case XK_KP_Divide: key = K_KP_SLASH; break;
 
-#if 0
-               case 0x021: key = '1';break;/* [!] */
-               case 0x040: key = '2';break;/* [@] */
-               case 0x023: key = '3';break;/* [#] */
-               case 0x024: key = '4';break;/* [$] */
-               case 0x025: key = '5';break;/* [%] */
-               case 0x05e: key = '6';break;/* [^] */
-               case 0x026: key = '7';break;/* [&] */
-               case 0x02a: key = '8';break;/* [*] */
-               case 0x028: key = '9';;break;/* [(] */
-               case 0x029: key = '0';break;/* [)] */
-               case 0x05f: key = '-';break;/* [_] */
-               case 0x02b: key = '=';break;/* [+] */
-               case 0x07c: key = '\'';break;/* [|] */
-               case 0x07d: key = '[';break;/* [}] */
-               case 0x07b: key = ']';break;/* [{] */
-               case 0x022: key = '\'';break;/* ["] */
-               case 0x03a: key = ';';break;/* [:] */
-               case 0x03f: key = '/';break;/* [?] */
-               case 0x03e: key = '.';break;/* [>] */
-               case 0x03c: key = ',';break;/* [<] */
-#endif
-
                default:
-                       key = buf[0];
-                       if (key >= 'A' && key <= 'Z')
-                               key = key - 'A' + 'a';
                        break;
        }
 
@@ -317,6 +292,8 @@ static void uninstall_grabs(void)
 static void HandleEvents(void)
 {
        XEvent event;
+       int key;
+       char ascii;
        qboolean dowarp = false;
 
        if (!vidx11_display)
@@ -330,12 +307,14 @@ static void HandleEvents(void)
                {
                case KeyPress:
                        // key pressed
-                       Key_Event(XLateKey(&event.xkey), true);
+                       key = XLateKey (&event.xkey, &ascii);
+                       Key_Event(key, ascii, true);
                        break;
 
                case KeyRelease:
                        // key released
-                       Key_Event(XLateKey(&event.xkey), false);
+                       key = XLateKey (&event.xkey, &ascii);
+                       Key_Event(key, ascii, false);
                        break;
 
                case MotionNotify:
@@ -370,40 +349,40 @@ static void HandleEvents(void)
                        switch(event.xbutton.button)
                        {
                        case 1:
-                               Key_Event(K_MOUSE1, true);
+                               Key_Event(K_MOUSE1, 0, true);
                                break;
                        case 2:
-                               Key_Event(K_MOUSE3, true);
+                               Key_Event(K_MOUSE3, 0, true);
                                break;
                        case 3:
-                               Key_Event(K_MOUSE2, true);
+                               Key_Event(K_MOUSE2, 0, true);
                                break;
                        case 4:
-                               Key_Event(K_MWHEELUP, true);
+                               Key_Event(K_MWHEELUP, 0, true);
                                break;
                        case 5:
-                               Key_Event(K_MWHEELDOWN, true);
+                               Key_Event(K_MWHEELDOWN, 0, true);
                                break;
                        case 6:
-                               Key_Event(K_MOUSE4, true);
+                               Key_Event(K_MOUSE4, 0, true);
                                break;
                        case 7:
-                               Key_Event(K_MOUSE5, true);
+                               Key_Event(K_MOUSE5, 0, true);
                                break;
                        case 8:
-                               Key_Event(K_MOUSE6, true);
+                               Key_Event(K_MOUSE6, 0, true);
                                break;
                        case 9:
-                               Key_Event(K_MOUSE7, true);
+                               Key_Event(K_MOUSE7, 0, true);
                                break;
                        case 10:
-                               Key_Event(K_MOUSE8, true);
+                               Key_Event(K_MOUSE8, 0, true);
                                break;
                        case 11:
-                               Key_Event(K_MOUSE9, true);
+                               Key_Event(K_MOUSE9, 0, true);
                                break;
                        case 12:
-                               Key_Event(K_MOUSE10, true);
+                               Key_Event(K_MOUSE10, 0, true);
                                break;
                        default:
                                Con_Printf("HandleEvents: ButtonPress gave value %d, 1-12 expected\n", event.xbutton.button);
@@ -416,40 +395,40 @@ static void HandleEvents(void)
                        switch(event.xbutton.button)
                        {
                        case 1:
-                               Key_Event(K_MOUSE1, false);
+                               Key_Event(K_MOUSE1, 0, false);
                                break;
                        case 2:
-                               Key_Event(K_MOUSE3, false);
+                               Key_Event(K_MOUSE3, 0, false);
                                break;
                        case 3:
-                               Key_Event(K_MOUSE2, false);
+                               Key_Event(K_MOUSE2, 0, false);
                                break;
                        case 4:
-                               Key_Event(K_MWHEELUP, false);
+                               Key_Event(K_MWHEELUP, 0, false);
                                break;
                        case 5:
-                               Key_Event(K_MWHEELDOWN, false);
+                               Key_Event(K_MWHEELDOWN, 0, false);
                                break;
                        case 6:
-                               Key_Event(K_MOUSE4, false);
+                               Key_Event(K_MOUSE4, 0, false);
                                break;
                        case 7:
-                               Key_Event(K_MOUSE5, false);
+                               Key_Event(K_MOUSE5, 0, false);
                                break;
                        case 8:
-                               Key_Event(K_MOUSE6, false);
+                               Key_Event(K_MOUSE6, 0, false);
                                break;
                        case 9:
-                               Key_Event(K_MOUSE7, false);
+                               Key_Event(K_MOUSE7, 0, false);
                                break;
                        case 10:
-                               Key_Event(K_MOUSE8, false);
+                               Key_Event(K_MOUSE8, 0, false);
                                break;
                        case 11:
-                               Key_Event(K_MOUSE9, false);
+                               Key_Event(K_MOUSE9, 0, false);
                                break;
                        case 12:
-                               Key_Event(K_MOUSE10, false);
+                               Key_Event(K_MOUSE10, 0, false);
                                break;
                        default:
                                Con_Printf("HandleEvents: ButtonRelease gave value %d, 1-12 expected\n", event.xbutton.button);
index ac5dd9dca7727652a30462999999abcb36d6fd00..1e37bb374e2103fe6ca29a93ac622040995c3990 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -436,7 +436,7 @@ void ClearAllStates (void)
 // send an up event for each key, to make sure the server clears them all
        for (i=0 ; i<256 ; i++)
        {
-               Key_Event (i, false);
+               Key_Event (i, 0, false);
        }
 
        Key_ClearStates ();
@@ -599,11 +599,11 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
                // Event.
                case WM_MOUSEWHEEL:
                        if ((short) HIWORD(wParam) > 0) {
-                               Key_Event(K_MWHEELUP, true);
-                               Key_Event(K_MWHEELUP, false);
+                               Key_Event(K_MWHEELUP, 0, true);
+                               Key_Event(K_MWHEELUP, 0, false);
                        } else {
-                               Key_Event(K_MWHEELDOWN, true);
-                               Key_Event(K_MWHEELDOWN, false);
+                               Key_Event(K_MWHEELDOWN, 0, true);
+                               Key_Event(K_MWHEELDOWN, 0, false);
                        }
                        break;
 
@@ -1287,13 +1287,13 @@ void IN_MouseEvent (int mstate)
                        if ( (mstate & (1<<i)) &&
                                !(mouse_oldbuttonstate & (1<<i)) )
                        {
-                               Key_Event (K_MOUSE1 + i, true);
+                               Key_Event (K_MOUSE1 + i, 0, true);
                        }
 
                        if ( !(mstate & (1<<i)) &&
                                (mouse_oldbuttonstate & (1<<i)) )
                        {
-                               Key_Event (K_MOUSE1 + i, false);
+                               Key_Event (K_MOUSE1 + i, 0, false);
                        }
                }
 
@@ -1385,13 +1385,13 @@ void IN_MouseMove (usercmd_t *cmd)
                        if ( (mstate_di & (1<<i)) &&
                                !(mouse_oldbuttonstate & (1<<i)) )
                        {
-                               Key_Event (K_MOUSE1 + i, true);
+                               Key_Event (K_MOUSE1 + i, 0, true);
                        }
 
                        if ( !(mstate_di & (1<<i)) &&
                                (mouse_oldbuttonstate & (1<<i)) )
                        {
-                               Key_Event (K_MOUSE1 + i, false);
+                               Key_Event (K_MOUSE1 + i, 0, false);
                        }
                }
 
@@ -1660,13 +1660,13 @@ void IN_Commands (void)
                if ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) )
                {
                        key_index = (i < 4) ? K_JOY1 : K_AUX1;
-                       Key_Event (key_index + i, true);
+                       Key_Event (key_index + i, 0, true);
                }
 
                if ( !(buttonstate & (1<<i)) && (joy_oldbuttonstate & (1<<i)) )
                {
                        key_index = (i < 4) ? K_JOY1 : K_AUX1;
-                       Key_Event (key_index + i, false);
+                       Key_Event (key_index + i, 0, false);
                }
        }
        joy_oldbuttonstate = buttonstate;
@@ -1693,12 +1693,12 @@ void IN_Commands (void)
                {
                        if ( (povstate & (1<<i)) && !(joy_oldpovstate & (1<<i)) )
                        {
-                               Key_Event (K_AUX29 + i, true);
+                               Key_Event (K_AUX29 + i, 0, true);
                        }
 
                        if ( !(povstate & (1<<i)) && (joy_oldpovstate & (1<<i)) )
                        {
-                               Key_Event (K_AUX29 + i, false);
+                               Key_Event (K_AUX29 + i, 0, false);
                        }
                }
                joy_oldpovstate = povstate;