mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
[input] Clear button inputs when IN_ClearStates called
This fixes the annoying persistence of inputs when respawning and changing levels. Axis input clearing is hooked up but does nothing as of yet. Active device input clearing has always been hooked up, but also does nothing in the evdev and x11 drivers.
This commit is contained in:
parent
925300716b
commit
89f8dfce09
4 changed files with 29 additions and 0 deletions
|
@ -351,7 +351,9 @@ void IN_ButtonAction (in_button_t *buttin, int id, int pressed);
|
|||
int IN_RegisterButton (in_button_t *button);
|
||||
int IN_RegisterAxis (in_axis_t *axis);
|
||||
in_button_t *IN_FindButton (const char *name);
|
||||
void IN_ButtonClearStates (void);
|
||||
in_axis_t *IN_FindAxis (const char *name);
|
||||
void IN_AxisClearStates (void);
|
||||
void IN_ButtonAddListener (in_button_t *button, button_listener_t listener,
|
||||
void *data);
|
||||
void IN_ButtonRemoveListener (in_button_t *button, button_listener_t listener,
|
||||
|
|
|
@ -75,6 +75,18 @@ IN_FindAxis (const char *name)
|
|||
return Hash_Find (axis_tab, name);
|
||||
}
|
||||
|
||||
static void
|
||||
axis_clear_state (void *_a, void *data)
|
||||
{
|
||||
//FIXME what to do here?
|
||||
}
|
||||
|
||||
void
|
||||
IN_AxisClearStates (void)
|
||||
{
|
||||
Hash_ForEach (axis_tab, axis_clear_state, 0);
|
||||
}
|
||||
|
||||
void
|
||||
IN_AxisAddListener (in_axis_t *axis, axis_listener_t listener, void *data)
|
||||
{
|
||||
|
|
|
@ -227,6 +227,19 @@ IN_ButtonRemoveListener (in_button_t *button, button_listener_t listener,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
button_clear_state (void *_rb, void *data)
|
||||
{
|
||||
regbutton_t *rb = _rb;
|
||||
button_release_cmd (rb->button);
|
||||
}
|
||||
|
||||
void
|
||||
IN_ButtonClearStates (void)
|
||||
{
|
||||
Hash_ForEach (button_tab, button_clear_state, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
in_button_shutdown (void *data)
|
||||
{
|
||||
|
|
|
@ -587,6 +587,8 @@ IN_ClearStates (void)
|
|||
rd->driver.clear_states (rd->data);
|
||||
}
|
||||
}
|
||||
IN_AxisClearStates ();
|
||||
IN_ButtonClearStates ();
|
||||
}
|
||||
|
||||
#ifdef HAVE_EVDEV
|
||||
|
|
Loading…
Reference in a new issue