[vlc-devel] [PATCH 02/11] display: tell whether VOUT_DISPLAY_HIDE_MOUSE should hide/show the mouse
Steve Lhomme
robux4 at videolabs.io
Tue Aug 8 15:22:22 CEST 2017
The vout_HideWindowMouse() call is always done outside of the lock now.
---
include/vlc_vout_display.h | 2 +-
src/video_output/display.c | 19 +++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 23f7c0b4e4..2a2bd6b86d 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -139,7 +139,7 @@ typedef struct {
enum {
/* Hide the mouse. It will be sent when
* vout_display_t::info.needs_hide_mouse is true */
- VOUT_DISPLAY_HIDE_MOUSE VLC_DEPRECATED_ENUM,
+ VOUT_DISPLAY_HIDE_MOUSE, /* bool hide */
/* Ask to reset the internal buffers after a VOUT_DISPLAY_EVENT_PICTURES_INVALID
* request.
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 778942be4e..1925e2691d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -736,26 +736,29 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
/* Handle mouse timeout */
const mtime_t date = mdate();
- bool hide_mouse = false;
+ bool hide_mouse;
+ bool hide_mouse_changed = false;
vlc_mutex_lock(&osys->lock);
if (!osys->mouse.is_hidden &&
osys->mouse.last_moved + osys->mouse.hide_timeout < date) {
osys->mouse.is_hidden = hide_mouse = true;
+ hide_mouse_changed = true;
} else if (osys->mouse.ch_activity) {
- if (osys->mouse.is_hidden)
- vout_HideWindowMouse(osys->vout, false);
- osys->mouse.is_hidden = false;
+ if (osys->mouse.is_hidden) {
+ osys->mouse.is_hidden = hide_mouse = false;
+ hide_mouse_changed = true;
+ }
}
osys->mouse.ch_activity = false;
vlc_mutex_unlock(&osys->lock);
- if (hide_mouse) {
- msg_Dbg(vd, "auto hiding mouse cursor");
- if (vout_HideWindowMouse(osys->vout, true) != VLC_SUCCESS
+ if (hide_mouse_changed) {
+ msg_Dbg(vd, "auto %sing mouse cursor", hide_mouse?"hid":"show");
+ if (vout_HideWindowMouse(osys->vout, hide_mouse) != VLC_SUCCESS
&& vd->info.needs_hide_mouse)
- vout_display_Control(vd, VOUT_DISPLAY_HIDE_MOUSE);
+ vout_display_Control(vd, VOUT_DISPLAY_HIDE_MOUSE, hide_mouse);
}
bool reset_render = false;
--
2.12.1
More information about the vlc-devel
mailing list