]> git.sesse.net Git - vlc/commitdiff
* ALL: improved hotkeys support.
authorGildas Bazin <gbazin@videolan.org>
Wed, 29 Oct 2003 01:33:27 +0000 (01:33 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 29 Oct 2003 01:33:27 +0000 (01:33 +0000)
15 files changed:
include/main.h
include/variables.h
include/vlc_common.h
include/vlc_keys.h
modules/access/dvdplay/intf.c
modules/control/hotkeys.c
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/preferences.cpp
modules/video_output/directx/events.c
modules/video_output/x11/xcommon.c
src/input/input.c
src/libvlc.c
src/libvlc.h
src/misc/configuration.c
src/misc/variables.c

index 64caf128f4136fd68e7d04cc884dc9abc9bed1fa..8261ae3325ccef95458704c6f775188f2542d941 100644 (file)
@@ -3,7 +3,7 @@
  * Declaration and extern access to global program object.
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: main.h,v 1.55 2003/09/24 21:31:54 gbazin Exp $
+ * $Id: main.h,v 1.56 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -83,9 +83,6 @@ struct vlc_t
     char *                 psz_homedir;             /* user's home directory */
     char *                 psz_configfile;        /* location of config file */
 
-    /* Generic settings */
-    mtime_t                i_desync;   /* relative desync of the audio ouput */
-
     /* Fast memcpy plugin used */
     module_t *             p_memcpy_module;
 #if defined( UNDER_CE )
@@ -98,12 +95,20 @@ struct vlc_t
 
     /* Shared data - these structures are accessed directly from p_vlc by
      * several modules */
-    input_channel_t *      p_channel;                /* channel library data */
 
     /* Locks */
     vlc_mutex_t            config_lock;          /* lock for the config file */
 #ifdef SYS_DARWIN
     vlc_mutex_t            quicktime_lock;          /* QT is not thread safe on OSX */
 #endif
+
+    /* Structure storing the action name / key associations */
+    struct hotkey
+    {
+        const char *psz_action;
+        int i_action;
+        int i_key;
+
+    } *p_hotkeys;
 };
 
index b63b98c29093d99b2e013fc74d341862eabd28a7..80610e4d68fcc53191553fdbf7cb157f9efe60ff 100644 (file)
@@ -2,7 +2,7 @@
  * variables.h: variables handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: variables.h,v 1.17 2003/09/29 15:45:19 sigmunau Exp $
+ * $Id: variables.h,v 1.18 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -94,6 +94,7 @@ struct variable_t
 #define VLC_VAR_VOID      0x0010
 #define VLC_VAR_BOOL      0x0020
 #define VLC_VAR_INTEGER   0x0030
+#define VLC_VAR_HOTKEY    0x0031
 #define VLC_VAR_STRING    0x0040
 #define VLC_VAR_MODULE    0x0041
 #define VLC_VAR_FILE      0x0042
index 790f521152bdb97b60f98d3bf6061f45c4ab9e33..5400438c6684c302eab19d882d716fbac10ea0b5 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc_common.h,v 1.83 2003/10/25 00:49:13 sam Exp $
+ * $Id: vlc_common.h,v 1.84 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -201,7 +201,6 @@ typedef struct intf_channel_t intf_channel_t;
 /* Input */
 typedef struct input_thread_t input_thread_t;
 typedef struct input_thread_sys_t input_thread_sys_t;
-typedef struct input_channel_t input_channel_t;
 typedef struct input_area_t input_area_t;
 typedef struct input_buffers_t input_buffers_t;
 typedef struct input_socket_t input_socket_t;
index ffc31dee98ed53ddbc9723ad32cc67d732f05fd2..5f20d69ed7c0d59c2754f6241f098692058934cc 100644 (file)
@@ -2,7 +2,7 @@
  * hotkeys.h: keycode defines
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlc_keys.h,v 1.4 2003/10/28 20:15:48 hartman Exp $
+ * $Id: vlc_keys.h,v 1.5 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -162,3 +162,20 @@ static inline char *KeyToString( int i_key )
     return NULL;
 }
 
+#define ACTIONID_QUIT                  1
+#define ACTIONID_PLAY_PAUSE            2
+#define ACTIONID_PLAY                  3
+#define ACTIONID_PAUSE                 4
+#define ACTIONID_STOP                  5
+#define ACTIONID_PREV                  6
+#define ACTIONID_NEXT                  7
+#define ACTIONID_SLOWER                8
+#define ACTIONID_FASTER                9
+#define ACTIONID_FULLSCREEN            10
+#define ACTIONID_VOL_UP                11
+#define ACTIONID_VOL_DOWN              12
+#define ACTIONID_NAV_ACTIVATE          13
+#define ACTIONID_NAV_UP                14
+#define ACTIONID_NAV_DOWN              15
+#define ACTIONID_NAV_LEFT              16
+#define ACTIONID_NAV_RIGHT             17
index 378b2769e50552fb485fe9516f4652d8b0541eb3..15b1cb4c58ca4fbea336ef8e4baf24b1d9f89be2 100644 (file)
@@ -2,7 +2,7 @@
  * intf.c: interface for DVD video manager
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.8 2003/10/26 13:10:05 sigmunau Exp $
+ * $Id: intf.c,v 1.9 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -35,6 +35,8 @@
 #include "input_ext-intf.h"
 #include "input_ext-dec.h"
 
+#include "vlc_keys.h"
+
 #include "dvd.h"
 
 /*****************************************************************************
@@ -109,11 +111,6 @@ static void RunIntf( intf_thread_t *p_intf )
     vlc_object_t *      p_vout = NULL;
     mtime_t             mtime = 0;
     mtime_t             mlast = 0;
-    int i_nav_up = config_GetInt( p_intf, "nav-up-key" );
-    int i_nav_down = config_GetInt( p_intf, "nav-down-key" );
-    int i_nav_left = config_GetInt( p_intf, "nav-left-key" );
-    int i_nav_right = config_GetInt( p_intf, "nav-right-key" );
-    int i_nav_activate = config_GetInt( p_intf, "nav-activate-key" );
 
     if( InitThread( p_intf ) < 0 )
     {
@@ -223,30 +220,40 @@ static void RunIntf( intf_thread_t *p_intf )
         if( p_intf->p_sys->b_key_pressed )
         {
             vlc_value_t val;
-            int i_activate;
+            int i, i_activate, i_action = -1;
+            struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
 
             p_intf->p_sys->b_key_pressed = VLC_FALSE;
             
+            /* Find action triggered by hotkey (if any) */
             var_Get( p_intf->p_vlc, "key-pressed", &val );
-            if ( val.i_int )
+            for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+            {
+                if( p_hotkeys[i].i_key == val.i_int )
+                {
+                    i_action = p_hotkeys[i].i_action;
+                }
+            }
+
+            if( i_action )
             {
-                if( val.i_int == i_nav_left )
+                if( i_action == ACTIONID_NAV_LEFT )
                 {
                     p_intf->p_sys->control.type = DVDCtrlLeftButtonSelect;
                 }
-                else if( val.i_int == i_nav_right )
+                else if( i_action == ACTIONID_NAV_RIGHT )
                 {
                     p_intf->p_sys->control.type = DVDCtrlRightButtonSelect;
                 }
-                else if( val.i_int == i_nav_up )
+                else if( i_action == ACTIONID_NAV_UP )
                 {
                     p_intf->p_sys->control.type = DVDCtrlUpperButtonSelect;
                 }
-                else if( val.i_int == i_nav_down )
+                else if( i_action == ACTIONID_NAV_DOWN )
                 {
                     p_intf->p_sys->control.type = DVDCtrlLowerButtonSelect;
                 }
-                else if( val.i_int == i_nav_activate )
+                else if( i_action == ACTIONID_NAV_ACTIVATE )
                 {
                     p_intf->p_sys->control.type = DVDCtrlButtonActivate;
                 }
index d52a69ec6ecc89407033725eda8494c403c4b984..a41ca1401d25753feb93df13c441b4094dfe52cc 100755 (executable)
@@ -2,7 +2,7 @@
  * hotkeys.c: Hotkey handling for vlc
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: hotkeys.c,v 1.1 2003/10/26 12:46:55 sigmunau Exp $
+ * $Id: hotkeys.c,v 1.2 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -33,6 +33,8 @@
 #include <vlc/aout.h>
 #include <osd.h>
 
+#include "vlc_keys.h"
+
 #define BUFFER_SIZE 10
 /*****************************************************************************
  * intf_sys_t: description and status of FB interface
@@ -60,6 +62,8 @@ static void Feedback( intf_thread_t *, char * );
 static int  GetKey  ( intf_thread_t *);
 static int  KeyEvent( vlc_object_t *, char const *,
                       vlc_value_t, vlc_value_t, void * );
+static int  ActionKeyCB( vlc_object_t *, char const *,
+                         vlc_value_t, vlc_value_t, void * );
 
 /*****************************************************************************
  * Module descriptor
@@ -90,6 +94,7 @@ static int Open( vlc_object_t *p_this )
 
     p_intf->p_sys->p_input = NULL;
     p_intf->p_sys->p_vout = NULL;
+
     var_AddCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
     return 0;
 }
@@ -121,22 +126,26 @@ static void Run( intf_thread_t *p_intf )
     playlist_t *p_playlist;
     input_thread_t *p_input;
     vout_thread_t *p_vout = NULL;
-    int i_fullscreen = config_GetInt( p_intf, "fullscreen-key" );
-    int i_quit = config_GetInt( p_intf, "quit-key" );
-    int i_vol_up = config_GetInt( p_intf, "vol-up-key" );
-    int i_vol_down = config_GetInt( p_intf, "vol-down-key" );
-    int i_play_pause = config_GetInt( p_intf, "play-pause-key" );    
-    int i_play = config_GetInt( p_intf, "play-key" );    
-    int i_pause = config_GetInt( p_intf, "pause-key" );    
-    int i_stop = config_GetInt( p_intf, "stop-key" );
-    int i_next = config_GetInt( p_intf, "next-key" );
-    int i_prev = config_GetInt( p_intf, "prev-key" );
-    int i_faster = config_GetInt( p_intf, "faster-key" );
-    int i_slower = config_GetInt( p_intf, "slower-key" );
-    int i_key = 0;
-    
+    struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
+    vlc_value_t val;
+    int i;
+
+    /* Initialize hotkey structure */
+    for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+    {
+        var_Create( p_intf->p_vlc, p_hotkeys[i].psz_action,
+                    VLC_VAR_HOTKEY | VLC_VAR_DOINHERIT );
+
+        var_AddCallback( p_intf->p_vlc, p_hotkeys[i].psz_action,
+                         ActionKeyCB, NULL );
+        var_Get( p_intf->p_vlc, p_hotkeys[i].psz_action, &val );
+        var_Set( p_intf->p_vlc, p_hotkeys[i].psz_action, val );
+    }
+
     while( !p_intf->b_die )
     {
+        int i_key, i_action;
+
         /* Sleep a bit */
         msleep( INTF_IDLE_SLEEP );
 
@@ -167,20 +176,31 @@ static void Run( intf_thread_t *p_intf )
             p_intf->p_sys->p_vout = NULL;
         }
 
+        /* Find action triggered by hotkey */
+        i_action = 0;
         i_key = GetKey( p_intf );
-        if ( !i_key )
+        for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+        {
+            if( p_hotkeys[i].i_key == i_key )
+            {
+                 i_action = p_hotkeys[i].i_action;
+            }
+        }
+
+        if( !i_action )
         {
             /* No key pressed, sleep a bit more */
             msleep( INTF_IDLE_SLEEP );
             continue;
         }
-        if( i_key == i_quit )
+
+        if( i_action == ACTIONID_QUIT )
         {
             p_intf->p_vlc->b_die = VLC_TRUE;
             Feedback( p_intf, _("Quit" ) );
             continue;
         }
-        if( i_key == i_vol_up )
+        else if( i_action == ACTIONID_VOL_UP )
         {
             audio_volume_t i_newvol;
             char string[9];
@@ -188,7 +208,7 @@ static void Run( intf_thread_t *p_intf )
             sprintf( string, "Vol %%%d", i_newvol*100/AOUT_VOLUME_MAX );
             Feedback( p_intf, string );
         }
-        if( i_key == i_vol_down )
+        else if( i_action == ACTIONID_VOL_DOWN )
         {
             audio_volume_t i_newvol;
             char string[9];
@@ -196,16 +216,14 @@ static void Run( intf_thread_t *p_intf )
             sprintf( string, "Vol %%%d", i_newvol*100/AOUT_VOLUME_MAX );
             Feedback( p_intf, string );
         }
-        if( p_vout )
+        else if( i_action == ACTIONID_FULLSCREEN )
         {
-            if( i_key == i_fullscreen )
+            if( p_vout )
             {
                 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
-                continue;
             }
         }
-            
-        if( i_key == i_play )
+        else if( i_action == ACTIONID_PLAY )
         {
             p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                           FIND_ANYWHERE );
@@ -219,10 +237,8 @@ static void Run( intf_thread_t *p_intf )
                     vlc_object_release( p_playlist );
                 }
             }
-            continue;
         }
-            
-        if( i_key == i_play_pause )
+        else if( i_action == ACTIONID_PLAY_PAUSE )
         {
             if( p_input &&
                 p_input->stream.control.i_status != PAUSE_S )
@@ -245,18 +261,16 @@ static void Run( intf_thread_t *p_intf )
                         vlc_object_release( p_playlist );
                     }
                 }
-            }                    
-            continue;
+            }
         }
-            
         else if( p_input )
         {
-            if( i_key == i_pause )
+            if( i_action == ACTIONID_PAUSE )
             {
                 Feedback( p_intf, _( "Pause" ) );
                 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
             }
-            else if( i_key == i_next )
+            else if( i_action == ACTIONID_NEXT )
             {
                 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                               FIND_ANYWHERE );
@@ -266,7 +280,7 @@ static void Run( intf_thread_t *p_intf )
                     vlc_object_release( p_playlist );
                 }
             }
-            else if( i_key == i_prev )
+            else if( i_action == ACTIONID_PREV )
             {
                 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                               FIND_ANYWHERE );
@@ -276,7 +290,7 @@ static void Run( intf_thread_t *p_intf )
                     vlc_object_release( p_playlist );
                 }
             }
-            else if( i_key == i_stop )
+            else if( i_action == ACTIONID_STOP )
             {
                 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                               FIND_ANYWHERE );
@@ -286,11 +300,11 @@ static void Run( intf_thread_t *p_intf )
                     vlc_object_release( p_playlist );
                 }
             }
-            else if( i_key == i_faster )
+            else if( i_action == ACTIONID_FASTER )
             {
                 input_SetStatus( p_input, INPUT_STATUS_FASTER );
             }
-            else if( i_key == i_slower )
+            else if( i_action == ACTIONID_FASTER )
             {
                 input_SetStatus( p_input, INPUT_STATUS_SLOWER );
             }
@@ -303,18 +317,18 @@ static void Feedback( intf_thread_t *p_intf, char *psz_string )
 {
     if ( p_intf->p_sys->p_vout )
     {
-       vout_ShowTextRelative( p_intf->p_sys->p_vout, psz_string, NULL, 
-                                OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,400000 );
+        vout_ShowTextRelative( p_intf->p_sys->p_vout, psz_string, NULL, 
+                                 OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,400000 );
     }
 }
 
