Commit 62c27d58 authored by Abhinav Singh's avatar Abhinav Singh Committed by Adrien Plazas
Browse files

gamepad: Add set_mapping() to Gamepad

This will allow us to change mapping of a Gamepad even after its
construction.

https://bugzilla.gnome.org/show_bug.cgi?id=780754
parent c6203099
......@@ -5,7 +5,6 @@
#include <linux/input-event-codes.h>
#include <stdlib.h>
#include "../event/event.h"
#include "gamepad-mapping.h"
#include "gamepad-mappings-manager.h"
struct _GamesGamepad {
......@@ -224,6 +223,16 @@ on_unplugged (GamesRawGamepad *sender,
/* Public */
void
games_gamepad_set_mapping (GamesGamepad *self,
GamesGamepadMapping *mapping)
{
if (self->mapping != NULL)
g_object_unref (self->mapping);
self->mapping = mapping ? g_object_ref (mapping) : NULL;
}
// FIXME
GamesGamepad *
games_gamepad_new (GamesRawGamepad *raw_gamepad,
......
......@@ -5,6 +5,7 @@
#include <glib-object.h>
#include "raw-gamepad.h"
#include "gamepad-mapping.h"
G_BEGIN_DECLS
......@@ -14,6 +15,8 @@ G_DECLARE_FINAL_TYPE (GamesGamepad, games_gamepad, GAMES, GAMEPAD, GObject)
GamesGamepad *games_gamepad_new (GamesRawGamepad *raw_gamepad,
GError **error);
void games_gamepad_set_mapping (GamesGamepad *self,
GamesGamepadMapping *mapping);
G_END_DECLS
......
......@@ -9,4 +9,5 @@ private class Games.Gamepad : GLib.Object {
public signal void hat_event (Event event);
public signal void unplugged ();
public Gamepad (RawGamepad raw_gamepad) throws GLib.Error;
public void set_mapping (GamepadMapping? mapping);
}
Markdown is supported
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