Commit ae3f974d authored by Adrien Plazas's avatar Adrien Plazas
Browse files

gamepad: Add the 'event' signal to Gamepad

This will be used to propagate gamepad events from the raw gamepad.

https://bugzilla.gnome.org/show_bug.cgi?id=782611
parent fb85071c
......@@ -3,6 +3,7 @@
#include "gamepad.h"
#include <stdlib.h>
#include "../event/event.h"
#include "gamepad-mapping.h"
#include "gamepad-mappings-manager.h"
......@@ -16,6 +17,7 @@ struct _GamesGamepad {
G_DEFINE_TYPE (GamesGamepad, games_gamepad, G_TYPE_OBJECT)
enum {
SIGNAL_EVENT,
SIGNAL_BUTTON_EVENT,
SIGNAL_AXIS_EVENT,
SIGNAL_UNPLUGGED,
......@@ -277,6 +279,19 @@ static void games_gamepad_class_init (GamesGamepadClass *klass) {
games_gamepad_parent_class = g_type_class_peek_parent (klass);
G_OBJECT_CLASS (klass)->finalize = finalize;
/**
* GamesGamepad::event:
* @event: the event emitted by the gamepad
**/
signals[SIGNAL_EVENT] =
g_signal_new ("event",
GAMES_TYPE_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);
/**
* GamesGamepad::axis-event:
* @button: the code representing the button
......
......@@ -2,6 +2,7 @@
[CCode (cheader_filename = "gamepad.h")]
private class Games.Gamepad : GLib.Object {
public signal void event (Event event);
public signal void button_event (StandardGamepadButton button, bool value);
public signal void axis_event (StandardGamepadAxis axis, double value);
public signal void unplugged ();
......
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