Volume hotkey logic+response improvement (#13667)
This commit is contained in:
parent
b697f556e5
commit
977a7d3eb6
28
runloop.c
28
runloop.c
|
@ -6902,26 +6902,24 @@ static enum runloop_state_enum runloop_check_state(
|
||||||
{
|
{
|
||||||
static unsigned volume_hotkey_delay = 0;
|
static unsigned volume_hotkey_delay = 0;
|
||||||
static unsigned volume_hotkey_delay_active = 0;
|
static unsigned volume_hotkey_delay_active = 0;
|
||||||
unsigned volume_hotkey_delay_default = 15;
|
unsigned volume_hotkey_delay_default = 6;
|
||||||
if (BIT256_GET(current_bits, RARCH_VOLUME_UP))
|
bool volume_hotkey_up = BIT256_GET(
|
||||||
|
current_bits, RARCH_VOLUME_UP);
|
||||||
|
bool volume_hotkey_down = BIT256_GET(
|
||||||
|
current_bits, RARCH_VOLUME_DOWN);
|
||||||
|
|
||||||
|
if ( (volume_hotkey_up && !volume_hotkey_down) ||
|
||||||
|
(volume_hotkey_down && !volume_hotkey_up))
|
||||||
{
|
{
|
||||||
if (volume_hotkey_delay > 0)
|
if (volume_hotkey_delay > 0)
|
||||||
volume_hotkey_delay--;
|
volume_hotkey_delay--;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
command_event(CMD_EVENT_VOLUME_UP, NULL);
|
if (volume_hotkey_up)
|
||||||
if (volume_hotkey_delay_active > 0)
|
command_event(CMD_EVENT_VOLUME_UP, NULL);
|
||||||
volume_hotkey_delay_active--;
|
else if (volume_hotkey_down)
|
||||||
volume_hotkey_delay = volume_hotkey_delay_active;
|
command_event(CMD_EVENT_VOLUME_DOWN, NULL);
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (BIT256_GET(current_bits, RARCH_VOLUME_DOWN))
|
|
||||||
{
|
|
||||||
if (volume_hotkey_delay > 0)
|
|
||||||
volume_hotkey_delay--;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
command_event(CMD_EVENT_VOLUME_DOWN, NULL);
|
|
||||||
if (volume_hotkey_delay_active > 0)
|
if (volume_hotkey_delay_active > 0)
|
||||||
volume_hotkey_delay_active--;
|
volume_hotkey_delay_active--;
|
||||||
volume_hotkey_delay = volume_hotkey_delay_active;
|
volume_hotkey_delay = volume_hotkey_delay_active;
|
||||||
|
|
Loading…
Reference in New Issue