]> git.sesse.net Git - vlc/commitdiff
Added VOUT_DISPLAY_EVENT_ON_TOP (vout display).
authorLaurent Aimar <fenrir@videolan.org>
Sat, 24 Oct 2009 16:50:01 +0000 (18:50 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 26 Oct 2009 22:14:32 +0000 (23:14 +0100)
include/vlc_vout_display.h
src/video_output/display.c

index f7c1677a4a580b889b4055b4231ae8546050be9e..f7c436d48dd84a4631c0be62a63a7ceeb429ba94 100644 (file)
@@ -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)
 {
index c3b080045bb98f3d4093053efbfad6033ccf5b64..da5f4f9516b7eb0e789e6924de9c571f09915519 100644 (file)
@@ -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)
 {