navigation: Define mouse double click event

Windows and UI toolkits define mouse double click events

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6491>
This commit is contained in:
Seungha Yang 2024-03-31 00:30:03 +09:00 committed by GStreamer Marge Bot
parent 4dfdaf67db
commit e1910d2be1
3 changed files with 111 additions and 4 deletions

View file

@ -991,6 +991,33 @@ Shift and Alt).</doc>
</parameter>
<parameter name="state" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">a bit-mask representing the state of the modifier keys (e.g. Control,
Shift and Alt).</doc>
<type name="NavigationModifierType" c:type="GstNavigationModifierType"/>
</parameter>
</parameters>
</function>
<function name="event_new_mouse_double_click" c:identifier="gst_navigation_event_new_mouse_double_click" version="1.26">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">Create a new navigation event for the given key mouse double click.</doc>
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">a new #GstEvent</doc>
<type name="Gst.Event" c:type="GstEvent*"/>
</return-value>
<parameters>
<parameter name="button" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The number of the pressed mouse button.</doc>
<type name="gint" c:type="gint"/>
</parameter>
<parameter name="x" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The x coordinate of the mouse cursor.</doc>
<type name="gdouble" c:type="gdouble"/>
</parameter>
<parameter name="y" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The y coordinate of the mouse cursor.</doc>
<type name="gdouble" c:type="gdouble"/>
</parameter>
<parameter name="state" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">a bit-mask representing the state of the modifier keys (e.g. Control,
Shift and Alt).</doc>
<type name="NavigationModifierType" c:type="GstNavigationModifierType"/>
</parameter>
@ -1876,7 +1903,7 @@ implementing the #GstNavigation interface.</doc>
</instance-parameter>
<parameter name="event" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The type of mouse event, as a text string. Recognised values are
"mouse-button-press", "mouse-button-release" and "mouse-move".</doc>
"mouse-button-press", "mouse-button-release", "mouse-move" and "mouse-double-click".</doc>
<type name="utf8" c:type="const char*"/>
</parameter>
<parameter name="button" transfer-ownership="none">
@ -2062,6 +2089,11 @@ from the event.</doc>
<member name="touch_cancel" value="12" c:identifier="GST_NAVIGATION_EVENT_TOUCH_CANCEL" version="1.22" glib:nick="touch-cancel">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.h">An event cancelling all currently active touch points.</doc>
</member>
<member name="mouse_double_click" value="13" c:identifier="GST_NAVIGATION_EVENT_MOUSE_DOUBLE_CLICK" version="1.26" glib:nick="mouse-double-click">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.h">A mouse button double click event.
Use gst_navigation_event_parse_mouse_button_event() to extract the details
from the event.</doc>
</member>
</enumeration>
<record name="NavigationInterface" c:type="GstNavigationInterface" glib:is-gtype-struct-for="Navigation">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.h">Navigation interface.</doc>
@ -16768,6 +16800,33 @@ Shift and Alt).</doc>
</parameter>
<parameter name="state" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">a bit-mask representing the state of the modifier keys (e.g. Control,
Shift and Alt).</doc>
<type name="NavigationModifierType" c:type="GstNavigationModifierType"/>
</parameter>
</parameters>
</function>
<function name="navigation_event_new_mouse_double_click" c:identifier="gst_navigation_event_new_mouse_double_click" moved-to="Navigation.event_new_mouse_double_click" version="1.26">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">Create a new navigation event for the given key mouse double click.</doc>
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">a new #GstEvent</doc>
<type name="Gst.Event" c:type="GstEvent*"/>
</return-value>
<parameters>
<parameter name="button" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The number of the pressed mouse button.</doc>
<type name="gint" c:type="gint"/>
</parameter>
<parameter name="x" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The x coordinate of the mouse cursor.</doc>
<type name="gdouble" c:type="gdouble"/>
</parameter>
<parameter name="y" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">The y coordinate of the mouse cursor.</doc>
<type name="gdouble" c:type="gdouble"/>
</parameter>
<parameter name="state" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/navigation.c">a bit-mask representing the state of the modifier keys (e.g. Control,
Shift and Alt).</doc>
<type name="NavigationModifierType" c:type="GstNavigationModifierType"/>
</parameter>

View file

@ -132,7 +132,7 @@ gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
* gst_navigation_send_mouse_event:
* @navigation: The navigation interface instance
* @event: The type of mouse event, as a text string. Recognised values are
* "mouse-button-press", "mouse-button-release" and "mouse-move".
* "mouse-button-press", "mouse-button-release", "mouse-move" and "mouse-double-click".
* @button: The button number of the button being pressed or released. Pass 0
* for mouse-move events.
* @x: The x coordinate of the mouse event.
@ -151,7 +151,8 @@ gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
g_return_if_fail (GST_IS_NAVIGATION (navigation));
g_return_if_fail (g_strcmp0 (event, "mouse-button-press") == 0 ||
g_strcmp0 (event, "mouse-button-release") == 0 ||
g_strcmp0 (event, "mouse-move") == 0);
g_strcmp0 (event, "mouse-move") == 0 ||
g_strcmp0 (event, "mouse-double-click") == 0);
gst_navigation_send_event (navigation,
gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
@ -807,6 +808,8 @@ gst_navigation_event_get_type (GstEvent * event)
return GST_NAVIGATION_EVENT_TOUCH_MOTION;
else if (g_str_equal (e_type, "touch-frame"))
return GST_NAVIGATION_EVENT_TOUCH_FRAME;
else if (g_str_equal (e_type, "mouse-double-click"))
return GST_NAVIGATION_EVENT_MOUSE_DOUBLE_CLICK;
return GST_NAVIGATION_EVENT_INVALID;
}
@ -878,6 +881,31 @@ gst_navigation_event_new_mouse_button_press (gint button, gdouble x, gdouble y,
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
}
/**
* gst_navigation_event_new_mouse_double_click:
* @button: The number of the pressed mouse button.
* @x: The x 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 double click.
*
* Returns: (transfer full): a new #GstEvent
*
* Since: 1.26
*/
GstEvent *
gst_navigation_event_new_mouse_double_click (gint button, gdouble x, gdouble y,
GstNavigationModifierType state)
{
return gst_event_new_navigation (gst_structure_new (GST_NAVIGATION_EVENT_NAME,
"event", G_TYPE_STRING, "mouse-double-click",
"button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
"pointer_y", G_TYPE_DOUBLE, y,
"state", GST_TYPE_NAVIGATION_MODIFIER_TYPE, state, NULL));
}
/**
* gst_navigation_event_new_mouse_button_release:
* @button: The number of the released mouse button.
@ -1163,7 +1191,8 @@ gst_navigation_event_parse_mouse_button_event (GstEvent * event, gint * button,
e_type = gst_navigation_event_get_type (event);
g_return_val_if_fail (e_type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS ||
e_type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE, FALSE);
e_type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE ||
e_type == GST_NAVIGATION_EVENT_MOUSE_DOUBLE_CLICK, FALSE);
s = gst_event_get_structure (event);
if (x)

View file

@ -371,6 +371,9 @@ gboolean gst_navigation_message_parse_event (GstMessage *message
* of simultaneous touch events. (Since: 1.22)
* @GST_NAVIGATION_EVENT_TOUCH_CANCEL: An event cancelling all currently active
* touch points. (Since: 1.22)
* @GST_NAVIGATION_EVENT_MOUSE_DOUBLE_CLICK: A mouse button double click event. Use
* gst_navigation_event_parse_mouse_button_event() to extract the details from the
* event. (Since: 1.26)
*
* Enum values for the various events that an element implementing the
* GstNavigation interface might send up the pipeline. Touch events have been
@ -447,6 +450,17 @@ typedef enum {
* Since: 1.22
*/
GST_NAVIGATION_EVENT_TOUCH_CANCEL = 12,
/**
* GST_NAVIGATION_EVENT_MOUSE_DOUBLE_CLICK:
*
* A mouse button double click event.
* Use gst_navigation_event_parse_mouse_button_event() to extract the details
* from the event.
*
* Since: 1.26
*/
GST_NAVIGATION_EVENT_MOUSE_DOUBLE_CLICK = 13,
} GstNavigationEventType;
GST_VIDEO_API
@ -465,6 +479,11 @@ GstEvent* gst_navigation_event_new_mouse_button_press (gint button, gdou
gdouble y,
GstNavigationModifierType state) G_GNUC_MALLOC;
GST_VIDEO_API
GstEvent* gst_navigation_event_new_mouse_double_click (gint button, gdouble x,
gdouble y,
GstNavigationModifierType state) G_GNUC_MALLOC;
GST_VIDEO_API
GstEvent* gst_navigation_event_new_mouse_button_release (gint button, gdouble x,
gdouble y,