mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
navigation: Add support for key Modifiers in all relevant events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2010>
This commit is contained in:
parent
b2a00dff07
commit
25819c41fb
16 changed files with 378 additions and 141 deletions
|
@ -606,7 +606,8 @@ gst_dfbvideosink_event_thread (GstDfbVideoSink * dfbvideosink)
|
||||||
GST_DEBUG_OBJECT (dfbvideosink, "key press event %c !",
|
GST_DEBUG_OBJECT (dfbvideosink, "key press event %c !",
|
||||||
event.input.key_symbol);
|
event.input.key_symbol);
|
||||||
gst_dfbvideosink_navigation_send_event
|
gst_dfbvideosink_navigation_send_event
|
||||||
(gst_navigation_event_new_key_press ("prout"));
|
(gst_navigation_event_new_key_press ("prout",
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
}
|
}
|
||||||
} else if (event.input.type == DIET_BUTTONPRESS) {
|
} else if (event.input.type == DIET_BUTTONPRESS) {
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
@ -618,7 +619,7 @@ gst_dfbvideosink_event_thread (GstDfbVideoSink * dfbvideosink)
|
||||||
|
|
||||||
gst_dfbvideosink_navigation_send_event
|
gst_dfbvideosink_navigation_send_event
|
||||||
(gst_navigation_event_new_mouse_button_press (event.input.button,
|
(gst_navigation_event_new_mouse_button_press (event.input.button,
|
||||||
x, y));
|
x, y, GST_NAVIGATION_MODIFIER_NONE));
|
||||||
} else if (event.input.type == DIET_BUTTONRELEASE) {
|
} else if (event.input.type == DIET_BUTTONRELEASE) {
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
|
@ -629,13 +630,14 @@ gst_dfbvideosink_event_thread (GstDfbVideoSink * dfbvideosink)
|
||||||
|
|
||||||
gst_dfbvideosink_navigation_send_event
|
gst_dfbvideosink_navigation_send_event
|
||||||
(gst_navigation_event_new_mouse_button_release
|
(gst_navigation_event_new_mouse_button_release
|
||||||
(event.input.button, x, y));
|
(event.input.button, x, y, GST_NAVIGATION_MODIFIER_NONE));
|
||||||
} else if (event.input.type == DIET_AXISMOTION) {
|
} else if (event.input.type == DIET_AXISMOTION) {
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
dfbvideosink->layer->GetCursorPosition (dfbvideosink->layer, &x, &y);
|
dfbvideosink->layer->GetCursorPosition (dfbvideosink->layer, &x, &y);
|
||||||
gst_dfbvideosink_navigation_send_event
|
gst_dfbvideosink_navigation_send_event
|
||||||
(gst_navigation_event_new_mouse_move (x, y));
|
(gst_navigation_event_new_mouse_move (x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (dfbvideosink, "unhandled event type %d",
|
GST_WARNING_OBJECT (dfbvideosink, "unhandled event type %d",
|
||||||
event.input.type);
|
event.input.type);
|
||||||
|
|
|
@ -482,7 +482,7 @@ gst_handdetect_transform_ip (GstOpencvVideoFilter * transform,
|
||||||
gst_handdetect_navigation_send_event (GST_NAVIGATION (filter),
|
gst_handdetect_navigation_send_event (GST_NAVIGATION (filter),
|
||||||
gst_navigation_event_new_mouse_move (
|
gst_navigation_event_new_mouse_move (
|
||||||
(double) (filter->best_r->x + filter->best_r->width * 0.5),
|
(double) (filter->best_r->x + filter->best_r->width * 0.5),
|
||||||
(double) (filter->best_r->y + filter->best_r->height * 0.5)));
|
(double) (filter->best_r->y + filter->best_r->height * 0.5), GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ gst_handdetect_transform_ip (GstOpencvVideoFilter * transform,
|
||||||
gst_handdetect_navigation_send_event (GST_NAVIGATION (filter),
|
gst_handdetect_navigation_send_event (GST_NAVIGATION (filter),
|
||||||
gst_navigation_event_new_mouse_move (
|
gst_navigation_event_new_mouse_move (
|
||||||
(double) (filter->best_r->x + filter->best_r->width * 0.5),
|
(double) (filter->best_r->x + filter->best_r->width * 0.5),
|
||||||
(double) (filter->best_r->y + filter->best_r->height * 0.5)));
|
(double) (filter->best_r->y + filter->best_r->height * 0.5), GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
/* or use another way to send upstream navigation event for debug
|
/* or use another way to send upstream navigation event for debug
|
||||||
*
|
*
|
||||||
|
|
|
@ -682,10 +682,15 @@ gst_vulkan_sink_key_event_cb (GstVulkanWindow * window, char *event_name, char
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (vk_sink, "event %s key %s pressed", event_name, key_string);
|
GST_DEBUG_OBJECT (vk_sink, "event %s key %s pressed", event_name, key_string);
|
||||||
|
/* FIXME: Add support for modifiers */
|
||||||
if (0 == g_strcmp0 ("key-press", event_name))
|
if (0 == g_strcmp0 ("key-press", event_name))
|
||||||
event = gst_navigation_event_new_key_press (key_string);
|
event =
|
||||||
|
gst_navigation_event_new_key_press (key_string,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
else if (0 == g_strcmp0 ("key-release", event_name))
|
else if (0 == g_strcmp0 ("key-release", event_name))
|
||||||
event = gst_navigation_event_new_key_release (key_string);
|
event =
|
||||||
|
gst_navigation_event_new_key_release (key_string,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (vk_sink), event);
|
gst_navigation_send_event_simple (GST_NAVIGATION (vk_sink), event);
|
||||||
|
@ -697,13 +702,20 @@ gst_vulkan_sink_mouse_event_cb (GstVulkanWindow * window, char *event_name,
|
||||||
{
|
{
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
|
|
||||||
|
/* FIXME: Add support for modifiers */
|
||||||
GST_DEBUG_OBJECT (vk_sink, "event %s at %g, %g", event_name, posx, posy);
|
GST_DEBUG_OBJECT (vk_sink, "event %s at %g, %g", event_name, posx, posy);
|
||||||
if (0 == g_strcmp0 ("mouse-button-press", event_name))
|
if (0 == g_strcmp0 ("mouse-button-press", event_name))
|
||||||
event = gst_navigation_event_new_mouse_button_press (button, posx, posy);
|
event =
|
||||||
|
gst_navigation_event_new_mouse_button_press (button, posx, posy,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
else if (0 == g_strcmp0 ("mouse-button-release", event_name))
|
else if (0 == g_strcmp0 ("mouse-button-release", event_name))
|
||||||
event = gst_navigation_event_new_mouse_button_release (button, posx, posy);
|
event =
|
||||||
|
gst_navigation_event_new_mouse_button_release (button, posx, posy,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
else if (0 == g_strcmp0 ("mouse-move", event_name))
|
else if (0 == g_strcmp0 ("mouse-move", event_name))
|
||||||
event = gst_navigation_event_new_mouse_move (posx, posy);
|
event =
|
||||||
|
gst_navigation_event_new_mouse_move (posx, posy,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (vk_sink), event);
|
gst_navigation_send_event_simple (GST_NAVIGATION (vk_sink), event);
|
||||||
|
|
|
@ -692,9 +692,9 @@ gst_d3d11_video_sink_key_event (GstD3D11Window * window, const gchar * event,
|
||||||
if (self->enable_navigation_events) {
|
if (self->enable_navigation_events) {
|
||||||
GST_LOG_OBJECT (self, "send key event %s, key %s", event, key);
|
GST_LOG_OBJECT (self, "send key event %s, key %s", event, key);
|
||||||
if (0 == g_strcmp0 ("key-press", event))
|
if (0 == g_strcmp0 ("key-press", event))
|
||||||
key_event = gst_navigation_event_new_key_press (key);
|
key_event = gst_navigation_event_new_key_press (key, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
else if (0 == g_strcmp0 ("key-release", event))
|
else if (0 == g_strcmp0 ("key-release", event))
|
||||||
key_event = gst_navigation_event_new_key_release (key);
|
key_event = gst_navigation_event_new_key_release (key, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (self), key_event);
|
gst_navigation_send_event_simple (GST_NAVIGATION (self), key_event);
|
||||||
|
@ -711,11 +711,11 @@ gst_d3d11_video_mouse_key_event (GstD3D11Window * window, const gchar * event,
|
||||||
GST_LOG_OBJECT (self,
|
GST_LOG_OBJECT (self,
|
||||||
"send mouse event %s, button %d (%.1f, %.1f)", event, button, x, y);
|
"send mouse event %s, button %d (%.1f, %.1f)", event, button, x, y);
|
||||||
if (0 == g_strcmp0 ("mouse-button-press", event))
|
if (0 == g_strcmp0 ("mouse-button-press", event))
|
||||||
mouse_event = gst_navigation_event_new_mouse_button_press (button, x, y);
|
mouse_event = gst_navigation_event_new_mouse_button_press (button, x, y, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
else if (0 == g_strcmp0 ("mouse-button-release", event))
|
else if (0 == g_strcmp0 ("mouse-button-release", event))
|
||||||
mouse_event = gst_navigation_event_new_mouse_button_release (button, x, y);
|
mouse_event = gst_navigation_event_new_mouse_button_release (button, x, y, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
else if (0 == g_strcmp0 ("mouse-move", event))
|
else if (0 == g_strcmp0 ("mouse-move", event))
|
||||||
mouse_event = gst_navigation_event_new_mouse_move (x, y);
|
mouse_event = gst_navigation_event_new_mouse_move (x, y, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (self), mouse_event);
|
gst_navigation_send_event_simple (GST_NAVIGATION (self), mouse_event);
|
||||||
|
|
|
@ -2141,10 +2141,12 @@ d3d_wnd_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if (utfrep) {
|
if (utfrep) {
|
||||||
if (message == WM_KEYDOWN)
|
if (message == WM_KEYDOWN)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_key_press (utfrep));
|
gst_navigation_event_new_key_press (utfrep,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
else if (message == WM_KEYUP)
|
else if (message == WM_KEYUP)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_key_release (utfrep));
|
gst_navigation_event_new_key_release (utfrep,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
g_free (utfrep);
|
g_free (utfrep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2164,31 +2166,38 @@ d3d_wnd_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_move (x, y));
|
gst_navigation_event_new_mouse_move (x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_button_press (1, x, y));
|
gst_navigation_event_new_mouse_button_press (1, x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_button_release (1, x, y));
|
gst_navigation_event_new_mouse_button_release (1, x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_button_press (2, x, y));
|
gst_navigation_event_new_mouse_button_press (2, x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_button_release (2, x, y));
|
gst_navigation_event_new_mouse_button_release (2, x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_button_press (3, x, y));
|
gst_navigation_event_new_mouse_button_press (3, x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (sink),
|
||||||
gst_navigation_event_new_mouse_button_release (3, x, y));
|
gst_navigation_event_new_mouse_button_release (3, x, y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3077,10 +3077,12 @@ send_navigation_event (const GValue * v, gpointer user_data)
|
||||||
|
|
||||||
switch (d->step) {
|
switch (d->step) {
|
||||||
case TEST_NAV_MOUSE_MOVE:
|
case TEST_NAV_MOUSE_MOVE:
|
||||||
e = gst_navigation_event_new_mouse_move (4.7, 0.1);
|
e = gst_navigation_event_new_mouse_move (4.7, 0.1,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
break;
|
break;
|
||||||
case TEST_NAV_KEY_PRESS:
|
case TEST_NAV_KEY_PRESS:
|
||||||
e = gst_navigation_event_new_key_press ("Left");
|
e = gst_navigation_event_new_key_press ("Left",
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -637,8 +637,10 @@ gst_glimage_sink_navigation_send_event (GstNavigation * navigation,
|
||||||
_display_scroll_value_to_stream_scroll_value (sink, dx, dy, &stream_dx,
|
_display_scroll_value_to_stream_scroll_value (sink, dx, dy, &stream_dx,
|
||||||
&stream_dy);
|
&stream_dy);
|
||||||
|
|
||||||
|
/* FIXME: Add support for NavigationModifier */
|
||||||
gst_event_replace (&event,
|
gst_event_replace (&event,
|
||||||
gst_navigation_event_new_mouse_scroll (x, y, stream_dx, stream_dy));
|
gst_navigation_event_new_mouse_scroll (x, y, stream_dx, stream_dy,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
|
@ -946,10 +948,16 @@ gst_glimage_sink_key_event_cb (GstGLWindow * window, char *event_name, char
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (gl_sink, "event %s key %s pressed", event_name, key_string);
|
GST_DEBUG_OBJECT (gl_sink, "event %s key %s pressed", event_name, key_string);
|
||||||
if (0 == g_strcmp0 ("key-press", event_name))
|
// FIXME: Add support for modifiers
|
||||||
event = gst_navigation_event_new_key_press (key_string);
|
if (0 == g_strcmp0 ("key-press", event_name)) {
|
||||||
else if (0 == g_strcmp0 ("key-release", event_name))
|
event =
|
||||||
event = gst_navigation_event_new_key_release (key_string);
|
gst_navigation_event_new_key_press (key_string,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
} else if (0 == g_strcmp0 ("key-release", event_name)) {
|
||||||
|
event =
|
||||||
|
gst_navigation_event_new_key_release (key_string,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (gl_sink), event);
|
gst_navigation_send_event_simple (GST_NAVIGATION (gl_sink), event);
|
||||||
|
@ -962,12 +970,20 @@ gst_glimage_sink_mouse_event_cb (GstGLWindow * window, char *event_name,
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (gl_sink, "event %s at %g, %g", event_name, posx, posy);
|
GST_DEBUG_OBJECT (gl_sink, "event %s at %g, %g", event_name, posx, posy);
|
||||||
if (0 == g_strcmp0 ("mouse-button-press", event_name))
|
// FIXME: Add support for modifiers
|
||||||
event = gst_navigation_event_new_mouse_button_press (button, posx, posy);
|
if (0 == g_strcmp0 ("mouse-button-press", event_name)) {
|
||||||
else if (0 == g_strcmp0 ("mouse-button-release", event_name))
|
event =
|
||||||
event = gst_navigation_event_new_mouse_button_release (button, posx, posy);
|
gst_navigation_event_new_mouse_button_press (button, posx, posy,
|
||||||
else if (0 == g_strcmp0 ("mouse-move", event_name))
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
event = gst_navigation_event_new_mouse_move (posx, posy);
|
} else if (0 == g_strcmp0 ("mouse-button-release", event_name)) {
|
||||||
|
event =
|
||||||
|
gst_navigation_event_new_mouse_button_release (button, posx, posy,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
} else if (0 == g_strcmp0 ("mouse-move", event_name)) {
|
||||||
|
event =
|
||||||
|
gst_navigation_event_new_mouse_move (posx, posy,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (gl_sink), event);
|
gst_navigation_send_event_simple (GST_NAVIGATION (gl_sink), event);
|
||||||
|
@ -981,7 +997,8 @@ gst_glimage_sink_mouse_scroll_event_cb (GstGLWindow * window,
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (gl_sink, "event scroll at %g, %g", posx, posy);
|
GST_DEBUG_OBJECT (gl_sink, "event scroll at %g, %g", posx, posy);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (gl_sink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (gl_sink),
|
||||||
gst_navigation_event_new_mouse_scroll (posx, posy, delta_x, delta_y));
|
gst_navigation_event_new_mouse_scroll (posx, posy, delta_x, delta_y,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -26,27 +26,29 @@
|
||||||
* @short_description: Interface for creating, sending and parsing navigation
|
* @short_description: Interface for creating, sending and parsing navigation
|
||||||
* events.
|
* events.
|
||||||
*
|
*
|
||||||
* The Navigation interface is used for creating and injecting navigation related
|
* The Navigation interface is used for creating and injecting navigation
|
||||||
* events such as mouse button presses, cursor motion and key presses. The associated
|
* related events such as mouse button presses, cursor motion and key presses.
|
||||||
* library also provides methods for parsing received events, and for sending and
|
* The associated library also provides methods for parsing received events, and
|
||||||
* receiving navigation related bus events. One main usecase is DVD menu navigation.
|
* for sending and receiving navigation related bus events. One main usecase is
|
||||||
|
* DVD menu navigation.
|
||||||
*
|
*
|
||||||
* The main parts of the API are:
|
* The main parts of the API are:
|
||||||
*
|
*
|
||||||
* * The GstNavigation interface, implemented by elements which provide an application
|
* * The GstNavigation interface, implemented by elements which provide an
|
||||||
* with the ability to create and inject navigation events into the pipeline.
|
* application with the ability to create and inject navigation events into
|
||||||
* * GstNavigation event handling API. GstNavigation events are created in response to
|
* the pipeline.
|
||||||
* calls on a GstNavigation interface implementation, and sent in the pipeline. Upstream
|
* * GstNavigation event handling API. GstNavigation events are created in
|
||||||
* elements can use the navigation event API functions to parse the contents of received
|
* response to calls on a GstNavigation interface implementation, and sent in
|
||||||
* messages.
|
* the pipeline. Upstream elements can use the navigation event API functions
|
||||||
|
* to parse the contents of received messages.
|
||||||
*
|
*
|
||||||
* * GstNavigation message handling API. GstNavigation messages may be sent on the message
|
* * GstNavigation message handling API. GstNavigation messages may be sent on
|
||||||
* bus to inform applications of navigation related changes in the pipeline, such as the
|
* the message bus to inform applications of navigation related changes in the
|
||||||
* mouse moving over a clickable region, or the set of available angles changing.
|
* pipeline, such as the mouse moving over a clickable region, or the set of
|
||||||
*
|
* available angles changing.
|
||||||
* The GstNavigation message functions provide functions for creating and parsing
|
|
||||||
* custom bus messages for signaling GstNavigation changes.
|
|
||||||
*
|
*
|
||||||
|
* The GstNavigation message functions provide functions for creating and
|
||||||
|
* parsing custom bus messages for signaling GstNavigation changes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -801,6 +803,8 @@ gst_navigation_event_get_type (GstEvent * event)
|
||||||
/**
|
/**
|
||||||
* gst_navigation_event_new_key_press:
|
* gst_navigation_event_new_key_press:
|
||||||
* @key: A string identifying the key press.
|
* @key: A string identifying the key press.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for the given key press.
|
* Create a new navigation event for the given key press.
|
||||||
*
|
*
|
||||||
|
@ -809,16 +813,19 @@ gst_navigation_event_get_type (GstEvent * event)
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_key_press (const gchar * key)
|
gst_navigation_event_new_key_press (const gchar * key,
|
||||||
|
GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "key-press", "key", G_TYPE_STRING, key,
|
"event", G_TYPE_STRING, "key-press", "key", G_TYPE_STRING, key,
|
||||||
NULL));
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_navigation_event_new_key_release:
|
* gst_navigation_event_new_key_release:
|
||||||
* @key: A string identifying the released key.
|
* @key: A string identifying the released key.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for the given key release.
|
* Create a new navigation event for the given key release.
|
||||||
*
|
*
|
||||||
|
@ -827,11 +834,12 @@ gst_navigation_event_new_key_press (const gchar * key)
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_key_release (const gchar * key)
|
gst_navigation_event_new_key_release (const gchar * key,
|
||||||
|
GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "key-release", "key", G_TYPE_STRING, key,
|
"event", G_TYPE_STRING, "key-release", "key", G_TYPE_STRING, key,
|
||||||
NULL));
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -839,6 +847,8 @@ gst_navigation_event_new_key_release (const gchar * key)
|
||||||
* @button: The number of the pressed mouse button.
|
* @button: The number of the pressed mouse button.
|
||||||
* @x: The x coordinate of the mouse cursor.
|
* @x: The x coordinate of the mouse cursor.
|
||||||
* @y: The y coordinate of the mouse cursor.
|
* @y: The y coordinate of the mouse cursor.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for the given key mouse button press.
|
* Create a new navigation event for the given key mouse button press.
|
||||||
*
|
*
|
||||||
|
@ -847,12 +857,14 @@ gst_navigation_event_new_key_release (const gchar * key)
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_mouse_button_press (gint button, gdouble x, gdouble y)
|
gst_navigation_event_new_mouse_button_press (gint button, gdouble x, gdouble y,
|
||||||
|
GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "mouse-button-press",
|
"event", G_TYPE_STRING, "mouse-button-press",
|
||||||
"button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
"button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
||||||
"pointer_y", G_TYPE_DOUBLE, y, NULL));
|
"pointer_y", G_TYPE_DOUBLE, y,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -860,6 +872,8 @@ gst_navigation_event_new_mouse_button_press (gint button, gdouble x, gdouble y)
|
||||||
* @button: The number of the released mouse button.
|
* @button: The number of the released mouse button.
|
||||||
* @x: The x coordinate of the mouse cursor.
|
* @x: The x coordinate of the mouse cursor.
|
||||||
* @y: The y coordinate of the mouse cursor.
|
* @y: The y coordinate of the mouse cursor.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for the given key mouse button release.
|
* Create a new navigation event for the given key mouse button release.
|
||||||
*
|
*
|
||||||
|
@ -869,18 +883,21 @@ gst_navigation_event_new_mouse_button_press (gint button, gdouble x, gdouble y)
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_mouse_button_release (gint button, gdouble x,
|
gst_navigation_event_new_mouse_button_release (gint button, gdouble x,
|
||||||
gdouble y)
|
gdouble y, GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "mouse-button-release",
|
"event", G_TYPE_STRING, "mouse-button-release",
|
||||||
"button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
"button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
||||||
"pointer_y", G_TYPE_DOUBLE, y, NULL));
|
"pointer_y", G_TYPE_DOUBLE, y,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_navigation_event_new_mouse_move:
|
* gst_navigation_event_new_mouse_move:
|
||||||
* @x: The x coordinate of the mouse cursor.
|
* @x: The x coordinate of the mouse cursor.
|
||||||
* @y: The y coordinate of the mouse cursor.
|
* @y: The y coordinate of the mouse cursor.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for the new mouse location.
|
* Create a new navigation event for the new mouse location.
|
||||||
*
|
*
|
||||||
|
@ -889,11 +906,14 @@ gst_navigation_event_new_mouse_button_release (gint button, gdouble x,
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_mouse_move (gdouble x, gdouble y)
|
gst_navigation_event_new_mouse_move (gdouble x, gdouble y,
|
||||||
|
GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "mouse-move",
|
"event", G_TYPE_STRING, "mouse-move",
|
||||||
"pointer_x", G_TYPE_DOUBLE, x, "pointer_y", G_TYPE_DOUBLE, y, NULL));
|
"pointer_x", G_TYPE_DOUBLE, x,
|
||||||
|
"pointer_y", G_TYPE_DOUBLE, y,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -902,6 +922,8 @@ gst_navigation_event_new_mouse_move (gdouble x, gdouble y)
|
||||||
* @y: The y coordinate of the mouse cursor.
|
* @y: The y coordinate of the mouse cursor.
|
||||||
* @delta_x: The x component of the scroll movement.
|
* @delta_x: The x component of the scroll movement.
|
||||||
* @delta_y: The y component of the scroll movement.
|
* @delta_y: The y component of the scroll movement.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for the mouse scroll.
|
* Create a new navigation event for the mouse scroll.
|
||||||
*
|
*
|
||||||
|
@ -911,13 +933,14 @@ gst_navigation_event_new_mouse_move (gdouble x, gdouble y)
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_mouse_scroll (gdouble x, gdouble y, gdouble delta_x,
|
gst_navigation_event_new_mouse_scroll (gdouble x, gdouble y, gdouble delta_x,
|
||||||
gdouble delta_y)
|
gdouble delta_y, GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "mouse-scroll",
|
"event", G_TYPE_STRING, "mouse-scroll",
|
||||||
"pointer_x", G_TYPE_DOUBLE, x, "pointer_y", G_TYPE_DOUBLE, y,
|
"pointer_x", G_TYPE_DOUBLE, x, "pointer_y", G_TYPE_DOUBLE, y,
|
||||||
"delta_pointer_x", G_TYPE_DOUBLE, delta_x,
|
"delta_pointer_x", G_TYPE_DOUBLE, delta_x,
|
||||||
"delta_pointer_y", G_TYPE_DOUBLE, delta_y, NULL));
|
"delta_pointer_y", G_TYPE_DOUBLE, delta_y,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -947,6 +970,8 @@ gst_navigation_event_new_command (GstNavigationCommand command)
|
||||||
* @y: The y coordinate of the new touch point.
|
* @y: The y coordinate of the new touch point.
|
||||||
* @pressure: Pressure data of the touch point, from 0.0 to 1.0, or NaN if no
|
* @pressure: Pressure data of the touch point, from 0.0 to 1.0, or NaN if no
|
||||||
* data is available.
|
* data is available.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for an added touch point.
|
* Create a new navigation event for an added touch point.
|
||||||
*
|
*
|
||||||
|
@ -956,14 +981,15 @@ gst_navigation_event_new_command (GstNavigationCommand command)
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_touch_down (guint identifier, gdouble x, gdouble y,
|
gst_navigation_event_new_touch_down (guint identifier, gdouble x, gdouble y,
|
||||||
gdouble pressure)
|
gdouble pressure, GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "touch-down",
|
"event", G_TYPE_STRING, "touch-down",
|
||||||
"identifier", G_TYPE_UINT, identifier,
|
"identifier", G_TYPE_UINT, identifier,
|
||||||
"pointer_x", G_TYPE_DOUBLE, x,
|
"pointer_x", G_TYPE_DOUBLE, x,
|
||||||
"pointer_y", G_TYPE_DOUBLE, y,
|
"pointer_y", G_TYPE_DOUBLE, y,
|
||||||
"pressure", G_TYPE_DOUBLE, pressure, NULL));
|
"pressure", G_TYPE_DOUBLE, pressure,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -974,6 +1000,8 @@ gst_navigation_event_new_touch_down (guint identifier, gdouble x, gdouble y,
|
||||||
* @y: The y coordinate of the touch point.
|
* @y: The y coordinate of the touch point.
|
||||||
* @pressure: Pressure data of the touch point, from 0.0 to 1.0, or NaN if no
|
* @pressure: Pressure data of the touch point, from 0.0 to 1.0, or NaN if no
|
||||||
* data is available.
|
* data is available.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for a moved touch point.
|
* Create a new navigation event for a moved touch point.
|
||||||
*
|
*
|
||||||
|
@ -983,14 +1011,15 @@ gst_navigation_event_new_touch_down (guint identifier, gdouble x, gdouble y,
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_touch_motion (guint identifier, gdouble x, gdouble y,
|
gst_navigation_event_new_touch_motion (guint identifier, gdouble x, gdouble y,
|
||||||
gdouble pressure)
|
gdouble pressure, GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "touch-motion",
|
"event", G_TYPE_STRING, "touch-motion",
|
||||||
"identifier", G_TYPE_UINT, identifier,
|
"identifier", G_TYPE_UINT, identifier,
|
||||||
"pointer_x", G_TYPE_DOUBLE, x,
|
"pointer_x", G_TYPE_DOUBLE, x,
|
||||||
"pointer_y", G_TYPE_DOUBLE, y,
|
"pointer_y", G_TYPE_DOUBLE, y,
|
||||||
"pressure", G_TYPE_DOUBLE, pressure, NULL));
|
"pressure", G_TYPE_DOUBLE, pressure,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1000,6 +1029,8 @@ gst_navigation_event_new_touch_motion (guint identifier, gdouble x, gdouble y,
|
||||||
* after sending this event.
|
* after sending this event.
|
||||||
* @x: The x coordinate of the touch point.
|
* @x: The x coordinate of the touch point.
|
||||||
* @y: The y coordinate of the touch point.
|
* @y: The y coordinate of the touch point.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event for a removed touch point.
|
* Create a new navigation event for a removed touch point.
|
||||||
*
|
*
|
||||||
|
@ -1008,16 +1039,20 @@ gst_navigation_event_new_touch_motion (guint identifier, gdouble x, gdouble y,
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_touch_up (guint identifier, gdouble x, gdouble y)
|
gst_navigation_event_new_touch_up (guint identifier, gdouble x, gdouble y,
|
||||||
|
GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "touch-up",
|
"event", G_TYPE_STRING, "touch-up",
|
||||||
"identifier", G_TYPE_UINT, identifier,
|
"identifier", G_TYPE_UINT, identifier,
|
||||||
"pointer_x", G_TYPE_DOUBLE, x, "pointer_y", G_TYPE_DOUBLE, y, NULL));
|
"pointer_x", G_TYPE_DOUBLE, x, "pointer_y", G_TYPE_DOUBLE, y,
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_navigation_event_new_touch_frame:
|
* gst_navigation_event_new_touch_frame:
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event signalling the end of a touch frame. Touch
|
* Create a new navigation event signalling the end of a touch frame. Touch
|
||||||
* frames signal that all previous down, motion and up events not followed by
|
* frames signal that all previous down, motion and up events not followed by
|
||||||
|
@ -1028,15 +1063,18 @@ gst_navigation_event_new_touch_up (guint identifier, gdouble x, gdouble y)
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_touch_frame (void)
|
gst_navigation_event_new_touch_frame (GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "touch-frame", NULL));
|
"event", G_TYPE_STRING, "touch-frame",
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_navigation_event_new_touch_cancel:
|
* gst_navigation_event_new_touch_cancel:
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
*
|
*
|
||||||
* Create a new navigation event signalling that all currently active touch
|
* Create a new navigation event signalling that all currently active touch
|
||||||
* points are cancelled and should be discarded. For example, under Wayland
|
* points are cancelled and should be discarded. For example, under Wayland
|
||||||
|
@ -1048,10 +1086,11 @@ gst_navigation_event_new_touch_frame (void)
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
GstEvent *
|
GstEvent *
|
||||||
gst_navigation_event_new_touch_cancel (void)
|
gst_navigation_event_new_touch_cancel (GstNavigationModifierType state)
|
||||||
{
|
{
|
||||||
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
|
||||||
"event", G_TYPE_STRING, "touch-cancel", NULL));
|
"event", G_TYPE_STRING, "touch-cancel",
|
||||||
|
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1060,6 +1099,11 @@ gst_navigation_event_new_touch_cancel (void)
|
||||||
* @key: (out) (optional) (transfer none): A pointer to a location to receive
|
* @key: (out) (optional) (transfer none): A pointer to a location to receive
|
||||||
* the string identifying the key press. The returned string is owned by the
|
* the string identifying the key press. The returned string is owned by the
|
||||||
* event, and valid only until the event is unreffed.
|
* event, and valid only until the event is unreffed.
|
||||||
|
*
|
||||||
|
* Note: Modifier keys (as defined in #GstNavigationModifierType)
|
||||||
|
* [press](GST_NAVIGATION_EVENT_KEY_PRESS) and
|
||||||
|
* [release](GST_NAVIGATION_KEY_PRESS) events are generated even if those states are
|
||||||
|
* present on all other related events
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_navigation_event_parse_key_event (GstEvent * event, const gchar ** key)
|
gst_navigation_event_parse_key_event (GstEvent * event, const gchar ** key)
|
||||||
|
@ -1396,3 +1440,37 @@ gst_navigation_event_set_coordinates (GstEvent * event, gdouble x, gdouble y)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_navigation_event_parse_state:
|
||||||
|
* @event: The #GstEvent to modify.
|
||||||
|
* @state: a bit-mask representing the state of the modifier keys (e.g. Control,
|
||||||
|
* Shift and Alt).
|
||||||
|
*
|
||||||
|
* Returns: TRUE if the event is a #GstNavigation event with associated
|
||||||
|
* modifiers state, otherwise FALSE.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_navigation_event_parse_state (GstEvent * event,
|
||||||
|
GstNavigationModifierType * state)
|
||||||
|
{
|
||||||
|
GstNavigationEventType e_type;
|
||||||
|
const GstStructure *s;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
|
||||||
|
|
||||||
|
e_type = gst_navigation_event_get_type (event);
|
||||||
|
if (e_type == GST_NAVIGATION_EVENT_COMMAND) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = gst_event_get_structure (event);
|
||||||
|
if (!gst_structure_get (s, "state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state,
|
||||||
|
NULL))
|
||||||
|
*state = GST_NAVIGATION_MODIFIER_NONE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,65 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstNavigation GstNavigation;
|
typedef struct _GstNavigation GstNavigation;
|
||||||
typedef struct _GstNavigationInterface GstNavigationInterface;
|
typedef struct _GstNavigationInterface GstNavigationInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstNavigationModifierType:
|
||||||
|
* @GST_NAVIGATION_MODIFIER_SHIFT_MASK: the Shift key.
|
||||||
|
* @GST_NAVIGATION_MODIFIER_CONTROL_MASK: the Control key.
|
||||||
|
* @GST_NAVIGATION_MODIFIER_ALT_MASK: the fourth modifier key
|
||||||
|
* @GST_NAVIGATION_MODIFIER_BUTTON1_MASK: the first mouse button (usually the left button).
|
||||||
|
* @GST_NAVIGATION_MODIFIER_BUTTON2_MASK: the second mouse button (usually the right button).
|
||||||
|
* @GST_NAVIGATION_MODIFIER_BUTTON3_MASK: the third mouse button (usually the mouse wheel button or middle button).
|
||||||
|
* @GST_NAVIGATION_MODIFIER_BUTTON4_MASK: the fourth mouse button (typically the "Back" button).
|
||||||
|
* @GST_NAVIGATION_MODIFIER_BUTTON5_MASK: the fifth mouse button (typically the "forward" button).
|
||||||
|
* @GST_NAVIGATION_MODIFIER_SUPER_MASK: the Super modifier
|
||||||
|
* @GST_NAVIGATION_MODIFIER_HYPER_MASK: the Hyper modifier
|
||||||
|
* @GST_NAVIGATION_MODIFIER_META_MASK: the Meta modifier
|
||||||
|
* @GST_NAVIGATION_MODIFIER_MASK: A mask covering all entries in #GdkModifierType.
|
||||||
|
*
|
||||||
|
* Flags to indicate the state of modifier keys and mouse buttons
|
||||||
|
* in events.
|
||||||
|
*
|
||||||
|
* Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose,
|
||||||
|
* Apple, CapsLock or ShiftLock.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE = 0,
|
||||||
|
GST_NAVIGATION_MODIFIER_SHIFT_MASK = 1 << 0,
|
||||||
|
GST_NAVIGATION_MODIFIER_LOCK_MASK = 1 << 1,
|
||||||
|
GST_NAVIGATION_MODIFIER_CONTROL_MASK = 1 << 2,
|
||||||
|
GST_NAVIGATION_MODIFIER_ALT_MASK = 1 << 3,
|
||||||
|
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON1_MASK = 1 << 8,
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON2_MASK = 1 << 9,
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON3_MASK = 1 << 10,
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON4_MASK = 1 << 11,
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON5_MASK = 1 << 12,
|
||||||
|
|
||||||
|
GST_NAVIGATION_MODIFIER_SUPER_MASK = 1 << 26,
|
||||||
|
GST_NAVIGATION_MODIFIER_HYPER_MASK = 1 << 27,
|
||||||
|
GST_NAVIGATION_MODIFIER_META_MASK = 1 << 28,
|
||||||
|
|
||||||
|
GST_NAVIGATION_MODIFIER_MASK = (
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE |
|
||||||
|
GST_NAVIGATION_MODIFIER_SHIFT_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_LOCK_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_CONTROL_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_ALT_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON1_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON2_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON3_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON4_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_BUTTON5_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_SUPER_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_HYPER_MASK |
|
||||||
|
GST_NAVIGATION_MODIFIER_META_MASK
|
||||||
|
)
|
||||||
|
|
||||||
|
} GstNavigationModifierType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstNavigationInterface:
|
* GstNavigationInterface:
|
||||||
* @iface: the parent interface
|
* @iface: the parent interface
|
||||||
|
@ -381,25 +440,32 @@ GST_VIDEO_API
|
||||||
GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
|
GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_key_press (const gchar * key) G_GNUC_MALLOC;
|
GstEvent* gst_navigation_event_new_key_press (const gchar * key,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_key_release (const gchar * key) G_GNUC_MALLOC;
|
GstEvent* gst_navigation_event_new_key_release (const gchar * key,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_mouse_button_press (gint button, gdouble x,
|
GstEvent* gst_navigation_event_new_mouse_button_press (gint button, gdouble x,
|
||||||
gdouble y) G_GNUC_MALLOC;
|
gdouble y,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_mouse_button_release (gint button, gdouble x,
|
GstEvent* gst_navigation_event_new_mouse_button_release (gint button, gdouble x,
|
||||||
gdouble y) G_GNUC_MALLOC;
|
gdouble y,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_mouse_move (gdouble x, gdouble y) G_GNUC_MALLOC;
|
GstEvent* gst_navigation_event_new_mouse_move (gdouble x,
|
||||||
|
gdouble y,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_mouse_scroll (gdouble x, gdouble y,
|
GstEvent* gst_navigation_event_new_mouse_scroll (gdouble x, gdouble y,
|
||||||
gdouble delta_x, gdouble delta_y) G_GNUC_MALLOC;
|
gdouble delta_x, gdouble delta_y,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_command (GstNavigationCommand command) G_GNUC_MALLOC;
|
GstEvent* gst_navigation_event_new_command (GstNavigationCommand command) G_GNUC_MALLOC;
|
||||||
|
@ -407,22 +473,25 @@ GstEvent* gst_navigation_event_new_command (GstNavigationComm
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_touch_down (guint identifier,
|
GstEvent* gst_navigation_event_new_touch_down (guint identifier,
|
||||||
gdouble x, gdouble y,
|
gdouble x, gdouble y,
|
||||||
gdouble pressure) G_GNUC_MALLOC;
|
gdouble pressure,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_touch_motion (guint identifier,
|
GstEvent* gst_navigation_event_new_touch_motion (guint identifier,
|
||||||
gdouble x, gdouble y,
|
gdouble x, gdouble y,
|
||||||
gdouble pressure) G_GNUC_MALLOC;
|
gdouble pressure,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_touch_up (guint identifier,
|
GstEvent* gst_navigation_event_new_touch_up (guint identifier,
|
||||||
gdouble x, gdouble y) G_GNUC_MALLOC;
|
gdouble x, gdouble y,
|
||||||
|
GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_touch_frame (void) G_GNUC_MALLOC;
|
GstEvent* gst_navigation_event_new_touch_frame (GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
GstEvent* gst_navigation_event_new_touch_cancel (void) G_GNUC_MALLOC;
|
GstEvent* gst_navigation_event_new_touch_cancel (GstNavigationModifierType state) G_GNUC_MALLOC;
|
||||||
|
|
||||||
GST_VIDEO_API
|
GST_VIDEO_API
|
||||||
gboolean gst_navigation_event_parse_key_event (GstEvent *event,
|
gboolean gst_navigation_event_parse_key_event (GstEvent *event,
|
||||||
|
@ -490,6 +559,10 @@ GST_VIDEO_API
|
||||||
void gst_navigation_send_event_simple (GstNavigation *navigation,
|
void gst_navigation_send_event_simple (GstNavigation *navigation,
|
||||||
GstEvent *event);
|
GstEvent *event);
|
||||||
|
|
||||||
|
GST_VIDEO_API
|
||||||
|
gboolean gst_navigation_event_parse_state (GstEvent *event,
|
||||||
|
GstNavigationModifierType *state);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_NAVIGATION_H__ */
|
#endif /* __GST_NAVIGATION_H__ */
|
||||||
|
|
|
@ -551,7 +551,7 @@ gst_x_image_sink_xwindow_new (GstXImageSink * ximagesink, gint width,
|
||||||
ximagesink->xcontext->root,
|
ximagesink->xcontext->root,
|
||||||
0, 0, width, height, 0, 0, ximagesink->xcontext->black);
|
0, 0, width, height, 0, 0, ximagesink->xcontext->black);
|
||||||
|
|
||||||
/* We have to do that to prevent X from redrawing the background on
|
/* We have to do that to prevent X from redrawing the background on
|
||||||
ConfigureNotify. This takes away flickering of video when resizing. */
|
ConfigureNotify. This takes away flickering of video when resizing. */
|
||||||
XSetWindowBackgroundPixmap (ximagesink->xcontext->disp, xwindow->win, None);
|
XSetWindowBackgroundPixmap (ximagesink->xcontext->disp, xwindow->win, None);
|
||||||
|
|
||||||
|
@ -693,6 +693,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
gint pointer_x = 0, pointer_y = 0;
|
gint pointer_x = 0, pointer_y = 0;
|
||||||
gboolean pointer_moved = FALSE, touch_frame_open = FALSE;
|
gboolean pointer_moved = FALSE, touch_frame_open = FALSE;
|
||||||
gboolean exposed = FALSE, configured = FALSE;
|
gboolean exposed = FALSE, configured = FALSE;
|
||||||
|
GstNavigationModifierType state = GST_NAVIGATION_MODIFIER_NONE;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
g_return_if_fail (GST_IS_X_IMAGE_SINK (ximagesink));
|
||||||
|
|
||||||
|
@ -725,7 +726,8 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
|
GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
|
||||||
pointer_x, pointer_y);
|
pointer_x, pointer_y);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
||||||
gst_navigation_event_new_mouse_move (pointer_x, pointer_y));
|
gst_navigation_event_new_mouse_move (pointer_x, pointer_y,
|
||||||
|
e.xmotion.state));
|
||||||
|
|
||||||
g_mutex_lock (&ximagesink->flow_lock);
|
g_mutex_lock (&ximagesink->flow_lock);
|
||||||
g_mutex_lock (&ximagesink->x_lock);
|
g_mutex_lock (&ximagesink->x_lock);
|
||||||
|
@ -751,14 +753,14 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
||||||
gst_navigation_event_new_mouse_button_press (e.xbutton.button,
|
gst_navigation_event_new_mouse_button_press (e.xbutton.button,
|
||||||
e.xbutton.x, e.xbutton.y));
|
e.xbutton.x, e.xbutton.y, e.xbutton.state));
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
GST_DEBUG ("ximagesink button %d release over window at %d,%d",
|
GST_DEBUG ("ximagesink button %d release over window at %d,%d",
|
||||||
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
||||||
gst_navigation_event_new_mouse_button_release (e.xbutton.button,
|
gst_navigation_event_new_mouse_button_release (e.xbutton.button,
|
||||||
e.xbutton.x, e.xbutton.y));
|
e.xbutton.x, e.xbutton.y, e.xbutton.state));
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
|
@ -783,8 +785,8 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
||||||
(e.type == KeyPress) ?
|
(e.type == KeyPress) ?
|
||||||
gst_navigation_event_new_key_press (key_str) :
|
gst_navigation_event_new_key_press (key_str, e.xkey.state) :
|
||||||
gst_navigation_event_new_key_release (key_str));
|
gst_navigation_event_new_key_release (key_str, e.xkey.state));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",
|
GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",
|
||||||
|
@ -906,6 +908,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
g_mutex_unlock (&ximagesink->x_lock);
|
g_mutex_unlock (&ximagesink->x_lock);
|
||||||
g_mutex_unlock (&ximagesink->flow_lock);
|
g_mutex_unlock (&ximagesink->flow_lock);
|
||||||
|
|
||||||
|
state = touch->mods.effective;
|
||||||
/* assume the event queue is ordered chronologically, and end */
|
/* assume the event queue is ordered chronologically, and end */
|
||||||
/* the previous touch event frame when the timestamp increases */
|
/* the previous touch event frame when the timestamp increases */
|
||||||
if (touch->time != ximagesink->last_touch && touch_frame_open) {
|
if (touch->time != ximagesink->last_touch && touch_frame_open) {
|
||||||
|
@ -916,7 +919,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
GST_DEBUG ("ximagesink ending touch frame for %lu",
|
GST_DEBUG ("ximagesink ending touch frame for %lu",
|
||||||
ximagesink->last_touch);
|
ximagesink->last_touch);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
||||||
gst_navigation_event_new_touch_frame ());
|
gst_navigation_event_new_touch_frame (state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -926,7 +929,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y);
|
||||||
nav = gst_navigation_event_new_touch_down (ev_id, touch->event_x,
|
nav = gst_navigation_event_new_touch_down (ev_id, touch->event_x,
|
||||||
touch->event_y, pressure);
|
touch->event_y, pressure, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XI_TouchEnd:{
|
case XI_TouchEnd:{
|
||||||
|
@ -934,7 +937,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y);
|
||||||
nav = gst_navigation_event_new_touch_up (ev_id, touch->event_x,
|
nav = gst_navigation_event_new_touch_up (ev_id, touch->event_x,
|
||||||
touch->event_y);
|
touch->event_y, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XI_TouchUpdate:{
|
case XI_TouchUpdate:{
|
||||||
|
@ -942,7 +945,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
"to %.0f,%.0f", touch->detail, touch->deviceid,
|
"to %.0f,%.0f", touch->detail, touch->deviceid,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y);
|
||||||
nav = gst_navigation_event_new_touch_motion (ev_id,
|
nav = gst_navigation_event_new_touch_motion (ev_id,
|
||||||
touch->event_x, touch->event_y, pressure);
|
touch->event_x, touch->event_y, pressure, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -972,7 +975,7 @@ gst_x_image_sink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
if (touch_frame_open) {
|
if (touch_frame_open) {
|
||||||
GST_DEBUG ("ximagesink ending touch frame for %lu", ximagesink->last_touch);
|
GST_DEBUG ("ximagesink ending touch frame for %lu", ximagesink->last_touch);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (ximagesink),
|
||||||
gst_navigation_event_new_touch_frame ());
|
gst_navigation_event_new_touch_frame (state));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1276,7 +1279,7 @@ gst_x_image_sink_xcontext_clear (GstXImageSink * ximagesink)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take the xcontext reference and NULL it while we
|
/* Take the xcontext reference and NULL it while we
|
||||||
* clean it up, so that any buffer-alloced buffers
|
* clean it up, so that any buffer-alloced buffers
|
||||||
* arriving after this will be freed correctly */
|
* arriving after this will be freed correctly */
|
||||||
xcontext = ximagesink->xcontext;
|
xcontext = ximagesink->xcontext;
|
||||||
ximagesink->xcontext = NULL;
|
ximagesink->xcontext = NULL;
|
||||||
|
|
|
@ -423,6 +423,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
{
|
{
|
||||||
XEvent e;
|
XEvent e;
|
||||||
gint pointer_x = 0, pointer_y = 0;
|
gint pointer_x = 0, pointer_y = 0;
|
||||||
|
GstNavigationModifierType state = GST_NAVIGATION_MODIFIER_NONE;
|
||||||
gboolean pointer_moved = FALSE, touch_frame_open = FALSE;
|
gboolean pointer_moved = FALSE, touch_frame_open = FALSE;
|
||||||
gboolean exposed = FALSE, configured = FALSE;
|
gboolean exposed = FALSE, configured = FALSE;
|
||||||
|
|
||||||
|
@ -459,7 +460,8 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
GST_DEBUG ("xvimagesink pointer moved over window at %d,%d",
|
GST_DEBUG ("xvimagesink pointer moved over window at %d,%d",
|
||||||
pointer_x, pointer_y);
|
pointer_x, pointer_y);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
||||||
gst_navigation_event_new_mouse_move (e.xbutton.x, e.xbutton.y));
|
gst_navigation_event_new_mouse_move (e.xbutton.x, e.xbutton.y,
|
||||||
|
e.xbutton.state));
|
||||||
|
|
||||||
g_mutex_lock (&xvimagesink->flow_lock);
|
g_mutex_lock (&xvimagesink->flow_lock);
|
||||||
g_mutex_lock (&xvimagesink->context->lock);
|
g_mutex_lock (&xvimagesink->context->lock);
|
||||||
|
@ -485,7 +487,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
||||||
gst_navigation_event_new_mouse_button_press (e.xbutton.button,
|
gst_navigation_event_new_mouse_button_press (e.xbutton.button,
|
||||||
e.xbutton.x, e.xbutton.y));
|
e.xbutton.x, e.xbutton.y, e.xbutton.state));
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
/* Mouse button released over our window. We send upstream
|
/* Mouse button released over our window. We send upstream
|
||||||
|
@ -494,7 +496,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
e.xbutton.button, e.xbutton.x, e.xbutton.y);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
||||||
gst_navigation_event_new_mouse_button_release (e.xbutton.button,
|
gst_navigation_event_new_mouse_button_release (e.xbutton.button,
|
||||||
e.xbutton.x, e.xbutton.y));
|
e.xbutton.x, e.xbutton.y, e.xbutton.state));
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
|
@ -519,8 +521,8 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
||||||
(e.type == KeyPress) ?
|
(e.type == KeyPress) ?
|
||||||
gst_navigation_event_new_key_press (key_str) :
|
gst_navigation_event_new_key_press (key_str, e.xkey.state) :
|
||||||
gst_navigation_event_new_key_release (key_str));
|
gst_navigation_event_new_key_release (key_str, e.xkey.state));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "xvimagesink unhandled X event (%d)",
|
GST_DEBUG_OBJECT (xvimagesink, "xvimagesink unhandled X event (%d)",
|
||||||
|
@ -647,6 +649,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
g_mutex_unlock (&xvimagesink->context->lock);
|
g_mutex_unlock (&xvimagesink->context->lock);
|
||||||
g_mutex_unlock (&xvimagesink->flow_lock);
|
g_mutex_unlock (&xvimagesink->flow_lock);
|
||||||
|
|
||||||
|
state = touch->mods.effective;
|
||||||
/* assume the event queue is ordered chronologically, and end */
|
/* assume the event queue is ordered chronologically, and end */
|
||||||
/* the previous touch event frame when the timestamp increases */
|
/* the previous touch event frame when the timestamp increases */
|
||||||
if (touch->time != xwindow->last_touch && touch_frame_open) {
|
if (touch->time != xwindow->last_touch && touch_frame_open) {
|
||||||
|
@ -657,7 +660,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
GST_DEBUG ("ximagesink ending touch frame for %lu",
|
GST_DEBUG ("ximagesink ending touch frame for %lu",
|
||||||
xwindow->last_touch);
|
xwindow->last_touch);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
||||||
gst_navigation_event_new_touch_frame ());
|
gst_navigation_event_new_touch_frame (state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +670,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y);
|
||||||
nav = gst_navigation_event_new_touch_down (ev_id,
|
nav = gst_navigation_event_new_touch_down (ev_id,
|
||||||
touch->event_x, touch->event_y, pressure);
|
touch->event_x, touch->event_y, pressure, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XI_TouchEnd:{
|
case XI_TouchEnd:{
|
||||||
|
@ -675,7 +678,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
"at %.0f,%.0f", touch->detail, touch->deviceid,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y);
|
||||||
nav = gst_navigation_event_new_touch_up (ev_id,
|
nav = gst_navigation_event_new_touch_up (ev_id,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XI_TouchUpdate:{
|
case XI_TouchUpdate:{
|
||||||
|
@ -683,7 +686,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
"to %.0f,%.0f", touch->detail, touch->deviceid,
|
"to %.0f,%.0f", touch->detail, touch->deviceid,
|
||||||
touch->event_x, touch->event_y);
|
touch->event_x, touch->event_y);
|
||||||
nav = gst_navigation_event_new_touch_motion (ev_id,
|
nav = gst_navigation_event_new_touch_motion (ev_id,
|
||||||
touch->event_x, touch->event_y, pressure);
|
touch->event_x, touch->event_y, pressure, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -714,7 +717,7 @@ gst_xv_image_sink_handle_xevents (GstXvImageSink * xvimagesink)
|
||||||
GST_DEBUG ("xvimagesink ending touch frame for %lu",
|
GST_DEBUG ("xvimagesink ending touch frame for %lu",
|
||||||
xvimagesink->xwindow->last_touch);
|
xvimagesink->xwindow->last_touch);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
gst_navigation_send_event_simple (GST_NAVIGATION (xvimagesink),
|
||||||
gst_navigation_event_new_touch_frame ());
|
gst_navigation_event_new_touch_frame (state));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,14 +170,14 @@ GST_START_TEST (test_events)
|
||||||
gst_navigation_send_key_event (GST_NAVIGATION (test_element), "key-press",
|
gst_navigation_send_key_event (GST_NAVIGATION (test_element), "key-press",
|
||||||
"1");
|
"1");
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
||||||
gst_navigation_event_new_key_press ("1"));
|
gst_navigation_event_new_key_press ("1", GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
test_element->sent_type = GST_NAVIGATION_EVENT_KEY_RELEASE;
|
test_element->sent_type = GST_NAVIGATION_EVENT_KEY_RELEASE;
|
||||||
test_element->sent_key = "2";
|
test_element->sent_key = "2";
|
||||||
gst_navigation_send_key_event (GST_NAVIGATION (test_element), "key-release",
|
gst_navigation_send_key_event (GST_NAVIGATION (test_element), "key-release",
|
||||||
"2");
|
"2");
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
||||||
gst_navigation_event_new_key_release ("2"));
|
gst_navigation_event_new_key_release ("2", GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_MOVE;
|
test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_MOVE;
|
||||||
test_element->sent_x = 50;
|
test_element->sent_x = 50;
|
||||||
|
@ -185,7 +185,8 @@ GST_START_TEST (test_events)
|
||||||
gst_navigation_send_mouse_event (GST_NAVIGATION (test_element), "mouse-move",
|
gst_navigation_send_mouse_event (GST_NAVIGATION (test_element), "mouse-move",
|
||||||
0, 50, 100);
|
0, 50, 100);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
||||||
gst_navigation_event_new_mouse_move (50, 100));
|
gst_navigation_event_new_mouse_move (50, 100,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_SCROLL;
|
test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_SCROLL;
|
||||||
test_element->sent_x = 60;
|
test_element->sent_x = 60;
|
||||||
|
@ -195,7 +196,8 @@ GST_START_TEST (test_events)
|
||||||
gst_navigation_send_mouse_scroll_event (GST_NAVIGATION (test_element),
|
gst_navigation_send_mouse_scroll_event (GST_NAVIGATION (test_element),
|
||||||
60, 120, 2, 3);
|
60, 120, 2, 3);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
||||||
gst_navigation_event_new_mouse_scroll (60, 120, 2, 3));
|
gst_navigation_event_new_mouse_scroll (60, 120, 2, 3,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS;
|
test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS;
|
||||||
test_element->sent_x = 10;
|
test_element->sent_x = 10;
|
||||||
|
@ -204,7 +206,8 @@ GST_START_TEST (test_events)
|
||||||
gst_navigation_send_mouse_event (GST_NAVIGATION (test_element),
|
gst_navigation_send_mouse_event (GST_NAVIGATION (test_element),
|
||||||
"mouse-button-press", 1, 10, 20);
|
"mouse-button-press", 1, 10, 20);
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (test_element),
|
||||||
gst_navigation_event_new_mouse_button_press (1, 10, 20));
|
gst_navigation_event_new_mouse_button_press (1, 10, 20,
|
||||||
|
GST_NAVIGATION_MODIFIER_NONE));
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (cmds); i++) {
|
for (i = 0; i < G_N_ELEMENTS (cmds); i++) {
|
||||||
test_element->sent_type = GST_NAVIGATION_EVENT_COMMAND;
|
test_element->sent_type = GST_NAVIGATION_EVENT_COMMAND;
|
||||||
|
|
|
@ -2274,7 +2274,7 @@ button_press_cb (GtkWidget * widget, GdkEventButton * event, PlaybackApp * app)
|
||||||
if (app->navigation_element)
|
if (app->navigation_element)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
||||||
gst_navigation_event_new_mouse_button_press (event->button, event->x,
|
gst_navigation_event_new_mouse_button_press (event->button, event->x,
|
||||||
event->y));
|
event->y, event->state));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2286,7 +2286,7 @@ button_release_cb (GtkWidget * widget, GdkEventButton * event,
|
||||||
if (app->navigation_element)
|
if (app->navigation_element)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
||||||
gst_navigation_event_new_mouse_button_release (event->button, event->x,
|
gst_navigation_event_new_mouse_button_release (event->button, event->x,
|
||||||
event->y));
|
event->y, event->state));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2296,7 +2296,8 @@ key_press_cb (GtkWidget * widget, GdkEventKey * event, PlaybackApp * app)
|
||||||
{
|
{
|
||||||
if (app->navigation_element)
|
if (app->navigation_element)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
||||||
gst_navigation_event_new_key_press (gdk_keyval_name (event->keyval)));
|
gst_navigation_event_new_key_press (gdk_keyval_name (event->keyval),
|
||||||
|
event->state));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2306,7 +2307,8 @@ key_release_cb (GtkWidget * widget, GdkEventKey * event, PlaybackApp * app)
|
||||||
{
|
{
|
||||||
if (app->navigation_element)
|
if (app->navigation_element)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
||||||
gst_navigation_event_new_key_release (gdk_keyval_name (event->keyval)));
|
gst_navigation_event_new_key_release (gdk_keyval_name (event->keyval),
|
||||||
|
event->state));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2316,7 +2318,7 @@ motion_notify_cb (GtkWidget * widget, GdkEventMotion * event, PlaybackApp * app)
|
||||||
{
|
{
|
||||||
if (app->navigation_element)
|
if (app->navigation_element)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (app->navigation_element),
|
||||||
gst_navigation_event_new_mouse_move (event->x, event->y));
|
gst_navigation_event_new_mouse_move (event->x, event->y, event->state));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,8 +297,8 @@ gtk_gst_base_widget_key_event (GtkWidget * widget, GdkEventKey * event)
|
||||||
|
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
(event->type == GDK_KEY_PRESS) ?
|
(event->type == GDK_KEY_PRESS) ?
|
||||||
gst_navigation_event_new_key_press (str) :
|
gst_navigation_event_new_key_press (str, event->state) :
|
||||||
gst_navigation_event_new_key_release (str));
|
gst_navigation_event_new_key_release (str, event->state));
|
||||||
}
|
}
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
|
@ -383,9 +383,9 @@ gtk_gst_base_widget_button_event (GtkWidget * widget, GdkEventButton * event)
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
(event->type == GDK_BUTTON_PRESS) ?
|
(event->type == GDK_BUTTON_PRESS) ?
|
||||||
gst_navigation_event_new_mouse_button_press (event->button,
|
gst_navigation_event_new_mouse_button_press (event->button,
|
||||||
event->x, event->y) :
|
event->x, event->y, event->state) :
|
||||||
gst_navigation_event_new_mouse_button_release (event->button,
|
gst_navigation_event_new_mouse_button_release (event->button,
|
||||||
event->x, event->y));
|
event->x, event->y, event->state));
|
||||||
}
|
}
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,8 @@ gtk_gst_base_widget_motion_event (GtkWidget * widget, GdkEventMotion * event)
|
||||||
if ((element = g_weak_ref_get (&base_widget->element))) {
|
if ((element = g_weak_ref_get (&base_widget->element))) {
|
||||||
if (GST_IS_NAVIGATION (element)) {
|
if (GST_IS_NAVIGATION (element)) {
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
gst_navigation_event_new_mouse_move (event->x, event->y));
|
gst_navigation_event_new_mouse_move (event->x, event->y,
|
||||||
|
event->state));
|
||||||
}
|
}
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
|
@ -447,7 +448,8 @@ gtk_gst_base_widget_scroll_event (GtkWidget * widget, GdkEventScroll * event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
gst_navigation_event_new_mouse_scroll (x, y, delta_x, delta_y));
|
gst_navigation_event_new_mouse_scroll (x, y, delta_x, delta_y,
|
||||||
|
event->state));
|
||||||
}
|
}
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
|
@ -480,14 +482,17 @@ gtk_gst_base_widget_touch_event (GtkWidget * widget, GdkEventTouch * event)
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case GDK_TOUCH_BEGIN:
|
case GDK_TOUCH_BEGIN:
|
||||||
nav_event = gst_navigation_event_new_touch_down (id, x, y, p);
|
nav_event =
|
||||||
|
gst_navigation_event_new_touch_down (id, x, y, p, event->state);
|
||||||
break;
|
break;
|
||||||
case GDK_TOUCH_UPDATE:
|
case GDK_TOUCH_UPDATE:
|
||||||
nav_event = gst_navigation_event_new_touch_motion (id, x, y, p);
|
nav_event =
|
||||||
|
gst_navigation_event_new_touch_motion (id, x, y, p, event->state);
|
||||||
break;
|
break;
|
||||||
case GDK_TOUCH_END:
|
case GDK_TOUCH_END:
|
||||||
case GDK_TOUCH_CANCEL:
|
case GDK_TOUCH_CANCEL:
|
||||||
nav_event = gst_navigation_event_new_touch_up (id, x, y);
|
nav_event =
|
||||||
|
gst_navigation_event_new_touch_up (id, x, y, event->state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nav_event = NULL;
|
nav_event = NULL;
|
||||||
|
|
|
@ -430,6 +430,27 @@ QtGLVideoItem::mapPointToStreamSize(QPointF pos)
|
||||||
return QPointF(stream_x, stream_y);
|
return QPointF(stream_x, stream_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstNavigationModifierType
|
||||||
|
translateModifiers(Qt::KeyboardModifiers modifiers)
|
||||||
|
{
|
||||||
|
return (GstNavigationModifierType)(
|
||||||
|
((modifiers & Qt::KeyboardModifier::ShiftModifier) ? GST_NAVIGATION_MODIFIER_SHIFT_MASK : 0) |
|
||||||
|
((modifiers & Qt::KeyboardModifier::ControlModifier) ? GST_NAVIGATION_MODIFIER_CONTROL_MASK : 0) |
|
||||||
|
((modifiers & Qt::KeyboardModifier::AltModifier) ? GST_NAVIGATION_MODIFIER_ALT_MASK : 0) |
|
||||||
|
((modifiers & Qt::KeyboardModifier::MetaModifier) ? GST_NAVIGATION_MODIFIER_META_MASK : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstNavigationModifierType
|
||||||
|
translateMouseButtons(Qt::MouseButtons buttons)
|
||||||
|
{
|
||||||
|
return (GstNavigationModifierType)(
|
||||||
|
((buttons & Qt::LeftButton) ? GST_NAVIGATION_MODIFIER_BUTTON1_MASK : 0) |
|
||||||
|
((buttons & Qt::RightButton) ? GST_NAVIGATION_MODIFIER_BUTTON2_MASK : 0) |
|
||||||
|
((buttons & Qt::MiddleButton) ? GST_NAVIGATION_MODIFIER_BUTTON3_MASK : 0) |
|
||||||
|
((buttons & Qt::BackButton) ? GST_NAVIGATION_MODIFIER_BUTTON4_MASK : 0) |
|
||||||
|
((buttons & Qt::ForwardButton) ? GST_NAVIGATION_MODIFIER_BUTTON5_MASK : 0));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
QtGLVideoItem::wheelEvent(QWheelEvent * event)
|
QtGLVideoItem::wheelEvent(QWheelEvent * event)
|
||||||
{
|
{
|
||||||
|
@ -445,7 +466,9 @@ QtGLVideoItem::wheelEvent(QWheelEvent * event)
|
||||||
#endif
|
#endif
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
gst_navigation_event_new_mouse_scroll (position.x(), position.y(),
|
gst_navigation_event_new_mouse_scroll (position.x(), position.y(),
|
||||||
delta.x(), delta.y()));
|
delta.x(), delta.y(),
|
||||||
|
(GstNavigationModifierType) (
|
||||||
|
translateModifiers(event->modifiers()) | translateMouseButtons(event->buttons()))));
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
g_mutex_unlock (&this->priv->lock);
|
g_mutex_unlock (&this->priv->lock);
|
||||||
|
@ -483,7 +506,8 @@ QtGLVideoItem::hoverMoveEvent(QHoverEvent * event)
|
||||||
|
|
||||||
if (element != NULL) {
|
if (element != NULL) {
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
gst_navigation_event_new_mouse_move (pos.x(), pos.y()));
|
gst_navigation_event_new_mouse_move (pos.x(), pos.y(),
|
||||||
|
translateModifiers(event->modifiers())));
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,7 +531,7 @@ QtGLVideoItem::touchEvent(QTouchEvent * event)
|
||||||
|
|
||||||
if (event->type() == QEvent::TouchCancel) {
|
if (event->type() == QEvent::TouchCancel) {
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
gst_navigation_event_new_touch_cancel ());
|
gst_navigation_event_new_touch_cancel (translateModifiers(event->modifiers())));
|
||||||
} else {
|
} else {
|
||||||
const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
|
const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
|
||||||
gboolean sent_event = FALSE;
|
gboolean sent_event = FALSE;
|
||||||
|
@ -519,15 +543,15 @@ QtGLVideoItem::touchEvent(QTouchEvent * event)
|
||||||
switch (points[i].state()) {
|
switch (points[i].state()) {
|
||||||
case Qt::TouchPointPressed:
|
case Qt::TouchPointPressed:
|
||||||
nav_event = gst_navigation_event_new_touch_down ((guint) points[i].id(),
|
nav_event = gst_navigation_event_new_touch_down ((guint) points[i].id(),
|
||||||
pos.x(), pos.y(), (gdouble) points[i].pressure());
|
pos.x(), pos.y(), (gdouble) points[i].pressure(), translateModifiers(event->modifiers()));
|
||||||
break;
|
break;
|
||||||
case Qt::TouchPointMoved:
|
case Qt::TouchPointMoved:
|
||||||
nav_event = gst_navigation_event_new_touch_motion ((guint) points[i].id(),
|
nav_event = gst_navigation_event_new_touch_motion ((guint) points[i].id(),
|
||||||
pos.x(), pos.y(), (gdouble) points[i].pressure());
|
pos.x(), pos.y(), (gdouble) points[i].pressure(), translateModifiers(event->modifiers()));
|
||||||
break;
|
break;
|
||||||
case Qt::TouchPointReleased:
|
case Qt::TouchPointReleased:
|
||||||
nav_event = gst_navigation_event_new_touch_up ((guint) points[i].id(),
|
nav_event = gst_navigation_event_new_touch_up ((guint) points[i].id(),
|
||||||
pos.x(), pos.y());
|
pos.x(), pos.y(), translateModifiers(event->modifiers()));
|
||||||
break;
|
break;
|
||||||
/* Don't send an event if the point did not change */
|
/* Don't send an event if the point did not change */
|
||||||
default:
|
default:
|
||||||
|
@ -544,7 +568,7 @@ QtGLVideoItem::touchEvent(QTouchEvent * event)
|
||||||
/* Group simultaneos touch events with a frame event */
|
/* Group simultaneos touch events with a frame event */
|
||||||
if (sent_event) {
|
if (sent_event) {
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
gst_navigation_event_new_touch_frame ());
|
gst_navigation_event_new_touch_frame (translateModifiers(event->modifiers())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,9 +608,13 @@ QtGLVideoItem::sendMouseEvent(QMouseEvent * event, gboolean is_press)
|
||||||
if (element != NULL) {
|
if (element != NULL) {
|
||||||
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
gst_navigation_send_event_simple (GST_NAVIGATION (element),
|
||||||
(is_press) ? gst_navigation_event_new_mouse_button_press (button,
|
(is_press) ? gst_navigation_event_new_mouse_button_press (button,
|
||||||
pos.x(), pos.y()) :
|
pos.x(), pos.y(),
|
||||||
|
(GstNavigationModifierType) (
|
||||||
|
translateModifiers(event->modifiers()) | translateMouseButtons(event->buttons()))) :
|
||||||
gst_navigation_event_new_mouse_button_release (button, pos.x(),
|
gst_navigation_event_new_mouse_button_release (button, pos.x(),
|
||||||
pos.y()));
|
pos.y(),
|
||||||
|
(GstNavigationModifierType) (
|
||||||
|
translateModifiers(event->modifiers()) | translateMouseButtons(event->buttons()))));
|
||||||
g_object_unref (element);
|
g_object_unref (element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,15 +182,15 @@ vpp_test_mouse_events (VppTestContext * ctx,
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case 0:
|
case 0:
|
||||||
event = gst_navigation_event_new_mouse_move (params[i].send.x,
|
event = gst_navigation_event_new_mouse_move (params[i].send.x,
|
||||||
params[i].send.y);
|
params[i].send.y, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
event = gst_navigation_event_new_mouse_button_press (0,
|
event = gst_navigation_event_new_mouse_button_press (0,
|
||||||
params[i].send.x, params[i].send.y);
|
params[i].send.x, params[i].send.y, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
event = gst_navigation_event_new_mouse_button_release (0,
|
event = gst_navigation_event_new_mouse_button_release (0,
|
||||||
params[i].send.x, params[i].send.y);
|
params[i].send.x, params[i].send.y, GST_NAVIGATION_MODIFIER_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue