[vlc-devel] [PATCH] core: vout: add VOUT_WINDOW_HIDE_MOUSE
Rémi Denis-Courmont
remi at remlab.net
Wed Nov 30 12:56:52 CET 2016
On November 30, 2016 12:27:40 PM GMT+02:00, Thomas Guillem <thomas at gllm.fr> wrote:
>A window can now hide the mouse cursor. If this control is not
>implemented by
>a "vout window" module, the control will be sent to the "vout display"
>module.
>---
> include/vlc_vout_window.h | 9 +++++++++
> src/video_output/display.c | 6 +++---
> src/video_output/display.h | 1 +
> src/video_output/video_output.c | 7 +++++++
> 4 files changed, 20 insertions(+), 3 deletions(-)
>
>diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
>index 3564f2c..d23b04a 100644
>--- a/include/vlc_vout_window.h
>+++ b/include/vlc_vout_window.h
>@@ -62,6 +62,7 @@ enum {
> VOUT_WINDOW_SET_STATE, /* unsigned state */
> VOUT_WINDOW_SET_SIZE, /* unsigned i_width, unsigned i_height */
> VOUT_WINDOW_SET_FULLSCREEN, /* int b_fullscreen */
>+ VOUT_WINDOW_HIDE_MOUSE,
> };
>
> /**
>@@ -221,6 +222,14 @@ static inline int
>vout_window_SetFullScreen(vout_window_t *window, bool full)
> return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full);
> }
>
>+/**
>+ * Hide the mouse cursor
>+ */
>+static inline int vout_window_HideMouse(vout_window_t *window)
>+{
>+ return vout_window_Control(window, VOUT_WINDOW_HIDE_MOUSE);
>+}
>+
> static inline void vout_window_ReportSize(vout_window_t *window,
> unsigned width, unsigned height)
> {
>diff --git a/src/video_output/display.c b/src/video_output/display.c
>index e4bd497..15379f6 100644
>--- a/src/video_output/display.c
>+++ b/src/video_output/display.c
>@@ -814,10 +814,10 @@ bool vout_ManageDisplay(vout_display_t *vd, bool
>allow_reset_pictures)
> vlc_mutex_unlock(&osys->lock);
>
> if (hide_mouse) {
>- if (!vd->info.has_hide_mouse) {
>- msg_Dbg(vd, "auto hiding mouse cursor");
>+ msg_Dbg(vd, "auto hiding mouse cursor");
>+ if (vout_HideWindowMouse(osys->vout) != VLC_SUCCESS
>+ && !vd->info.has_hide_mouse)
> vout_display_Control(vd, VOUT_DISPLAY_HIDE_MOUSE);
>- }
> vout_SendEventMouseHidden(osys->vout);
> }
>
>diff --git a/src/video_output/display.h b/src/video_output/display.h
>index 7bf94cc..f37b754 100644
>--- a/src/video_output/display.h
>+++ b/src/video_output/display.h
>@@ -37,5 +37,6 @@ void vout_SendDisplayEventMouse(vout_thread_t *,
>const vlc_mouse_t *);
> vout_window_t *vout_NewDisplayWindow(vout_thread_t *, unsigned type);
> void vout_DeleteDisplayWindow(vout_thread_t *, vout_window_t *);
> void vout_SetDisplayWindowSize(vout_thread_t *, unsigned, unsigned);
>+int vout_HideWindowMouse(vout_thread_t *);
>
>void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const
>video_format_t *);
>diff --git a/src/video_output/video_output.c
>b/src/video_output/video_output.c
>index 00036f7..7a7617e 100644
>--- a/src/video_output/video_output.c
>+++ b/src/video_output/video_output.c
>@@ -647,6 +647,13 @@ void vout_SetDisplayWindowSize(vout_thread_t
>*vout,
> vout_display_SendEventDisplaySize(vout->p->display.vd, width, height);
> }
>
>+int vout_HideWindowMouse(vout_thread_t *vout)
>+{
>+ vout_window_t *window = vout->p->window;
>+
>+ return window != NULL ? vout_window_HideMouse(window) :
>VLC_EGENERIC;
>+}
>+
> /* */
>static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t
>*filter)
> {
>--
>2.10.2
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
Unhide is currently hard-coded in each plugin's mouse movement event handler. Feel free to clean it up and add a boolean control as far as I am concerned.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list