]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/video.cpp
* modules/gui/wxwindows/*: workaround uninitialization bug in wxWidgets -> re-enabled...
[vlc] / modules / gui / wxwindows / video.cpp
index 1eafb75ed9d3846578c03b1f706bde795eb28e81..c498d2c3e376ea248f1af6efa25ec987e70d9fba 100644 (file)
@@ -99,6 +99,14 @@ wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent )
     return new VideoWindow( p_intf, p_parent );
 }
 
+void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window )
+{
+#if (wxCHECK_VERSION(2,5,0))
+    if( p_window && p_intf->p_sys->p_video_sizer && p_window->IsShown() )
+        p_intf->p_sys->p_video_sizer->SetMinSize( p_window->GetSize() );
+#endif
+}
+
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
@@ -111,7 +119,7 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
 
     vlc_mutex_init( p_intf, &lock );
 
-    b_auto_size = config_GetInt( p_intf, "wxwin-size-to-video" );
+    b_auto_size = config_GetInt( p_intf, "wxwin-autosize" );
 
     p_vout = NULL;
 
@@ -126,24 +134,35 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
     wxSize child_size = wxSize(0,0);
     if( !b_auto_size )
     {
+        WindowSettings *ws = p_intf->p_sys->p_window_settings;
+        wxPoint p; bool b_shown;
+
         // Maybe this size should be an option
         child_size = wxSize( wxSystemSettings::GetMetric(wxSYS_SCREEN_X) / 2,
                              wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) / 2 );
 
+        ws->GetSettings( WindowSettings::ID_VIDEO, b_shown, p, child_size );
         SetSize( child_size );
     }
 
     p_child_window = new wxWindow( this, -1, wxDefaultPosition, child_size );
 
+    if( !b_auto_size )
+    {
+        SetBackgroundColour( *wxBLACK );
+        p_child_window->SetBackgroundColour( *wxBLACK );
+    }
+
     p_child_window->Show();
     Show();
     b_shown = VLC_TRUE;
 
-    p_child_window->SetBackgroundColour( *wxBLACK );
-    SetBackgroundColour( *wxBLACK );
-
     p_intf->p_sys->p_video_sizer = new wxBoxSizer( wxHORIZONTAL );
+#if (wxCHECK_VERSION(2,5,3))
+    p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND|wxFIXED_MINSIZE );
+#else
     p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND );
+#endif
 
     ReleaseWindow( NULL );
 }
@@ -170,6 +189,13 @@ VideoWindow::~VideoWindow()
     p_intf->pf_control_window = NULL;
     vlc_mutex_unlock( &lock );
 
+    if( !b_auto_size )
+    {
+        WindowSettings *ws = p_intf->p_sys->p_window_settings;
+        ws->SetSettings( WindowSettings::ID_VIDEO, true,
+                         GetPosition(), GetSize() );
+    }
+
     vlc_mutex_destroy( &lock );
 }
 
@@ -248,18 +274,16 @@ static void ReleaseWindow( intf_thread_t *p_intf, void *p_window )
 
 void VideoWindow::ReleaseWindow( void *p_window )
 {
-    if( !b_auto_size ) return;
-
     vlc_mutex_lock( &lock );
-
     p_vout = NULL;
+    vlc_mutex_unlock( &lock );
+
+    if( !b_auto_size ) return;
 
 #if defined(__WXGTK__) || defined(WIN32)
     wxSizeEvent event( wxSize(0, 0), UpdateHide_Event );
     AddPendingEvent( event );
 #endif
-
-    vlc_mutex_unlock( &lock );
 }
 
 void VideoWindow::UpdateSize( wxEvent &_event )
@@ -284,22 +308,18 @@ void VideoWindow::UpdateSize( wxEvent &_event )
 
 void VideoWindow::UpdateHide( wxEvent &_event )
 {
-    if( b_auto_size) m_hide_timer.Start( 200, wxTIMER_ONE_SHOT );
+    if( b_auto_size ) m_hide_timer.Start( 200, wxTIMER_ONE_SHOT );
 }
 
 void VideoWindow::OnHideTimer( wxTimerEvent& WXUNUSED(event))
 {
-    //wxSizeEvent * event = (wxSizeEvent*)(&_event);
     if( b_shown )
     {
         p_intf->p_sys->p_video_sizer->Show( this, FALSE );
+        SetSize( 0, 0 );
         p_intf->p_sys->p_video_sizer->Layout();
         b_shown = VLC_FALSE;
-
-        SetSize(0,0);
-        Hide();
     }
-    //ok I cheat here, but is it ever not 0,0?
     p_intf->p_sys->p_video_sizer->SetMinSize( wxSize(0,0) );
 
     wxCommandEvent intf_event( wxEVT_INTF, 0 );