[gnome-games] gamepad: Check mapping on standard button events
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gamepad: Check mapping on standard button events
- Date: Sat, 27 Aug 2016 07:14:15 +0000 (UTC)
commit d14b06c79e24610a05f852ced8ffbf1e836453b8
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Aug 21 08:57:14 2016 +0200
gamepad: Check mapping on standard button events
This avoids standard button events to be handled two times if the
gamepad has a mapping while allowing to map any event.
https://bugzilla.gnome.org/show_bug.cgi?id=770468
src/gamepad/gamepad.vala | 3 +++
src/gamepad/linux/linux-raw-gamepad.vala | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gamepad/gamepad.vala b/src/gamepad/gamepad.vala
index 0082dee..3811222 100644
--- a/src/gamepad/gamepad.vala
+++ b/src/gamepad/gamepad.vala
@@ -47,6 +47,9 @@ private class Games.Gamepad : Object {
}
private void on_standard_button_event (StandardGamepadButton button, bool value) {
+ if (mapping != null)
+ return;
+
button_event (button, value);
}
diff --git a/src/gamepad/linux/linux-raw-gamepad.vala b/src/gamepad/linux/linux-raw-gamepad.vala
index 65dd850..0747623 100644
--- a/src/gamepad/linux/linux-raw-gamepad.vala
+++ b/src/gamepad/linux/linux-raw-gamepad.vala
@@ -137,8 +137,7 @@ private class Games.LinuxRawGamepad : Object, RawGamepad {
case Linux.Input.EV_KEY:
if ((code & Linux.Input.BTN_GAMEPAD) == Linux.Input.BTN_GAMEPAD)
standard_button_event (button_to_standard_button (code), (bool) event.value);
- else if ((code & Linux.Input.BTN_MISC) == Linux.Input.BTN_MISC)
- button_event (key_map[code - Linux.Input.BTN_MISC], (bool) event.value);
+ button_event (key_map[code - Linux.Input.BTN_MISC], (bool) event.value);
break;
case Linux.Input.EV_ABS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]