]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/video.cpp
Revert wrongly commited files in previous commit
[vlc] / modules / gui / wxwindows / video.cpp
index db13ec4457a3284f9d2f9817e50ca285e8cf82ce..b45d22502eda0db0c2f0b4f387ae769167d94077 100644 (file)
@@ -61,6 +61,8 @@ public:
     void ReleaseWindow( void * );
     int  ControlWindow( void *, int, va_list );
 
+    mtime_t i_creation_date;
+
 private:
     intf_thread_t *p_intf;
     vout_thread_t *p_vout;
@@ -99,6 +101,18 @@ 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 && mdate() - ((VideoWindow *)p_window)->i_creation_date < 2000000 )
+        return; /* Hack to prevent saving coordinates if window is not yet
+                 * properly created. Yuck :( */
+
+    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.
  *****************************************************************************/
@@ -114,7 +128,7 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
     b_auto_size = config_GetInt( p_intf, "wxwin-autosize" );
 
     p_vout = NULL;
-
+    i_creation_date = 0;
     m_hide_timer.SetOwner( this, ID_HIDE_TIMER );
 
     p_intf->pf_request_window = ::GetWindow;
@@ -126,24 +140,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 +195,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 );
 }
 
@@ -276,28 +308,25 @@ void VideoWindow::UpdateSize( wxEvent &_event )
     }
     p_intf->p_sys->p_video_sizer->SetMinSize( event->GetSize() );
 
+    i_creation_date = mdate();
     wxCommandEvent intf_event( wxEVT_INTF, 0 );
     p_parent->AddPendingEvent( intf_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);
-        Show();
     }
-    //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 );