[gnome-games/wip/aplazas/gamepad-event: 1/14] gamepad: Save changes made to the DPad's state
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/gamepad-event: 1/14] gamepad: Save changes made to the DPad's state
- Date: Sat, 13 May 2017 09:37:11 +0000 (UTC)
commit dfba6a5227f75b882e9d6532922dc74f41bbda67
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri May 12 21:48:31 2017 +0200
gamepad: Save changes made to the DPad's state
Take a reference to the DPad object rather than making a copy in
games_gamepad_mapping_get_dpad_mapping() so that the cahnges or saved.
https://bugzilla.gnome.org/show_bug.cgi?id=782549
src/gamepad/gamepad-mapping.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/gamepad/gamepad-mapping.c b/src/gamepad/gamepad-mapping.c
index de0f432..36460aa 100644
--- a/src/gamepad/gamepad-mapping.c
+++ b/src/gamepad/gamepad-mapping.c
@@ -340,7 +340,7 @@ games_gamepad_mapping_get_dpad_mapping (GamesGamepadMapping *self,
gint dpad_value,
GamesGamepadMappedEvent *event)
{
- GamesGamepadDPad dpad;
+ GamesGamepadDPad *dpad;
gint dpad_changed_value;
gint dpad_position;
@@ -349,22 +349,22 @@ games_gamepad_mapping_get_dpad_mapping (GamesGamepadMapping *self,
memset (event, 0, sizeof (GamesGamepadMappedEvent));
- dpad = g_array_index (self->dpads, GamesGamepadDPad, dpad_index);
+ dpad = &g_array_index (self->dpads, GamesGamepadDPad, dpad_index);
dpad_changed_value = (dpad_value == 0) ?
- dpad.axis_values[dpad_axis] :
+ dpad->axis_values[dpad_axis] :
dpad_value;
// We add 4 so that the remainder is always positive.
dpad_position = (dpad_changed_value + dpad_axis + 4) % 4;
- dpad.axis_values[dpad_axis] = dpad_value;
- event->type = dpad.types[dpad_position];
+ dpad->axis_values[dpad_axis] = dpad_value;
+ event->type = dpad->types[dpad_position];
switch (event->type) {
case GAMES_GAMEPAD_INPUT_TYPE_AXIS:
- event->axis = (GamesStandardGamepadAxis) dpad.values[dpad_position];
+ event->axis = (GamesStandardGamepadAxis) dpad->values[dpad_position];
break;
case GAMES_GAMEPAD_INPUT_TYPE_BUTTON:
- event->button = (GamesStandardGamepadButton) dpad.values[dpad_position];
+ event->button = (GamesStandardGamepadButton) dpad->values[dpad_position];
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]