[retro-gtk] core: Move Core.on_input_key_event() to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Move Core.on_input_key_event() to C
- Date: Fri, 7 Jul 2017 09:06:02 +0000 (UTC)
commit ffa1e14c5455c713940d6bb61123b185e12ce6ff
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 6 10:06:34 2017 +0200
core: Move Core.on_input_key_event() to C
This help porting the library to C.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/core.vala | 11 +--------
retro-gtk/retro-core.c | 60 ++++++++++++++++++++++++++++++++---------------
2 files changed, 42 insertions(+), 29 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index 9f5ecc2..f8c5f4b 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -412,16 +412,7 @@ public class Core : Object {
set_controller_port_device (port, DeviceType.NONE);
}
- private void on_input_key_event (bool down, KeyboardKey keycode, uint32 character,
KeyboardModifierKey key_modifiers) {
- if (!is_initiated)
- return;
-
- push_cb_data ();
- send_input_key_event (down, keycode, character, key_modifiers);
- pop_cb_data ();
- }
-
- private extern void send_input_key_event (bool down, KeyboardKey keycode, uint32 character,
KeyboardModifierKey key_modifiers);
+ private extern void on_input_key_event (bool down, KeyboardKey keycode, uint32 character,
KeyboardModifierKey key_modifiers);
private extern void set_system_av_info (SystemAvInfo system_av_info);
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index c25cb01..594f048 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -4,6 +4,47 @@
#include "retro-gtk-internal.h"
+/* Private */
+
+static void
+retro_core_send_input_key_event (RetroCore *self,
+ gboolean down,
+ RetroKeyboardKey keycode,
+ guint32 character,
+ RetroKeyboardModifierKey key_modifiers)
+{
+ RetroCoreEnvironmentInternal *environment_internal;
+
+ g_return_if_fail (self != NULL);
+
+ environment_internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
+
+ if (environment_internal->keyboard_callback.callback == NULL)
+ return;
+
+ environment_internal->keyboard_callback.callback (down, keycode, character, key_modifiers);
+}
+
+// FIXME Make static as soon as possible.
+void
+retro_core_on_input_key_event (RetroCore *self,
+ gboolean down,
+ RetroKeyboardKey keycode,
+ guint32 character,
+ RetroKeyboardModifierKey key_modifiers)
+{
+ g_return_if_fail (self != NULL);
+
+ if (!retro_core_get_is_initiated (self))
+ return;
+
+ retro_core_push_cb_data (self);
+ retro_core_send_input_key_event (self, down, keycode, character, key_modifiers);
+ retro_core_pop_cb_data ();
+}
+
+/* Public */
+
gboolean
retro_core_supports_serialization (RetroCore *self)
{
@@ -180,25 +221,6 @@ retro_core_set_memory (RetroCore *self,
}
void
-retro_core_send_input_key_event (RetroCore *self,
- gboolean down,
- RetroKeyboardKey keycode,
- guint32 character,
- RetroKeyboardModifierKey key_modifiers)
-{
- RetroCoreEnvironmentInternal *environment_internal;
-
- g_return_if_fail (self != NULL);
-
- environment_internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
-
- if (environment_internal->keyboard_callback.callback == NULL)
- return;
-
- environment_internal->keyboard_callback.callback (down, keycode, character, key_modifiers);
-}
-
-void
retro_core_environment_internal_setup (RetroCore *self)
{
self->environment_internal = g_new0 (RetroCoreEnvironmentInternal, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]