[vlc-devel] commit: Added VOUT_DISPLAY_EVENT_ON_TOP (vout display). (Laurent Aimar )

git version control git at videolan.org
Mon Oct 26 23:15:13 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Oct 24 18:50:01 2009 +0200| [ce75037724b80da41af208a55f81b40e778eb06e] | committer: Laurent Aimar 

Added VOUT_DISPLAY_EVENT_ON_TOP (vout display).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ce75037724b80da41af208a55f81b40e778eb06e
---

 include/vlc_vout_display.h |    7 ++++++-
 src/video_output/display.c |   30 +++++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index f7c1677..f7c436d 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -133,7 +133,7 @@ enum {
     VOUT_DISPLAY_CHANGE_FULLSCREEN,     /* const vout_display_cfg_t *p_cfg */
 
     /* Ask the module to acknowledge/refuse the "always on top" state change
-     * after being requested externally */
+     * after being requested externally or by VOUT_DISPLAY_EVENT_ON_TOP */
     VOUT_DISPLAY_CHANGE_ON_TOP,         /* int b_on_top */
 
     /* Ask the module to acknowledge/refuse the display size change requested
@@ -173,6 +173,7 @@ enum {
     VOUT_DISPLAY_EVENT_PICTURES_INVALID,    /* The buffer are now invalid and need to be changed */
 
     VOUT_DISPLAY_EVENT_FULLSCREEN,
+    VOUT_DISPLAY_EVENT_ON_TOP,
 
     VOUT_DISPLAY_EVENT_DISPLAY_SIZE,        /* The display size need to change : int i_width, int i_height, bool is_fullscreen */
 
@@ -337,6 +338,10 @@ static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_
 {
     vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen);
 }
+static inline void vout_display_SendEventOnTop(vout_display_t *vd, bool is_on_top)
+{
+    vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_ON_TOP, is_on_top);
+}
 /* The mouse position (State and Moved event) must be expressed against vout_display_t::source unit */
 static inline void vout_display_SendEventMouseState(vout_display_t *vd, int x, int y, int button_mask)
 {
diff --git a/src/video_output/display.c b/src/video_output/display.c
index c3b0800..da5f4f9 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -568,6 +568,20 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
         break;
     }
 
+    case VOUT_DISPLAY_EVENT_ON_TOP: {
+        const int is_on_top = (int)va_arg(args, int);
+
+        msg_Dbg(vd, "VoutDisplayEvent 'on top' %d", is_on_top);
+
+        vlc_mutex_lock(&osys->lock);
+        if (!is_on_top != !osys->is_on_top) {
+            osys->ch_on_top = true;
+            osys->is_on_top = is_on_top;
+        }
+        vlc_mutex_unlock(&osys->lock);
+        break;
+    }
+
     case VOUT_DISPLAY_EVENT_DISPLAY_SIZE: {
         const int width  = (int)va_arg(args, int);
         const int height = (int)va_arg(args, int);
@@ -657,6 +671,10 @@ void vout_ManageDisplay(vout_display_t *vd)
         bool is_fullscreen  = osys->is_fullscreen;
         osys->ch_fullscreen = false;
 
+        bool ch_on_top  = osys->ch_on_top;
+        bool is_on_top  = osys->is_on_top;
+        osys->ch_on_top = false;
+
         bool ch_display_size       = osys->ch_display_size;
         int  display_width         = osys->display_width;
         int  display_height        = osys->display_height;
@@ -674,7 +692,7 @@ void vout_ManageDisplay(vout_display_t *vd)
             !reset_pictures &&
             !osys->ch_display_filled &&
             !osys->ch_zoom &&
-            !osys->ch_on_top &&
+            !ch_on_top &&
             !osys->ch_sar &&
             !osys->ch_crop)
             break;
@@ -776,16 +794,12 @@ void vout_ManageDisplay(vout_display_t *vd)
             vout_SendEventZoom(osys->vout, osys->cfg.zoom.num, osys->cfg.zoom.den);
         }
         /* */
-        if (osys->ch_on_top) {
-            bool is_on_top = osys->is_on_top;
-
+        if (ch_on_top) {
             if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_ON_TOP, is_on_top)) {
                 msg_Err(vd, "Failed to set on top");
                 is_on_top = osys->is_on_top_initial;
             }
-            osys->is_on_top_initial =
-            osys->is_on_top         = is_on_top;
-            osys->ch_on_top = false;
+            osys->is_on_top_initial = is_on_top;
 
             /* */
             vout_SendEventOnTop(osys->vout, osys->is_on_top_initial);
@@ -957,10 +971,12 @@ void vout_SetDisplayOnTop(vout_display_t *vd, bool is_on_top)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
+    vlc_mutex_lock(&osys->lock);
     if (!osys->is_on_top != !is_on_top) {
         osys->ch_on_top = true;
         osys->is_on_top = is_on_top;
     }
+    vlc_mutex_unlock(&osys->lock);
 }
 void vout_SetDisplayAspect(vout_display_t *vd, unsigned sar_num, unsigned sar_den)
 {




More information about the vlc-devel mailing list