Commit 49659f1c authored by Adrien Plazas's avatar Adrien Plazas
Browse files

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
parent f602e51e
......@@ -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,
......@@ -56,6 +58,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
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment