[gnome-games] gamepad: Add the 'event' signal to RawGamepad
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gamepad: Add the 'event' signal to RawGamepad
- Date: Sun, 14 May 2017 17:05:49 +0000 (UTC)
commit 49659f1c6d023d787a0fcc10a956be81882dba49
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri May 12 06:53:57 2017 +0200
gamepad: Add the 'event' signal to RawGamepad
This will be used to propagate gamepad events in a simpler way.
https://bugzilla.gnome.org/show_bug.cgi?id=782611
src/gamepad/raw-gamepad.c | 15 +++++++++++++++
src/gamepad/raw-gamepad.vapi | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/gamepad/raw-gamepad.c b/src/gamepad/raw-gamepad.c
index b79893d..b35f2ab 100644
--- a/src/gamepad/raw-gamepad.c
+++ b/src/gamepad/raw-gamepad.c
@@ -2,6 +2,7 @@
#include "raw-gamepad.h"
+#include "../event/event.h"
#include "standard-gamepad-axis.h"
#include "standard-gamepad-button.h"
@@ -15,6 +16,7 @@ G_DEFINE_INTERFACE (GamesRawGamepad, games_raw_gamepad, G_TYPE_OBJECT)
/* Signals */
enum {
+ SIGNAL_EVENT,
SIGNAL_STANDARD_BUTTON_EVENT,
SIGNAL_BUTTON_EVENT,
SIGNAL_STANDARD_AXIS_EVENT,
@@ -57,6 +59,19 @@ games_raw_gamepad_default_init (GamesRawGamepadInterface *iface)
initialized = TRUE;
/**
+ * GamesRawGamepad::event:
+ * @event: the event emitted by the gamepad
+ **/
+ signals[SIGNAL_EVENT] =
+ g_signal_new ("event",
+ GAMES_TYPE_RAW_GAMEPAD,
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GAMES_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ /**
* GamesRawGamepad::standard-button-event:
* @button: the standard button emitting the event
* @value: %TRUE if the button is pressed, %FALSE otherwise
diff --git a/src/gamepad/raw-gamepad.vapi b/src/gamepad/raw-gamepad.vapi
index dde4c8e..ed837f5 100644
--- a/src/gamepad/raw-gamepad.vapi
+++ b/src/gamepad/raw-gamepad.vapi
@@ -2,6 +2,7 @@
[CCode (cheader_filename = "raw-gamepad.h")]
private interface Games.RawGamepad : GLib.Object {
+ public abstract signal void event (Event event);
public abstract signal void standard_button_event (StandardGamepadButton button, bool value);
public abstract signal void button_event (int code, bool value);
public abstract signal void standard_axis_event (StandardGamepadAxis axis, double value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]