[retro-gtk] core: Move Core.on_input_controller_connected() to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Move Core.on_input_controller_connected() to C
- Date: Fri, 7 Jul 2017 09:06:17 +0000 (UTC)
commit 8b8eb04117f5537ebc8968b2e72b42289314a52f
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 6 10:26:08 2017 +0200
core: Move Core.on_input_controller_connected() to C
This help porting the library to C.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/core.vala | 9 +--------
retro-gtk/retro-core.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index 81809a0..8ecf4c0 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -387,14 +387,7 @@ public class Core : Object {
set_controller_port_device (port, device_type);
}
- private void on_input_controller_connected (uint port, InputDevice device) {
- if (!is_initiated)
- return;
-
- var device_type = device.get_device_type ();
- set_controller_port_device (port, device_type);
- }
-
+ private extern void on_input_controller_connected (uint port, InputDevice device);
private extern void on_input_controller_disconnected (uint port);
private extern void on_input_key_event (bool down, KeyboardKey keycode, uint32 character,
KeyboardModifierKey key_modifiers);
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index d7c7a33..392ea7d 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -8,6 +8,24 @@
// FIXME Make static as soon as possible.
void
+retro_core_on_input_controller_connected (RetroCore *self,
+ guint port,
+ RetroInputDevice *device)
+{
+ RetroDeviceType device_type;
+
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (device != NULL);
+
+ if (!retro_core_get_is_initiated (self))
+ return;
+
+ device_type = retro_input_device_get_device_type (device);
+ retro_core_set_controller_port_device (self, port, device_type);
+}
+
+// FIXME Make static as soon as possible.
+void
retro_core_on_input_controller_disconnected (RetroCore *self,
guint port)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]