Compensate for button down time when computing extra minimum button down

This commit is contained in:
Cameron Gutman
2022-08-02 18:14:10 -05:00
parent 54a6aa9081
commit a73129243c

View File

@@ -1505,10 +1505,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
int buttonDownTime = (int)(event.getEventTime() - event.getDownTime());
if (buttonDownTime < ControllerHandler.MINIMUM_BUTTON_DOWN_TIME_MS)
{
// Since our sleep time is so short (10 ms), it shouldn't cause a problem doing this in the
// UI thread.
// Since our sleep time is so short (<= 25 ms), it shouldn't cause a problem doing this
// in the UI thread.
try {
Thread.sleep(ControllerHandler.MINIMUM_BUTTON_DOWN_TIME_MS);
Thread.sleep(ControllerHandler.MINIMUM_BUTTON_DOWN_TIME_MS - buttonDownTime);
} catch (InterruptedException e) {
e.printStackTrace();