[vlc-commits] vout:win32: set the standalone window title using vout_window_SetTitle()

Steve Lhomme git at videolan.org
Tue Apr 2 16:33:13 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 27 10:18:20 2019 +0100| [f592f2abd8ab683ac64f4044281f647b8ff2e2f8] | committer: Steve Lhomme

vout:win32: set the standalone window title using vout_window_SetTitle()

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

 modules/video_output/win32/direct3d11.c |  5 +---
 modules/video_output/win32/direct3d9.c  |  3 +--
 modules/video_output/win32/events.c     | 47 ---------------------------------
 modules/video_output/win32/events.h     |  1 -
 modules/video_output/win32/glwin32.c    |  2 +-
 modules/video_output/win32/wingdi.c     |  2 +-
 6 files changed, 4 insertions(+), 56 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 4b7decafb2..7161855ffc 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -509,10 +509,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         goto error;
     }
 
-#if !VLC_WINSTORE_APP
-    if (sys->sys.event != NULL)
-        EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (Direct3D11 output)");
-#endif
+    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (Direct3D11 output)");
     msg_Dbg(vd, "Direct3D11 device adapter successfully initialized");
 
     vd->info.has_double_click     = true;
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 8713dc75fa..5cea586923 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1513,8 +1513,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt,
     }
 
     /* Change the window title bar text */
-    if (sys->sys.event != NULL)
-        EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (Direct3D9 output)");
+    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (Direct3D9 output)");
 
     msg_Dbg(vd, "Direct3D9 device adapter successfully initialized");
     return VLC_SUCCESS;
diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 52f752464c..5ef37d7669 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -44,7 +44,6 @@
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-#define WM_VLC_CHANGE_TEXT   (WM_APP + 1)
 #define WM_VLC_SET_TOP_STATE (WM_APP + 2)
 
 struct event_thread_t
@@ -74,9 +73,6 @@ struct event_thread_t
     /* Gestures */
     win32_gesture_sys_t *p_gesture;
 
-    /* Title */
-    char *psz_title;
-
     int i_window_style;
     RECT window_area;
 
@@ -327,32 +323,6 @@ static void *EventThread( void *p_this )
             break;
         }
 
-        case WM_VLC_CHANGE_TEXT:
-        {
-            vlc_mutex_lock( &p_event->lock );
-            wchar_t *pwz_title = NULL;
-            if( p_event->psz_title )
-            {
-                const size_t i_length = strlen(p_event->psz_title);
-                pwz_title = vlc_alloc( i_length + 1, 2 );
-                if( pwz_title )
-                {
-                    mbstowcs( pwz_title, p_event->psz_title, 2 * i_length );
-                    pwz_title[i_length] = 0;
-                }
-            }
-            vlc_mutex_unlock( &p_event->lock );
-
-            if( pwz_title )
-            {
-                SetWindowTextW( p_event->hwnd, pwz_title );
-                if( p_event->hfswnd )
-                    SetWindowTextW( p_event->hfswnd, pwz_title );
-                free( pwz_title );
-            }
-            break;
-        }
-
         default:
             /* Messages we don't handle directly are dispatched to the
              * window procedure */
@@ -378,21 +348,6 @@ static void *EventThread( void *p_this )
     return NULL;
 }
 
-void EventThreadUpdateTitle( event_thread_t *p_event, const char *psz_fallback )
-{
-    char *psz_title = var_InheritString( p_event->obj, "video-title" );
-    if( !psz_title )
-        psz_title = strdup( psz_fallback );
-    if( !psz_title )
-        return;
-
-    vlc_mutex_lock( &p_event->lock );
-    free( p_event->psz_title );
-    p_event->psz_title = psz_title;
-    vlc_mutex_unlock( &p_event->lock );
-
-    PostMessage( p_event->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
-}
 int EventThreadGetWindowStyle( event_thread_t *p_event )
 {
     /* No need to lock, it is serialized by EventThreadStart */
@@ -438,7 +393,6 @@ event_thread_t *EventThreadCreate( vlc_object_t *obj, vout_window_t *parent_wind
 
     p_event->is_cursor_hidden = false;
     p_event->button_pressed = 0;
-    p_event->psz_title = NULL;
     p_event->hwnd = NULL;
     atomic_init(&p_event->size_changed, false);
 
@@ -457,7 +411,6 @@ event_thread_t *EventThreadCreate( vlc_object_t *obj, vout_window_t *parent_wind
 
 void EventThreadDestroy( event_thread_t *p_event )
 {
-    free( p_event->psz_title );
     vlc_cond_destroy( &p_event->wait );
     vlc_mutex_destroy( &p_event->lock );
     free( p_event );
diff --git a/modules/video_output/win32/events.h b/modules/video_output/win32/events.h
index 6a9716036c..8b31d12558 100644
--- a/modules/video_output/win32/events.h
+++ b/modules/video_output/win32/events.h
@@ -51,7 +51,6 @@ void            EventThreadDestroy( event_thread_t * );
 int             EventThreadStart( event_thread_t *, event_hwnd_t *, const event_cfg_t * );
 void            EventThreadStop( event_thread_t * );
 
-void            EventThreadUpdateTitle( event_thread_t *, const char *psz_fallback );
 int             EventThreadGetWindowStyle( event_thread_t * );
 void            EventThreadUpdatePlace( event_thread_t *p_event,
                                         const vout_display_place_t *p_place );
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 053cc36569..b1f376087e 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);
 
-    EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (OpenGL output)");
+    vout_window_SetTitle(sys->area.vdcfg.window, 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 46a7885176..96561c191d 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -261,7 +261,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);
 
-    EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (WinGDI output)");
+    vout_window_SetTitle(sys->area.vdcfg.window, VOUT_TITLE " (WinGDI output)");
 
     UpdateRects(vd, &sys->area, &sys->sys);
 



More information about the vlc-commits mailing list