[vlc-devel] [PATCH 3/8] vout display: use a helper function to set the window title

Steve Lhomme robux4 at ycbcr.xyz
Mon May 13 15:11:54 CEST 2019


For now I just kept what was done before internally. It's nice to 
visually know which display module is used. If this code is removed it 
would be nice to keep this feature (and provide it to all other OSes).

On 2019-05-13 15:01, Rémi Denis-Courmont wrote:
> I don't think the display has any business overriding the window title. 
> Doing so breaks the window title feature - and violates the thread 
> access rules for the window.
> 
> IMO, this should be removed entirely.
> 
> Le 13 mai 2019 14:54:48 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
> 
>     We should avoid accessing directly the window from the display module.
> 
>     And it should have been using vd->cfg->window.
>     ------------------------------------------------------------------------
>       include/vlc_vout_display.h              | 4 ++++
>       modules/video_output/win32/direct3d11.c | 2 +-
>       modules/video_output/win32/direct3d9.c  | 2 +-
>       modules/video_output/win32/glwin32.c    | 2 +-
>       modules/video_output/win32/wingdi.c     | 2 +-
>       5 files changed, 8 insertions(+), 4 deletions(-)
> 
>     diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
>     index 97a6c96c1b..687a655cfc 100644
>     --- a/include/vlc_vout_display.h
>     +++ b/include/vlc_vout_display.h
>     @@ -384,6 +384,10 @@ static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
>       {
>           vout_window_ReportMouseDoubleClick(vd->cfg->window, MOUSE_BUTTON_LEFT);
>       }
>     +static inline void vout_display_SendEventTitle(vout_display_t *vd, const char *title)
>     +{
>     +    vout_window_SetTitle(vd->cfg->window, title);
>     +}
>       static inline void vout_display_SendEventViewpointMoved(vout_display_t *vd,
>                                                               const vlc_viewpoint_t *vp)
>       {
>     diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
>     index d0bd833ab7..b2d5b000f1 100644
>     --- a/modules/video_output/win32/direct3d11.c
>     +++ b/modules/video_output/win32/direct3d11.c
>     @@ -717,7 +717,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
>               goto error;
>           }
>       
>     -    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (Direct3D11 output)");
>     +    vout_display_SendEventTitle(vd, VOUT_TITLE " (Direct3D11 output)");
>           msg_Dbg(vd, "Direct3D11 device adapter successfully initialized");
>       
>           vd->info.can_scale_spu        = true;
>     diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
>     index 3f1381c3fe..8d5f6b059d 100644
>     --- a/modules/video_output/win32/direct3d9.c
>     +++ b/modules/video_output/win32/direct3d9.c
>     @@ -1548,7 +1548,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt,
>           }
>       
>           /* Change the window title bar text */
>     -    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (Direct3D9 output)");
>     +    vout_display_SendEventTitle(vd, VOUT_TITLE " (Direct3D9 output)");
>       
>           msg_Dbg(vd, "Direct3D9 device adapter successfully initialized");
>           return VLC_SUCCESS;
>     diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
>     index 247baea475..bad1f5ee57 100644
>     --- a/modules/video_output/win32/glwin32.c
>     +++ b/modules/video_output/win32/glwin32.c
>     @@ -130,7 +130,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
>           if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
>               sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
>       
>     -    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (OpenGL output)");
>     +    vout_display_SendEventTitle(vd, VOUT_TITLE " (OpenGL output)");
>       
>           vout_display_cfg_t embed_cfg = *cfg;
>           embed_cfg.window = EmbedVideoWindow_Create(vd);
>     diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
>     index 2e7054b318..82bb99ea88 100644
>     --- a/modules/video_output/win32/wingdi.c
>     +++ b/modules/video_output/win32/wingdi.c
>     @@ -272,7 +272,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
>           SelectObject(sys->off_dc, sys->off_bitmap);
>           ReleaseDC(sys->sys.hvideownd, window_dc);
>       
>     -    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (WinGDI output)");
>     +    vout_display_SendEventTitle(vd, VOUT_TITLE " (WinGDI output)");
>       
>           return VLC_SUCCESS;
>       }
> 
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser 
> ma brièveté.
> 
> _______________________________________________
> 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