* modules/audio_output/alsa.c: the aout-device obj var wasn't destroyed properly...
authorGildas Bazin <gbazin@videolan.org>
Mon, 26 May 2003 19:06:47 +0000 (19:06 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 26 May 2003 19:06:47 +0000 (19:06 +0000)
* modules/gui/skins/src/skin_main.cpp: got rid of the skins shortcut.
* modules/gui/wxwindows/*: the popupmenu is not created inside the timer anymore so the slider will still be active when the popup is triggered.
* modules/video_output/directx/events.c, modules/video_output/x11/xcommon.c, src/playlist/playlist.c: new intf-popupmenu obj var to handle popup context menu requests from the vouts.

modules/audio_output/alsa.c
modules/gui/skins/src/skin_main.cpp
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/menus.cpp
modules/gui/wxwindows/timer.cpp
modules/gui/wxwindows/wxwindows.h
modules/video_output/directx/events.c
modules/video_output/x11/xcommon.c
src/playlist/playlist.c

index 572e33c..bead5db 100644 (file)
@@ -2,7 +2,7 @@
  * alsa.c : alsa plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: alsa.c,v 1.27 2003/05/19 23:36:44 gbazin Exp $
+ * $Id: alsa.c,v 1.28 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org> - Original Author
  *          Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
@@ -123,6 +123,7 @@ static void Probe( aout_instance_t * p_aout,
             msg_Warn( p_aout, "unable to retrieve initial hardware parameters"
                               ", disabling linear PCM audio" );
             snd_pcm_close( p_sys->p_snd_pcm );
+            var_Destroy( p_aout, "audio-device" );
             return;
         }
 
@@ -135,6 +136,7 @@ static void Probe( aout_instance_t * p_aout,
             msg_Warn( p_aout, "unable to set stream sample size and word order"
                               ", disabling linear PCM audio" );
             snd_pcm_close( p_sys->p_snd_pcm );
+            var_Destroy( p_aout, "audio-device" );
             return;
         }
 
@@ -208,6 +210,14 @@ static void Probe( aout_instance_t * p_aout,
         }
     }
 
+    var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL );
+    if( val.i_int <= 0 )
+    {
+        /* Probe() has failed. */
+        var_Destroy( p_aout, "audio-device" );
+        return;
+    }
+
     /* Add final settings to the variable */
     var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
     val.b_bool = VLC_TRUE;
index 1423bc7..71f4c60 100644 (file)
@@ -2,7 +2,7 @@
  * skin-main.cpp: skins plugin for VLC
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.27 2003/05/26 02:09:27 gbazin Exp $
+ * $Id: skin_main.cpp,v 1.28 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -298,7 +298,6 @@ vlc_module_begin();
     set_description( _("Skinnable Interface") );
     set_capability( "interface", 30 );
     set_callbacks( Open, Close );
-    add_shortcut( "skins" );
 vlc_module_end();
 
 
index 83fa426..cad7e93 100644 (file)
@@ -2,7 +2,7 @@
  * interface.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: interface.cpp,v 1.34 2003/05/26 16:06:13 gbazin Exp $
+ * $Id: interface.cpp,v 1.35 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -172,6 +172,8 @@ Interface::Interface( intf_thread_t *_p_intf ):
     p_prefs_dialog = NULL;
     i_old_playing_status = PAUSE_S;
     p_open_dialog = NULL;
+    p_popup_menu = NULL;
+    b_popup_change = VLC_FALSE;
 
     /* Give our interface a nice little icon */
     p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
index c5501d4..d2865a2 100644 (file)
@@ -2,7 +2,7 @@
  * menus.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: menus.cpp,v 1.13 2003/05/24 20:54:27 gbazin Exp $
+ * $Id: menus.cpp,v 1.14 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -174,6 +174,7 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
 
     _p_main_interface->p_popup_menu = &popupmenu;
     _p_main_interface->PopupMenu( &popupmenu, pos.x, pos.y );
+    _p_main_interface->p_popup_menu = NULL;
 }
 
 wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
index 7e8e559..4b75af8 100644 (file)
@@ -2,7 +2,7 @@
  * timer.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: timer.cpp,v 1.18 2003/05/18 19:46:35 gbazin Exp $
+ * $Id: timer.cpp,v 1.19 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 
 void DisplayStreamDate( wxControl *, intf_thread_t *, int );
 
+/* Callback prototype */
+int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+                 vlc_value_t old_val, vlc_value_t new_val, void *param );
+
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
@@ -59,6 +63,17 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
     i_old_playing_status = PAUSE_S;
     i_old_rate = DEFAULT_RATE;
 
+    /* Register callback for the intf-popupmenu variable */
+    playlist_t *p_playlist =
+        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                       FIND_ANYWHERE );
+    if( p_playlist != NULL )
+    {
+        var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB,
+                        p_main_interface );
+        vlc_object_release( p_playlist );
+    }
+
     Start( 100 /*milliseconds*/, wxTIMER_CONTINUOUS );
 }
 
@@ -104,12 +119,21 @@ void Timer::Notify()
     vlc_mutex_lock( &p_intf->change_lock );
 
     /* If the "display popup" flag has changed */
-    if( p_intf->b_menu_change )
+    if( p_main_interface->b_popup_change )
     {
         wxPoint mousepos = wxGetMousePosition();
-        PopupMenu( p_intf, p_main_interface,
-                   p_main_interface->ScreenToClient(mousepos) );
-        p_intf->b_menu_change = 0;
+
+#if defined( __WXMSW__ ) || defined( __WXMAC__ )
+        wxContextMenuEvent event =
+            wxContextMenuEvent( wxEVT_NULL, 0, mousepos );
+#else
+        wxMouseEvent event = wxMouseEvent( wxEVT_RIGHT_UP );
+        event.m_x = p_main_interface->ScreenToClient(mousepos).x;
+        event.m_y = p_main_interface->ScreenToClient(mousepos).y;
+#endif
+        p_main_interface->AddPendingEvent(event);
+
+        p_main_interface->b_popup_change = VLC_FALSE;
     }
 
     /* Update the log window */
@@ -120,7 +144,7 @@ void Timer::Notify()
 
     /* Update the fileinfo windows */
     p_intf->p_sys->p_fileinfo_window->UpdateFileInfo();
-    
+
     /* Update the input */
     if( p_intf->p_sys->p_input == NULL )
     {
@@ -296,3 +320,18 @@ void DisplayStreamDate( wxControl *p_slider_frame, intf_thread_t * p_intf ,
 #undef p_area
      }
 }
+
+/*****************************************************************************
+ * PlaylistChanged: callback triggered by the intf-change playlist variable
+ *  We don't rebuild the playlist directly here because we don't want the
+ *  caller to block for a too long time.
+ *****************************************************************************/
+int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+                 vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+    Interface *p_main_interface = (Interface *)param;
+
+    p_main_interface->b_popup_change = VLC_TRUE;
+
+    return VLC_SUCCESS;
+}
index 9d9e92d..7881b59 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: wxwindows.h,v 1.31 2003/05/24 17:52:49 gbazin Exp $
+ * $Id: wxwindows.h,v 1.32 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -140,6 +140,7 @@ public:
     OpenDialog  *p_open_dialog;
 
     wxMenu      *p_popup_menu;
+    vlc_bool_t  b_popup_change;
 
 private:
     void CreateOurMenuBar();
index 38cf06d..8e02693 100644 (file)
@@ -2,7 +2,7 @@
  * events.c: Windows DirectX video output events handler
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: events.c,v 1.15 2003/05/17 14:36:19 gbazin Exp $
+ * $Id: events.c,v 1.16 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -170,13 +170,14 @@ void DirectXEventThread( event_thread_t *p_event )
             val.i_int &= ~4;
             var_Set( p_event->p_vout, "mouse-button-down", val );
             {
-                intf_thread_t *p_intf;
-                p_intf = vlc_object_find( p_event, VLC_OBJECT_INTF,
-                                                   FIND_ANYWHERE );
-                if( p_intf )
+                playlist_t *p_playlist =
+                    vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                     FIND_ANYWHERE );
+                if( p_playlist != NULL )
                 {
-                    p_intf->b_menu_change = 1;
-                    vlc_object_release( p_intf );
+                    vlc_value_t val;
+                    var_Set( p_playlist, "intf-popupmenu", val );
+                    vlc_object_release( p_playlist );
                 }
             }
             break;
@@ -202,13 +203,14 @@ void DirectXEventThread( event_thread_t *p_event )
 
             case VK_MENU:
                 {
-                    intf_thread_t *p_intf;
-                    p_intf = vlc_object_find( p_event->p_vout, VLC_OBJECT_INTF,
-                                              FIND_ANYWHERE );
-                    if( p_intf )
+                    playlist_t *p_playlist =
+                        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                         FIND_ANYWHERE );
+                    if( p_playlist != NULL )
                     {
-                        p_intf->b_menu_change = 1;
-                        vlc_object_release( p_intf );
+                        vlc_value_t val;
+                        var_Set( p_playlist, "intf-popupmenu", val );
+                        vlc_object_release( p_playlist );
                     }
                 }
                 break;
index f5f74f0..e1c8947 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.18 2003/05/25 20:16:26 gbazin Exp $
+ * $Id: xcommon.c,v 1.19 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -539,6 +539,16 @@ static int ManageVideo( vout_thread_t *p_vout )
                         p_intf->b_menu_change = 1;
                         vlc_object_release( p_intf );
                     }
+
+                    playlist_t *p_playlist =
+                        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                         FIND_ANYWHERE );
+                    if( p_playlist != NULL )
+                    {
+                        vlc_value_t val;
+                        var_Set( p_playlist, "intf-popupmenu", val );
+                        vlc_object_release( p_playlist );
+                    }
                 }
                 break;
             case XK_Left:
@@ -676,6 +686,16 @@ static int ManageVideo( vout_thread_t *p_vout )
                             p_intf->b_menu_change = 1;
                             vlc_object_release( p_intf );
                         }
+
+                        playlist_t *p_playlist =
+                        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                         FIND_ANYWHERE );
+                        if( p_playlist != NULL )
+                        {
+                            vlc_value_t val;
+                            var_Set( p_playlist, "intf-popupmenu", val );
+                            vlc_object_release( p_playlist );
+                        }
                     }
                     break;
 
index 207bd15..384a91f 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.c : Playlist management functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: playlist.c,v 1.35 2003/05/12 17:33:20 gbazin Exp $
+ * $Id: playlist.c,v 1.36 2003/05/26 19:06:47 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -64,6 +64,8 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
     val.b_bool = VLC_TRUE;
     var_Set( p_playlist, "intf-change", val );
 
+    var_Create( p_playlist, "intf-popupmenu", VLC_VAR_VOID );
+
     p_playlist->p_input = NULL;
     p_playlist->i_status = PLAYLIST_STOPPED;
     p_playlist->i_index = -1;