mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
navigation: Add some validation while sending key/mouse events
https://bugzilla.gnome.org/show_bug.cgi?id=783330
This commit is contained in:
parent
8d1b45ded6
commit
398a6a2a1b
1 changed files with 7 additions and 0 deletions
|
@ -122,6 +122,9 @@ void
|
||||||
gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
|
gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
|
||||||
const char *key)
|
const char *key)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (g_strcmp0 (event, "key-press") == 0 ||
|
||||||
|
g_strcmp0 (event, "key-release") == 0);
|
||||||
|
|
||||||
gst_navigation_send_event (navigation,
|
gst_navigation_send_event (navigation,
|
||||||
gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
|
gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
|
||||||
event, "key", G_TYPE_STRING, key, NULL));
|
event, "key", G_TYPE_STRING, key, NULL));
|
||||||
|
@ -147,6 +150,10 @@ void
|
||||||
gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
|
gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
|
||||||
int button, double x, double y)
|
int button, double x, double y)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (g_strcmp0 (event, "mouse-button-press") == 0 ||
|
||||||
|
g_strcmp0 (event, "mouse-button-release") == 0 ||
|
||||||
|
g_strcmp0 (event, "mouse-move") == 0);
|
||||||
|
|
||||||
gst_navigation_send_event (navigation,
|
gst_navigation_send_event (navigation,
|
||||||
gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
|
gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
|
||||||
event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
||||||
|
|
Loading…
Reference in a new issue