mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-19 16:00:56 +00:00
Fix key-repeats in the console (for instance the backspace key)
This commit is contained in:
parent
84a1766702
commit
50e1bf16fe
3 changed files with 25 additions and 9 deletions
|
@ -41,6 +41,11 @@ typedef struct in_state
|
||||||
int *in_speed_state;
|
int *in_speed_state;
|
||||||
} in_state_t;
|
} in_state_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keyboard initialisation. Called by the client.
|
||||||
|
*/
|
||||||
|
void IN_KeyboardInit(Key_Event_fp_t fp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Updates the state of the input queue
|
* Updates the state of the input queue
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +54,7 @@ void IN_Update(void);
|
||||||
/*
|
/*
|
||||||
* Initializes the input backend
|
* Initializes the input backend
|
||||||
*/
|
*/
|
||||||
void IN_BackendInit(in_state_t *in_state_p, Key_Event_fp_t fp);
|
void IN_BackendInit(in_state_t *in_state_p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shuts the backend down
|
* Shuts the backend down
|
||||||
|
|
|
@ -178,10 +178,7 @@ VID_LoadRefresh(void)
|
||||||
in_state.in_speed_state = &in_speed.state;
|
in_state.in_speed_state = &in_speed.state;
|
||||||
|
|
||||||
// Initiate the input backend
|
// Initiate the input backend
|
||||||
IN_BackendInit (&in_state, Do_Key_Event);
|
IN_BackendInit (&in_state);
|
||||||
|
|
||||||
// Initiate keyboard at the input backend
|
|
||||||
Key_ClearStates();
|
|
||||||
|
|
||||||
// Declare the refresher as active
|
// Declare the refresher as active
|
||||||
ref_active = true;
|
ref_active = true;
|
||||||
|
@ -193,6 +190,10 @@ VID_LoadRefresh(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initiate keyboard at the input backend
|
||||||
|
IN_KeyboardInit(Do_Key_Event);
|
||||||
|
Key_ClearStates();
|
||||||
|
|
||||||
Com_Printf("------------------------------------\n\n");
|
Com_Printf("------------------------------------\n\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,15 +560,15 @@ IN_MLookUp(void)
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the backend
|
* Keyboard initialisation. Called by the client.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
IN_BackendInit(in_state_t *in_state_p, Key_Event_fp_t fp)
|
IN_KeyboardInit(Key_Event_fp_t fp)
|
||||||
{
|
{
|
||||||
in_state = in_state_p;
|
|
||||||
Key_Event_fp = fp;
|
Key_Event_fp = fp;
|
||||||
mouse_x = mouse_y = 0;
|
|
||||||
|
|
||||||
|
/* SDL stuff. Moved here from IN_BackendInit because
|
||||||
|
* this must be done after video is initialized. */
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
have_grab = GLimp_InputIsGrabbed();
|
have_grab = GLimp_InputIsGrabbed();
|
||||||
|
@ -577,6 +577,16 @@ IN_BackendInit(in_state_t *in_state_p, Key_Event_fp_t fp)
|
||||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
have_grab = (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON);
|
have_grab = (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initializes the backend
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
IN_BackendInit(in_state_t *in_state_p)
|
||||||
|
{
|
||||||
|
in_state = in_state_p;
|
||||||
|
mouse_x = mouse_y = 0;
|
||||||
|
|
||||||
exponential_speedup = Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE);
|
exponential_speedup = Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE);
|
||||||
freelook = Cvar_Get("freelook", "1", 0);
|
freelook = Cvar_Get("freelook", "1", 0);
|
||||||
|
|
Loading…
Reference in a new issue