GstGLWindow : Add mouse-event and key-event signals for navigation

https://bugzilla.gnome.org/show_bug.cgi?id=703486
This commit is contained in:
Vasilis Liaskovitis 2014-07-06 23:39:47 +03:00 committed by Matthew Waters
parent 1adb0a77d6
commit 41632d486b
2 changed files with 61 additions and 0 deletions

View file

@ -106,6 +106,16 @@ typedef struct _GstGLDummyWindowCass
GstGLDummyWindow *gst_gl_dummy_window_new (void);
enum
{
SIGNAL_0,
EVENT_MOUSE_SIGNAL,
EVENT_KEY_SIGNAL,
LAST_SIGNAL
};
static guint gst_gl_window_signals[LAST_SIGNAL] = { 0 };
GQuark
gst_gl_window_error_quark (void)
{
@ -131,6 +141,36 @@ gst_gl_window_class_init (GstGLWindowClass * klass)
klass->send_message = GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message);
G_OBJECT_CLASS (klass)->finalize = gst_gl_window_finalize;
/**
* GstGLWindow::mouse-event:
* @object: the #GstGLWindow
* @id: the name of the event
* @button: the id of the button
* @x: the x coordinate of the mouse event
* @y: the y coordinate of the mouse event
*
* Will be emitted when a mouse event is received by the GstGLwindow.
*
*/
gst_gl_window_signals[EVENT_MOUSE_SIGNAL] =
g_signal_new ("mouse-event", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
/**
* GstGLWindow::key-event:
* @object: the #GstGLWindow
* @id: the name of the event
* @key: the id of the key pressed
*
* Will be emitted when a key event is received by the GstGLwindow.
*
*/
gst_gl_window_signals[EVENT_KEY_SIGNAL] =
g_signal_new ("key-event", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
}
/**
@ -729,3 +769,19 @@ gst_gl_dummy_window_new (void)
{
return g_object_new (gst_gl_dummy_window_get_type (), NULL);
}
void
gst_gl_window_send_key_event (GstGLWindow * window, char *event_type,
char *key_str)
{
g_signal_emit (window, gst_gl_window_signals[EVENT_KEY_SIGNAL], 0,
event_type, key_str);
}
void
gst_gl_window_send_mouse_event (GstGLWindow * window, char *event_type,
int button, double posx, double posy)
{
g_signal_emit (window, gst_gl_window_signals[EVENT_MOUSE_SIGNAL], 0,
event_type, button, posx, posy);
}

View file

@ -153,6 +153,11 @@ GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
gboolean gst_gl_window_is_running (GstGLWindow *window);
void gst_gl_window_send_key_event(GstGLWindow * window, char * event_type,
char * key_str);
void gst_gl_window_send_mouse_event(GstGLWindow * window, char *
event_type, int button, double posx, double posy);
GST_DEBUG_CATEGORY_EXTERN (gst_gl_window_debug);
G_END_DECLS