-static int  GetKey  ( intf_thread_t *p_intf)
+static int GetKey( intf_thread_t *p_intf)
 {
     vlc_mutex_lock( &p_intf->p_sys->change_lock );
     if ( p_intf->p_sys->i_size == 0 )
     {
         vlc_mutex_unlock( &p_intf->p_sys->change_lock );
-        return 0;
+        return -1;
     }
     else
     {
@@ -334,7 +348,7 @@ static int  GetKey  ( intf_thread_t *p_intf)
  * KeyEvent: callback for keyboard events
  *****************************************************************************/
 static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
-                       vlc_value_t oldval, vlc_value_t newval, void *p_data )
+                     vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_data;
     vlc_mutex_lock( &p_intf->p_sys->change_lock );
@@ -348,9 +362,26 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
     {
         p_intf->p_sys->p_keys[ p_intf->p_sys->i_size ] = newval.i_int;
         p_intf->p_sys->i_size++;
-    }            
+    }
     vlc_mutex_unlock( &p_intf->p_sys->change_lock );
 
     return VLC_SUCCESS;
 }
 
+static int ActionKeyCB( vlc_object_t *p_this, char const *psz_var,
+                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+    vlc_t *p_vlc = (vlc_t *)p_this;
+    struct hotkey *p_hotkeys = p_vlc->p_hotkeys;
+    int i;
+
+    for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+    {
+        if( !strcmp( p_hotkeys[i].psz_action, psz_var ) )
+        {
+            p_hotkeys[i].i_key = newval.i_int;
+        }
+    }
+
+    return VLC_SUCCESS;
+}
index 558381167783a84d7a8a56d795c6f6a66c550550..afb51dfbbbca47dd87885cd19abc3894a6e646db 100644 (file)
@@ -2,7 +2,7 @@
  * interface.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: interface.cpp,v 1.67 2003/10/19 22:52:11 sigmunau Exp $
+ * $Id: interface.cpp,v 1.68 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -632,28 +632,30 @@ void Interface::UpdateAcceleratorTable()
 {
     /* Set some hotkeys */
     wxAcceleratorEntry entries[7];
-    int i_key = config_GetInt( p_intf, "quit-key" );
+    vlc_value_t val;
     int i = 0;
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    Exit_Event );
-    i_key = config_GetInt( p_intf, "stop-key" );
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    StopStream_Event );
-    i_key = config_GetInt( p_intf, "play-pause-key" );
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    PlayStream_Event );
-    i_key = config_GetInt( p_intf, "next-key" );
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    NextStream_Event );
-    i_key = config_GetInt( p_intf, "prev-key" );
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    PrevStream_Event );
-    i_key = config_GetInt( p_intf, "faster-key" );
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    FastStream_Event );
-    i_key = config_GetInt( p_intf, "slower-key" );
-    entries[i++].Set( ConvertHotkeyModifiers( i_key ), ConvertHotkey( i_key ),
-                    SlowStream_Event );
+
+    var_Get( p_intf->p_vlc, "key-quit", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), Exit_Event );
+    var_Get( p_intf->p_vlc, "key-stop", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), StopStream_Event );
+    var_Get( p_intf->p_vlc, "key-play-pause", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), PlayStream_Event );
+    var_Get( p_intf->p_vlc, "key-next", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), NextStream_Event );
+    var_Get( p_intf->p_vlc, "key-prev", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), PrevStream_Event );
+    var_Get( p_intf->p_vlc, "key-faster", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), FastStream_Event );
+    var_Get( p_intf->p_vlc, "key-slower", &val );
+    entries[i++].Set( ConvertHotkeyModifiers( val.i_int ),
+                      ConvertHotkey( val.i_int ), SlowStream_Event );
 
     wxAcceleratorTable accel( 7, entries );
 
@@ -665,8 +667,6 @@ void Interface::UpdateAcceleratorTable()
 
 }
 
-
-
 /*****************************************************************************
  * Event Handlers.
  *****************************************************************************/
index b68916f475a2b14cd92ff17d018191590291150a..869826b10cf461d6c771120712fe256f453f3acd 100644 (file)
@@ -2,7 +2,7 @@
  * preferences.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.38 2003/10/20 12:25:22 gbazin Exp $
+ * $Id: preferences.cpp,v 1.39 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -854,6 +854,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
 
 void PrefsPanel::ApplyChanges()
 {
+    vlc_value_t val;
+
     for( size_t i = 0; i < config_array.GetCount(); i++ )
     {
         ConfigControl *control = config_array.Item(i);
@@ -867,8 +869,11 @@ void PrefsPanel::ApplyChanges()
             config_PutPsz( p_intf, control->GetName().mb_str(),
                            control->GetPszValue().mb_str() );
             break;
-        case CONFIG_ITEM_INTEGER:
         case CONFIG_ITEM_KEY:
+            /* So you don't need to restart to have the changes take effect */
+            val.i_int = control->GetIntValue();
+            var_Set( p_intf->p_vlc, control->GetName().mb_str(), val );
+        case CONFIG_ITEM_INTEGER:
         case CONFIG_ITEM_BOOL:
             config_PutInt( p_intf, control->GetName().mb_str(),
                            control->GetIntValue() );
index 56570f67936485b5396534c828b3478851e79a40..0546eb36e9b348f450cda0dd1a535da0db016d86 100644 (file)
@@ -2,7 +2,7 @@
  * events.c: Windows DirectX video output events handler
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: events.c,v 1.25 2003/10/28 17:02:14 gbazin Exp $
+ * $Id: events.c,v 1.26 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -220,15 +220,7 @@ void DirectXEventThread( event_thread_t *p_event )
                     val.i_int |= KEY_MODIFIER_ALT;
                 }
 
-                if( val.i_int == config_GetInt( p_event, "fullscreen-key" ) )
-                {
-                    p_event->p_vout->p_sys->i_changes |=
-                        VOUT_FULLSCREEN_CHANGE;
-                }
-                else
-                {
-                    var_Set( p_event->p_vlc, "key-pressed", val );
-                }
+                var_Set( p_event->p_vlc, "key-pressed", val );
             }
             break;
 
index fd8b01c547f3631f18f272daa8cf514873785066..63e56f249939645192ded2aecfc9570899a7d088 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.37 2003/10/28 21:59:12 gbazin Exp $
+ * $Id: xcommon.c,v 1.38 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -555,15 +555,7 @@ static int ManageVideo( vout_thread_t *p_vout )
                 {
                     val.i_int |= KEY_MODIFIER_ALT;
                 }
-
-                if( val.i_int == config_GetInt( p_vout, "fullscreen-key" ) )
-                {
-                    p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
-                }
-                else
-                {
-                    var_Set( p_vout->p_vlc, "key-pressed", val );
-                }
+                var_Set( p_vout->p_vlc, "key-pressed", val );
             }
         }
         /* Mouse click */
index a23dfea2dd54ce98e5d1d2d0e6d242541567f8dd..9139ebcb149f16378e98a732bccbc999058ceaff 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: input.c,v 1.249 2003/10/22 17:12:31 gbazin Exp $
+ * $Id: input.c,v 1.250 2003/10/29 01:33:26 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -667,8 +667,10 @@ static int InitThread( input_thread_t * p_input )
 
     /* If the desynchronisation requested by the user is < 0, we need to
      * cache more data. */
-    if( p_input->p_vlc->i_desync < 0 )
-        p_input->i_pts_delay -= p_input->p_vlc->i_desync;
+    var_Create( p_input, "audio-desync", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Get( p_input, "audio-desync", &val );
+    if( val.i_int < 0 )
+        p_input->i_pts_delay -= (val.i_int * 1000);
 
     if( p_input->p_current_data == NULL && p_input->pf_read != NULL )
     {
index fd50471d582ba0fb03952a47b639acfa9ccdfdc2..836f0d013a2b074afc1b4c257ffa312ee8a95acf 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.c: main libvlc source
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.c,v 1.100 2003/10/27 21:54:10 gbazin Exp $
+ * $Id: libvlc.c,v 1.101 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -567,6 +567,10 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
      * Initialize hotkey handling
      */
     var_Create( p_vlc, "key-pressed", VLC_VAR_INTEGER );
+    p_vlc->p_hotkeys = malloc( sizeof(p_hotkeys) );
+    /* Do a copy (we don't need to modify the strings) */
+    p_vlc->p_hotkeys = p_hotkeys;
+
     /*
      * Initialize playlist and get commandline files
      */
index 4c6e70b1346ffa86090a7d3318dd4cdcdf79099e..39aabbc7d0264069bdac0696b9013248816484ec 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.97 2003/10/27 21:54:10 gbazin Exp $
+ * $Id: libvlc.h,v 1.98 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -719,23 +719,23 @@ vlc_module_begin();
 
     /* Hotkey options*/
     add_category_hint( N_("Hot keys"), HOTKEY_CAT_LONGTEXT , VLC_FALSE );
-    add_key( "fullscreen-key", 'f', NULL, FULLSCREEN_KEY_TEXT, FULLSCREEN_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "play-pause-key", KEY_SPACE, NULL, PLAY_PAUSE_KEY_TEXT, PLAY_PAUSE_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "pause-key", 0, NULL, PAUSE_KEY_TEXT, PAUSE_KEY_LONGTEXT, VLC_TRUE );
-    add_key( "play-key", 0, NULL, PLAY_KEY_TEXT, PLAY_KEY_LONGTEXT, VLC_TRUE );
-    add_key( "faster-key", '+', NULL, FASTER_KEY_TEXT, FASTER_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "slower-key", '-', NULL, SLOWER_KEY_TEXT, SLOWER_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "next-key", 'n', NULL, NEXT_KEY_TEXT, NEXT_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "prev-key", 'p', NULL, PREV_KEY_TEXT, PREV_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "stop-key", 's', NULL, STOP_KEY_TEXT, STOP_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "nav-activate-key", KEY_ENTER, NULL, NAV_ACTIVATE_KEY_TEXT, NAV_ACTIVATE_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "nav-up-key", KEY_UP, NULL, NAV_UP_KEY_TEXT, NAV_UP_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "nav-down-key", KEY_DOWN, NULL, NAV_DOWN_KEY_TEXT, NAV_DOWN_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "nav-left-key", KEY_LEFT, NULL, NAV_LEFT_KEY_TEXT, NAV_LEFT_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "nav-right-key", KEY_RIGHT, NULL, NAV_RIGHT_KEY_TEXT, NAV_RIGHT_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "quit-key", KEY_MODIFIER_CTRL|KEY_SPACE, NULL, QUIT_KEY_TEXT, QUIT_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "vol-up-key", 'a', NULL, VOL_UP_KEY_TEXT, VOL_UP_KEY_LONGTEXT, VLC_FALSE );
-    add_key( "vol-down-key", 'z', NULL, VOL_DOWN_KEY_TEXT, VOL_DOWN_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-fullscreen", 'f', NULL, FULLSCREEN_KEY_TEXT, FULLSCREEN_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-play-pause", KEY_SPACE, NULL, PLAY_PAUSE_KEY_TEXT, PLAY_PAUSE_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-pause", 0, NULL, PAUSE_KEY_TEXT, PAUSE_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "key-play", 0, NULL, PLAY_KEY_TEXT, PLAY_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "key-faster", '+', NULL, FASTER_KEY_TEXT, FASTER_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-slower", '-', NULL, SLOWER_KEY_TEXT, SLOWER_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-next", 'n', NULL, NEXT_KEY_TEXT, NEXT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-prev", 'p', NULL, PREV_KEY_TEXT, PREV_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-stop", 's', NULL, STOP_KEY_TEXT, STOP_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-nav-activate", KEY_ENTER, NULL, NAV_ACTIVATE_KEY_TEXT, NAV_ACTIVATE_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-nav-up", KEY_UP, NULL, NAV_UP_KEY_TEXT, NAV_UP_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-nav-down", KEY_DOWN, NULL, NAV_DOWN_KEY_TEXT, NAV_DOWN_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-nav-left", KEY_LEFT, NULL, NAV_LEFT_KEY_TEXT, NAV_LEFT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-nav-right", KEY_RIGHT, NULL, NAV_RIGHT_KEY_TEXT, NAV_RIGHT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-quit", KEY_MODIFIER_CTRL|KEY_SPACE, NULL, QUIT_KEY_TEXT, QUIT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-vol-up", 'a', NULL, VOL_UP_KEY_TEXT, VOL_UP_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "key-vol-down", 'z', NULL, VOL_DOWN_KEY_TEXT, VOL_DOWN_KEY_LONGTEXT, VLC_FALSE );
 
     /* Usage (mainly useful for cmd line stuff) */
     add_usage_hint( PLAYLIST_USAGE );
@@ -768,3 +768,28 @@ static module_config_t p_help_config[] =
 /*****************************************************************************
  * End configuration.
  *****************************************************************************/
+
+/*****************************************************************************
+ * Initializer for the vlc_t structure storing the action / key associations
+ *****************************************************************************/
+static struct hotkey p_hotkeys[] =
+{
+    { "key-quit", ACTIONID_QUIT, 0 },
+    { "key-play-pause", ACTIONID_PLAY_PAUSE, 0 },
+    { "key-play", ACTIONID_PLAY, 0 },
+    { "key-pause", ACTIONID_PAUSE, 0 },
+    { "key-stop", ACTIONID_STOP, 0 },
+    { "key-prev", ACTIONID_PREV, 0 },
+    { "key-next", ACTIONID_NEXT, 0 },
+    { "key-faster", ACTIONID_FASTER, 0 },
+    { "key-slower", ACTIONID_SLOWER, 0 },
+    { "key-fullscreen", ACTIONID_FULLSCREEN, 0 },
+    { "key-vol-up", ACTIONID_VOL_UP, 0 },
+    { "key-vol-down", ACTIONID_VOL_DOWN, 0 },
+    { "key-nav-activate", ACTIONID_NAV_ACTIVATE, 0 },
+    { "key-nav-up", ACTIONID_NAV_UP, 0 },
+    { "key-nav-down", ACTIONID_NAV_DOWN, 0 },
+    { "key-nav-left", ACTIONID_NAV_LEFT, 0 },
+    { "key-nav-right", ACTIONID_NAV_RIGHT, 0 },
+    { NULL, 0, 0 }
+};
index b93c51d8fc55c614dcbf5f8a2fff906251fb12d5..6be2cf5e89230fba0a47126fe53b8859f9e6ac06 100644 (file)
@@ -2,7 +2,7 @@
  * configuration.c management of the modules configuration
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.65 2003/09/24 21:31:54 gbazin Exp $
+ * $Id: configuration.c,v 1.66 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -1142,8 +1142,6 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
     p_this->p_vlc->i_argc    = *pi_argc;
     p_this->p_vlc->ppsz_argv = ppsz_argv;
 
-    p_this->p_vlc->p_channel = NULL;
-
 #ifdef SYS_DARWIN
     /* When vlc.app is run by double clicking in Mac OS X, the 2nd arg
      * is the PSN - process serial number (a unique PID-ish thingie)
index 8ba5ed5a7cb447c19991c6e352c143508f208966..49ecd73f63a4d4c1ca9d8b8a5de938f2dc0bfd95 100644 (file)
@@ -2,7 +2,7 @@
  * variables.c: routines for object variables handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: variables.c,v 1.32 2003/10/22 17:12:31 gbazin Exp $
+ * $Id: variables.c,v 1.33 2003/10/29 01:33:27 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -220,6 +220,7 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
             p_var->val.b_bool = VLC_FALSE;
             break;
         case VLC_VAR_INTEGER:
+        case VLC_VAR_HOTKEY:
             p_var->pf_cmp = CmpInt;
             p_var->val.i_int = 0;
             break;
@@ -1162,6 +1163,7 @@ static int InheritValue( vlc_object_t *p_this, const char *psz_name,
             p_val->f_float = config_GetFloat( p_this, psz_name );
             break;
         case VLC_VAR_INTEGER:
+        case VLC_VAR_HOTKEY:
             p_val->i_int = config_GetInt( p_this, psz_name );
             break;
         case VLC_VAR_BOOL: