[vlc-commits] [Git][videolan/vlc][master] 2 commits: vlc_mouse: add mouse drag helper function
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun May 18 09:48:32 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
f9b75b96 by Khalid Masum at 2025-05-18T09:27:39+00:00
vlc_mouse: add mouse drag helper function
- - - - -
9ed94cc9 by Khalid Masum at 2025-05-18T09:27:39+00:00
core/es_out: do not pause toggle 360 video if mouse is being dragged
Fixes: #28915
- - - - -
2 changed files:
- include/vlc_mouse.h
- src/input/es_out.c
Changes:
=====================================
include/vlc_mouse.h
=====================================
@@ -141,6 +141,12 @@ static inline bool vlc_mouse_HasMoved( const vlc_mouse_t *p_old,
{
return p_old->i_x != p_new->i_x || p_old->i_y != p_new->i_y;
}
+static inline bool vlc_mouse_HasDragged( const vlc_mouse_t *p_old,
+ const vlc_mouse_t *p_new )
+{
+ return vlc_mouse_IsLeftPressed( p_new ) &&
+ vlc_mouse_HasMoved( p_old, p_new );
+}
static inline bool vlc_mouse_HasButton( const vlc_mouse_t *p_old,
const vlc_mouse_t *p_new )
{
=====================================
src/input/es_out.c
=====================================
@@ -160,6 +160,7 @@ struct es_out_id_t
vlc_mouse_event mouse_event_cb;
void* mouse_event_userdata;
vlc_mouse_t oldmouse;
+ bool mouse_being_dragged;
};
typedef struct
@@ -343,13 +344,26 @@ static void MouseEventCb(const vlc_mouse_t *newmouse, void *userdata)
if(!newmouse || vlc_mouse_HasMouseFilter(newmouse))
{
vlc_mouse_Init(&id->oldmouse);
+ id->mouse_being_dragged = false;
return;
}
+ const es_format_t *fmt = id->fmt_out.i_cat != UNKNOWN_ES ? &id->fmt_out : &id->fmt;
+
+ if (fmt->video.projection_mode != PROJECTION_MODE_RECTANGULAR) {
+ if (vlc_mouse_HasDragged( &id->oldmouse, newmouse )) {
+ id->mouse_being_dragged = true;
+ }
+ };
+
if (vlc_mouse_HasReleased(&id->oldmouse, newmouse, MOUSE_BUTTON_LEFT)) {
- input_SendEvent(p_sys->p_input, &(struct vlc_input_event) {
- .type = INPUT_EVENT_MOUSE_LEFT
- });
+ if (!id->mouse_being_dragged) {
+ input_SendEvent(p_sys->p_input, &(struct vlc_input_event) {
+ .type = INPUT_EVENT_MOUSE_LEFT
+ });
+ }
+
+ id->mouse_being_dragged = false;
}
id->oldmouse = *newmouse;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fedb99dd83f6a88d4c43d46e3bce6070ed79a8ea...9ed94cc99a70a55ccf7a622ccb2e38541da4999a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fedb99dd83f6a88d4c43d46e3bce6070ed79a8ea...9ed94cc99a70a55ccf7a622ccb2e38541da4999a
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list