[vlc-commits] splitter: filter mouse events, not mouse states
Rémi Denis-Courmont
git at videolan.org
Sun Jan 13 14:55:07 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 13 15:35:26 2019 +0200| [9187532751ef5af228c05dc45d5f2b036157c823] | committer: Rémi Denis-Courmont
splitter: filter mouse events, not mouse states
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9187532751ef5af228c05dc45d5f2b036157c823
---
include/vlc_video_splitter.h | 20 +++++++++-----------
modules/video_splitter/clone.c | 2 +-
modules/video_splitter/panoramix.c | 21 ++++++++++-----------
modules/video_splitter/wall.c | 16 ++++++++--------
4 files changed, 28 insertions(+), 31 deletions(-)
diff --git a/include/vlc_video_splitter.h b/include/vlc_video_splitter.h
index 3dad42ace9..9ca1fbe127 100644
--- a/include/vlc_video_splitter.h
+++ b/include/vlc_video_splitter.h
@@ -36,6 +36,8 @@
typedef struct video_splitter_t video_splitter_t;
+struct vout_window_mouse_event_t;
+
/** Structure describing a video splitter output properties
*/
typedef struct
@@ -92,8 +94,8 @@ struct video_splitter_t
int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
picture_t *p_src );
- int (*pf_mouse) ( video_splitter_t *, vlc_mouse_t *,
- int i_index, const vlc_mouse_t *p_new );
+ int (*mouse)(video_splitter_t *, int idx,
+ struct vout_window_mouse_event_t *);
void *p_sys;
};
@@ -142,16 +144,12 @@ static inline int video_splitter_Filter( video_splitter_t *p_splitter,
{
return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
}
-static inline int video_splitter_Mouse( video_splitter_t *p_splitter,
- vlc_mouse_t *p_mouse,
- int i_index, const vlc_mouse_t *p_new )
+
+static inline int video_splitter_Mouse(video_splitter_t *splitter, int index,
+ struct vout_window_mouse_event_t *ev)
{
- if( !p_splitter->pf_mouse )
- {
- *p_mouse = *p_new;
- return VLC_SUCCESS;
- }
- return p_splitter->pf_mouse( p_splitter, p_mouse, i_index, p_new );
+ return (splitter->mouse != NULL)
+ ? splitter->mouse(splitter, index, ev) : VLC_SUCCESS;
}
#endif /* VLC_VIDEO_SPLITTER_H */
diff --git a/modules/video_splitter/clone.c b/modules/video_splitter/clone.c
index 5f1ab93fe9..201c9f1d67 100644
--- a/modules/video_splitter/clone.c
+++ b/modules/video_splitter/clone.c
@@ -155,7 +155,7 @@ static int Open( vlc_object_t *p_this )
/* */
p_splitter->pf_filter = Filter;
- p_splitter->pf_mouse = NULL;
+ p_splitter->mouse = NULL;
msg_Dbg( p_splitter, "spawning %i clone(s)", p_splitter->i_output );
diff --git a/modules/video_splitter/panoramix.c b/modules/video_splitter/panoramix.c
index 591415f96a..88fa1bacc5 100644
--- a/modules/video_splitter/panoramix.c
+++ b/modules/video_splitter/panoramix.c
@@ -35,6 +35,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_video_splitter.h>
+#include <vlc_vout_window.h>
#define OVERLAP
@@ -298,9 +299,7 @@ typedef struct
/* */
static int Filter( video_splitter_t *, picture_t *pp_dst[], picture_t * );
-static int Mouse( video_splitter_t *, vlc_mouse_t *,
- int i_index, const vlc_mouse_t *p_new );
-
+static int Mouse( video_splitter_t *, int, vout_window_mouse_event_t * );
/* */
static int Configuration( panoramix_output_t pp_output[ROW_MAX][COL_MAX],
@@ -692,7 +691,7 @@ static int Open( vlc_object_t *p_this )
/* */
p_splitter->pf_filter = Filter;
- p_splitter->pf_mouse = Mouse;
+ p_splitter->mouse = Mouse;
return VLC_SUCCESS;
}
@@ -784,8 +783,8 @@ static int Filter( video_splitter_t *p_splitter, picture_t *pp_dst[], picture_t
/**
* It converts mouse events
*/
-static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
- int i_index, const vlc_mouse_t *p_new )
+static int Mouse( video_splitter_t *p_splitter, int i_index,
+ vout_window_mouse_event_t *restrict ev )
{
video_splitter_sys_t *p_sys = p_splitter->p_sys;
@@ -796,14 +795,14 @@ static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
const panoramix_output_t *p_output = &p_sys->pp_output[x][y];
if( p_output->b_active && p_output->i_output == i_index )
{
- const int i_x = p_new->i_x - p_output->filter.black.i_left;
- const int i_y = p_new->i_y - p_output->filter.black.i_top;
+ const int i_x = ev->x - p_output->filter.black.i_left;
+ const int i_y = ev->y - p_output->filter.black.i_top;
+
if( i_x >= 0 && i_x < p_output->i_width - p_output->filter.black.i_right &&
i_y >= 0 && i_y < p_output->i_height - p_output->filter.black.i_bottom )
{
- *p_mouse = *p_new;
- p_mouse->i_x = p_output->i_src_x + i_x;
- p_mouse->i_y = p_output->i_src_y + i_y;
+ ev->x = p_output->i_src_x + i_x;
+ ev->y = p_output->i_src_y + i_y;
return VLC_SUCCESS;
}
}
diff --git a/modules/video_splitter/wall.c b/modules/video_splitter/wall.c
index 0328043e6e..8c244d036f 100644
--- a/modules/video_splitter/wall.c
+++ b/modules/video_splitter/wall.c
@@ -33,6 +33,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_video_splitter.h>
+#include <vlc_vout_window.h>
#define ROW_MAX (15)
#define COL_MAX (15)
@@ -108,8 +109,7 @@ typedef struct
} video_splitter_sys_t;
static int Filter( video_splitter_t *, picture_t *pp_dst[], picture_t * );
-static int Mouse( video_splitter_t *, vlc_mouse_t *,
- int i_index, const vlc_mouse_t *p_new );
+static int Mouse( video_splitter_t *, int, vout_window_mouse_event_t * );
/**
* This function allocates and initializes a Wall splitter module.
@@ -367,7 +367,7 @@ static int Open( vlc_object_t *p_this )
/* */
p_splitter->pf_filter = Filter;
- p_splitter->pf_mouse = Mouse;
+ p_splitter->mouse = Mouse;
return VLC_SUCCESS;
}
@@ -422,8 +422,8 @@ static int Filter( video_splitter_t *p_splitter, picture_t *pp_dst[], picture_t
picture_Release( p_src );
return VLC_SUCCESS;
}
-static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
- int i_index, const vlc_mouse_t *p_new )
+static int Mouse( video_splitter_t *p_splitter, int i_index,
+ vout_window_mouse_event_t *restrict ev )
{
video_splitter_sys_t *p_sys = p_splitter->p_sys;
@@ -432,11 +432,11 @@ static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
for( int x = 0; x < p_sys->i_col; x++ )
{
wall_output_t *p_output = &p_sys->pp_output[x][y];
+
if( p_output->b_active && p_output->i_output == i_index )
{
- *p_mouse = *p_new;
- p_mouse->i_x += p_output->i_left;
- p_mouse->i_y += p_output->i_top;
+ ev->x += p_output->i_left;
+ ev->y += p_output->i_top;
return VLC_SUCCESS;
}
}
More information about the vlc-commits
mailing list