From 7ac6ffcdbef8d69d4098caec80acc15413c37665 Mon Sep 17 00:00:00 2001 From: Conn O'Griofa Date: Fri, 26 Jul 2019 20:30:44 +0100 Subject: [PATCH] filterTrigger: filter negative trigger axis event after positive axis 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. --- es-core/src/guis/GuiInputConfig.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/es-core/src/guis/GuiInputConfig.cpp b/es-core/src/guis/GuiInputConfig.cpp index ff8622428..c3d72f9c3 100755 --- a/es-core/src/guis/GuiInputConfig.cpp +++ b/es-core/src/guis/GuiInputConfig.cpp @@ -352,16 +352,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; + } } #else (void)input;