[vlc-devel] [PATCH] core: vout: add VOUT_WINDOW_HIDE_MOUSE
Thomas Guillem
thomas at gllm.fr
Wed Nov 30 12:01:39 CET 2016
Works better with a boolean, see here
https://github.com/tguillem/vlc/commits/qt_mouse
On Wed, Nov 30, 2016, at 11:50, Thomas Guillem wrote:
>
>
> On Wed, Nov 30, 2016, at 11:27, Thomas Guillem 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,
>
> Do we need to boolean to unhide ?
> In vlc 3.0, on my desktop, xcb mouse cursors were always hidden.
> I don't see any code that unhide the cursor in xcb/events.c, except in
> Close.
>
> > };
> >
> > /**
> > @@ -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
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list