Skip to content

Commit

Permalink
filterTrigger: filter negative trigger axis event after positive axis…
Browse files Browse the repository at this point in the history
… detection

If filterTrigger detects a positive axis event on a common trigger axis while also
configuring a trigger, the next input event will be a negative axis press
(as the trigger needs to transition from >0 to rest at -32767).

Filter this negative event or else the next item in the configuration dialog
(typically "left thumb") will erroneously detect this as a separate event.
  • Loading branch information
psyke83 authored and joolswills committed Sep 24, 2019
1 parent 72b8644 commit a252ea2
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions es-core/src/guis/GuiInputConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,28 @@ bool GuiInputConfig::filterTrigger(Input input, InputConfig* config, int inputId
&& InputManager::getInstance()->getAxisCountByDevice(config->getDeviceId()) == 6)
{
// digital triggers are unwanted
if (input.type == TYPE_BUTTON && (input.id == 6 || input.id == 7))
if(input.type == TYPE_BUTTON && (input.id == 6 || input.id == 7))
{
mHoldingInput = false;
return true;
}
}

// ignore negative pole for axes 2/5 only when triggers are being configured
if((mSkipAxis || strstr(GUI_INPUT_CONFIG_LIST[inputId].name, "Trigger") != NULL) \
&& input.type == TYPE_AXIS && (input.id == 2 || input.id == 5) && input.value < 0)
if(input.type == TYPE_AXIS && (input.id == 2 || input.id == 5))
{
mSkipAxis = true;
return true;
if(strstr(GUI_INPUT_CONFIG_LIST[inputId].name, "Trigger") != NULL)
{
if(input.value == 1)
mSkipAxis = true;
else if(input.value == -1)
return true;
}
else if(mSkipAxis)
{
mSkipAxis = false;
return true;
}
}
#endif

Expand Down

0 comments on commit a252ea2

Please sign in to comment.