Commit 1a0a8254 authored by Thomas Guillem's avatar Thomas Guillem

core: vout: add VOUT_WINDOW_HIDE_MOUSE

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.

Fix #12064
Ref #9787
parent 9ef9ebb0
......@@ -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, /* bool b_hide */
};
/**
......@@ -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, bool hide)
{
return vout_window_Control(window, VOUT_WINDOW_HIDE_MOUSE, hide);
}
static inline void vout_window_ReportSize(vout_window_t *window,
unsigned width, unsigned height)
{
......
......@@ -808,16 +808,18 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
osys->mouse.last_moved + osys->mouse.hide_timeout < date) {
osys->mouse.is_hidden = hide_mouse = true;
} else if (osys->mouse.ch_activity) {
if (osys->mouse.is_hidden)
vout_HideWindowMouse(osys->vout, false);
osys->mouse.is_hidden = false;
}
osys->mouse.ch_activity = false;
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, true) != VLC_SUCCESS
&& !vd->info.has_hide_mouse)
vout_display_Control(vd, VOUT_DISPLAY_HIDE_MOUSE);
}
vout_SendEventMouseHidden(osys->vout);
}
......
......@@ -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 *, bool);
void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
......@@ -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, bool hide)
{
vout_window_t *window = vout->p->window;
return window != NULL ? vout_window_HideMouse(window, hide) : VLC_EGENERIC;
}
/* */
static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment