diff options
author | Stany MARCEL <stanypub@gmail.com> | 2015-11-05 03:01:58 +0300 |
---|---|---|
committer | Stany MARCEL <stanypub@gmail.com> | 2015-11-05 03:01:58 +0300 |
commit | 64519dfa8f5a74eb20104a2efd3bba7686d786d6 (patch) | |
tree | 9fa809d0e2edd255de2160d8e5737918f62aa0db /scripts | |
parent | b0acda83ad85d344c70aa9e52cae0aa256076d70 (diff) |
Correct a bug introduced with dpad filter
Signed-off-by: Stany MARCEL <stanypub@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/sc-xbox.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/sc-xbox.py b/scripts/sc-xbox.py index e41e018..2f41da2 100755 --- a/scripts/sc-xbox.py +++ b/scripts/sc-xbox.py @@ -53,7 +53,7 @@ button_map = { SCButtons.RGrip : Keys.BTN_B, } -LPAD_OUT_COUNT_FILTER = 4 +LPAD_OUT_COUNT_FILTER = 2 @static_vars(count_filter=0, prev_btn=0) def lpad_func(x, btn, threshold, evstick, evtouch, clicked, invert): @@ -75,14 +75,16 @@ def lpad_func(x, btn, threshold, evstick, evtouch, clicked, invert): if lpad_func.count_filter <= 0: events.append((evtouch, 0, False)) else: - lpad_func.count_filter = LPAD_OUT_COUNT_FILTER if invert: - events.append((evtouch, 1 if x > 0 else -1, True)) + events.append((evtouch, 1 if x > 0 else -1, lpad_func.count_filter <= 0)) else: - events.append((evtouch, 1 if x < 0 else -1, True)) + events.append((evtouch, 1 if x < 0 else -1, lpad_func.count_filter <= 0)) + lpad_func.count_filter = LPAD_OUT_COUNT_FILTER + + if clicked and rmv & SCButtons.LPad == SCButtons.LPad: + events.append((evtouch, 0, False)) - elif ((clicked and rmv & SCButtons.LPad == SCButtons.LPad) or - (not clicked and rmv & SCButtons.LPadTouch == SCButtons.LPadTouch)): + if not clicked and btn & SCButtons.LPadTouch != SCButtons.LPadTouch: lpad_func.count_filter -= 1 if lpad_func.count_filter <= 0: events.append((evtouch, 0, False)) |