[gnome-games/wip/abhinavsingh/gamepad-config: 45/48] gamepad: Add a constructor to GamepadInput
- From: Abhinav Singh <abhinavsingh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/abhinavsingh/gamepad-config: 45/48] gamepad: Add a constructor to GamepadInput
- Date: Wed, 24 May 2017 04:09:07 +0000 (UTC)
commit d41b3eaec92c6c3ce58a39c14ef04d47a933a0dd
Author: theawless <theawless gmail com>
Date: Tue May 23 19:26:24 2017 +0530
gamepad: Add a constructor to GamepadInput
This will ease the construction for unpredictable init.
src/gamepad/gamepad-input.c | 8 ++++++++
src/gamepad/gamepad-input.h | 1 +
src/gamepad/gamepad-input.vapi | 1 +
3 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/gamepad/gamepad-input.c b/src/gamepad/gamepad-input.c
index 4cb8a6b..c851ca3 100644
--- a/src/gamepad/gamepad-input.c
+++ b/src/gamepad/gamepad-input.c
@@ -21,6 +21,14 @@ games_gamepad_input_free (GamesGamepadInput *self)
g_free (self);
}
+void
+games_gamepad_input_init (GamesGamepadInput *self, guint16 type, guint16 code)
+{
+ memset (self, 0, sizeof (GamesGamepadInput));
+ self->type = type;
+ self->code = code;
+}
+
GType
games_gamepad_input_get_type (void)
{
diff --git a/src/gamepad/gamepad-input.h b/src/gamepad/gamepad-input.h
index 7f6d9b8..6ae2c4c 100644
--- a/src/gamepad/gamepad-input.h
+++ b/src/gamepad/gamepad-input.h
@@ -17,6 +17,7 @@ typedef struct {
GType games_gamepad_input_get_type (void) G_GNUC_CONST;
GamesGamepadInput *games_gamepad_input_dup (const GamesGamepadInput *self);
void games_gamepad_input_free (GamesGamepadInput *self);
+void games_gamepad_input_init (GamesGamepadInput *self, guint16 type, guint16 code);
G_END_DECLS
diff --git a/src/gamepad/gamepad-input.vapi b/src/gamepad/gamepad-input.vapi
index 835e895..6a8cc4d 100644
--- a/src/gamepad/gamepad-input.vapi
+++ b/src/gamepad/gamepad-input.vapi
@@ -4,4 +4,5 @@
private struct Games.GamepadInput {
uint16 type;
uint16 code;
+ GamepadInput (uint16 type, uint16 code);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]