added IN_UpdateForKeydest() as a new helper who does stuff if the

key_dest changes matter to the keyboard driver, e.g. sending KP_
key decisions, or SDL unicode stuff. we run it every frame either
before Sys_SendKeyEvents() or from within Key_ForceDest() for now.
(merged from uhexen2.)

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@773 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2012-10-21 11:33:10 +00:00
parent 2a42d766a3
commit 9f8b2dfc0d
4 changed files with 14 additions and 8 deletions

View File

@ -687,6 +687,7 @@ void _Host_Frame (float time)
// get new key events
Key_ForceDest ();
//IN_UpdateForKeydest ();
Sys_SendKeyEvents ();
// allow mice or other external controllers to add commands
@ -726,9 +727,7 @@ void _Host_Frame (float time)
// fetch results from server
if (cls.state == ca_connected)
{
CL_ReadFromServer ();
}
// update video
if (host_speeds.value)

View File

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "SDL.h"
#endif
static qboolean prev_gamekey;
static qboolean prev_gamekey, gamekey;
#ifdef __APPLE__
/* Mouse acceleration needs to be disabled on OS X */
@ -300,12 +300,8 @@ void IN_ClearStates (void)
{
}
void IN_SendKeyEvents (void)
void IN_UpdateForKeydest (void)
{
SDL_Event event;
int sym, state, modstate;
qboolean gamekey;
gamekey = ((key_dest == key_game && !con_forcedup) || m_keys_bind_grab);
if (gamekey != prev_gamekey)
{
@ -313,6 +309,12 @@ void IN_SendKeyEvents (void)
Key_ClearStates();
SDL_EnableUNICODE(!gamekey);
}
}
void IN_SendKeyEvents (void)
{
SDL_Event event;
int sym, state, modstate;
while (SDL_PollEvent(&event))
{

View File

@ -39,6 +39,9 @@ void IN_MouseMove(int dx, int dy);
void IN_SendKeyEvents (void);
// used as a callback for Sys_SendKeyEvents() by some drivers
void IN_UpdateForKeydest (void);
// do stuff if key_dest changes matter to the keyboard driver
void IN_Move (usercmd_t *cmd);
// add additional movement on top of the keyboard move cmd

View File

@ -1077,5 +1077,7 @@ void Key_ForceDest (void)
forced = false;
break;
}
IN_UpdateForKeydest ();
}