[retro-gtk] Define signal callbacks with concrete types for user_data
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] Define signal callbacks with concrete types for user_data
- Date: Sat, 29 Feb 2020 06:45:40 +0000 (UTC)
commit a57679dbe915764849ee4eb44d3345034d99de8d
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Feb 22 21:00:19 2020 +0500
Define signal callbacks with concrete types for user_data
retro-gtk/retro-cairo-display.c | 8 +++-----
retro-gtk/retro-core-view.c | 31 ++++++++++---------------------
retro-gtk/retro-gl-display.c | 8 +++-----
retro-runner/retro-pa-player.c | 12 +++++-------
4 files changed, 21 insertions(+), 38 deletions(-)
---
diff --git a/retro-gtk/retro-cairo-display.c b/retro-gtk/retro-cairo-display.c
index 84f197e..f5e96ec 100644
--- a/retro-gtk/retro-cairo-display.c
+++ b/retro-gtk/retro-cairo-display.c
@@ -231,12 +231,10 @@ retro_cairo_display_init (RetroCairoDisplay *self)
}
static void
-on_video_output (RetroCore *sender,
- RetroPixdata *pixdata,
- gpointer user_data)
+on_video_output (RetroCore *sender,
+ RetroPixdata *pixdata,
+ RetroCairoDisplay *self)
{
- RetroCairoDisplay *self = RETRO_CAIRO_DISPLAY (user_data);
-
GdkPixbuf *pixbuf;
self->aspect_ratio = retro_pixdata_get_aspect_ratio (pixdata);
diff --git a/retro-gtk/retro-core-view.c b/retro-gtk/retro-core-view.c
index 13106e6..d09f28d 100644
--- a/retro-gtk/retro-core-view.c
+++ b/retro-gtk/retro-core-view.c
@@ -180,11 +180,10 @@ static gboolean get_key_state (RetroCoreView *self,
guint16 hardware_keycode);
static gboolean
-on_key_press_event (GtkWidget *source,
- GdkEventKey *event,
- gpointer data)
+on_key_press_event (GtkWidget *source,
+ GdkEventKey *event,
+ RetroCoreView *self)
{
- RetroCoreView *self = RETRO_CORE_VIEW (data);
gboolean changed;
if (event->keyval == GDK_KEY_Escape &&
@@ -204,12 +203,10 @@ on_key_press_event (GtkWidget *source,
}
static gboolean
-on_key_release_event (GtkWidget *source,
- GdkEventKey *event,
- gpointer data)
+on_key_release_event (GtkWidget *source,
+ GdkEventKey *event,
+ RetroCoreView *self)
{
- RetroCoreView *self = RETRO_CORE_VIEW (data);
-
set_input_released (self->key_state, event->hardware_keycode);
set_input_released (self->keyval_state, event->keyval);
@@ -221,10 +218,8 @@ on_key_release_event (GtkWidget *source,
static gboolean
on_button_press_event (GtkWidget *source,
GdkEventButton *event,
- gpointer data)
+ RetroCoreView *self)
{
- RetroCoreView *self = RETRO_CORE_VIEW (data);
-
gtk_widget_grab_focus (GTK_WIDGET (source));
if (retro_core_view_get_can_grab_pointer (self)) {
@@ -251,10 +246,8 @@ on_button_press_event (GtkWidget *source,
static gboolean
on_button_release_event (GtkWidget *source,
GdkEventButton *event,
- gpointer data)
+ RetroCoreView *self)
{
- RetroCoreView *self = RETRO_CORE_VIEW (data);
-
set_input_released (self->mouse_button_state, event->button);
g_signal_emit (self, signals[SIG_CONTROLLER_STATE_CHANGED_SIGNAL], 0);
@@ -265,10 +258,8 @@ on_button_release_event (GtkWidget *source,
static gboolean
on_focus_out_event (GtkWidget *source,
GdkEventFocus *event,
- gpointer data)
+ RetroCoreView *self)
{
- RetroCoreView *self = RETRO_CORE_VIEW (data);
-
if (get_is_pointer_grabbed (self))
ungrab (self);
@@ -283,10 +274,8 @@ on_focus_out_event (GtkWidget *source,
static gboolean
on_motion_notify_event (GtkWidget *source,
GdkEventMotion *event,
- gpointer data)
+ RetroCoreView *self)
{
- RetroCoreView *self = RETRO_CORE_VIEW (data);
-
if (retro_core_view_get_can_grab_pointer (self)) {
if (get_is_pointer_grabbed (self) &&
event->device == self->grabbed_device) {
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index 969159d..30f4193 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -355,12 +355,10 @@ retro_gl_display_init (RetroGLDisplay *self)
}
static void
-on_video_output (RetroCore *sender,
- RetroPixdata *pixdata,
- gpointer user_data)
+on_video_output (RetroCore *sender,
+ RetroPixdata *pixdata,
+ RetroGLDisplay *self)
{
- RetroGLDisplay *self = RETRO_GL_DISPLAY (user_data);
-
if (pixdata == NULL)
return;
diff --git a/retro-runner/retro-pa-player.c b/retro-runner/retro-pa-player.c
index cd677e0..5f2720d 100644
--- a/retro-runner/retro-pa-player.c
+++ b/retro-runner/retro-pa-player.c
@@ -139,14 +139,12 @@ resample (RetroPaPlayer *self,
}
static void
-on_audio_output (RetroCore *sender,
- gint16 *data,
- int length,
- gdouble sample_rate,
- gpointer user_data)
+on_audio_output (RetroCore *sender,
+ gint16 *data,
+ int length,
+ gdouble sample_rate,
+ RetroPaPlayer *self)
{
- RetroPaPlayer *self = RETRO_PA_PLAYER (user_data);
-
g_array_append_vals (self->buffer, data, length);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]