core: rename vlc_keys.h to vlc_actions.h
authorThomas Guillem <thomas@gllm.fr>
Thu, 3 Aug 2017 13:10:35 +0000 (15:10 +0200)
committerHugo Beauzée-Luyssen <hugo@beauzee.fr>
Wed, 9 Aug 2017 08:48:01 +0000 (10:48 +0200)
Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
48 files changed:
include/vlc_actions.h [new file with mode: 0644]
include/vlc_keys.h [deleted file]
include/vlc_vout_display.h
lib/media_player.c
modules/audio_filter/channel_mixer/spatialaudio.cpp
modules/control/globalhotkeys/win32.c
modules/control/globalhotkeys/xcb.c
modules/control/hotkeys.c
modules/control/lirc.c
modules/control/oldrc.c
modules/demux/mkv/demux.cpp
modules/gui/macosx/VLCCoreInteraction.m
modules/gui/macosx/VLCMain.m
modules/gui/macosx/VLCPlaylist.m
modules/gui/macosx/VLCSimplePrefsController.m
modules/gui/macosx/VLCStringUtility.m
modules/gui/macosx/VLCVoutView.m
modules/gui/macosx/misc.m
modules/gui/macosx/prefs.m
modules/gui/macosx/prefs_widgets.m
modules/gui/qt/actions_manager.cpp
modules/gui/qt/components/preferences_widgets.cpp
modules/gui/qt/input_manager.cpp
modules/gui/qt/main_interface.cpp
modules/gui/qt/util/customwidgets.cpp
modules/gui/skins2/controls/ctrl_list.cpp
modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/events/evt_input.cpp
modules/gui/skins2/events/evt_key.cpp
modules/gui/skins2/events/evt_key.hpp
modules/gui/skins2/os2/os2_loop.cpp
modules/gui/skins2/src/top_window.cpp
modules/gui/skins2/src/vout_manager.hpp
modules/gui/skins2/src/vout_window.cpp
modules/gui/skins2/win32/win32_loop.cpp
modules/gui/skins2/x11/x11_loop.cpp
modules/lua/libs/misc.c
modules/spu/remoteosd.c
modules/video_output/win32/win32touch.c
modules/video_output/xcb/keys.c
po/POTFILES.in
src/Makefile.am
src/config/cmdline.c
src/config/core.c
src/config/file.c
src/config/keys.c [deleted file]
src/libvlc-module.c
src/misc/actions.c [new file with mode: 0644]

diff --git a/include/vlc_actions.h b/include/vlc_actions.h
new file mode 100644 (file)
index 0000000..c3f4172
--- /dev/null
@@ -0,0 +1,249 @@
+/*****************************************************************************
+ * vlc_actions.h: handle vlc actions
+ *****************************************************************************
+ * Copyright (C) 2003-2016 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_ACTIONS_H
+#define VLC_ACTIONS_H 1
+
+/**
+ * \file
+ * This file defines keys and functions
+ */
+
+#define KEY_MODIFIER         0xFF000000
+#define KEY_MODIFIER_ALT     0x01000000
+#define KEY_MODIFIER_SHIFT   0x02000000
+#define KEY_MODIFIER_CTRL    0x04000000
+#define KEY_MODIFIER_META    0x08000000
+#define KEY_MODIFIER_COMMAND 0x10000000
+
+#define KEY_UNSET            0x00000000
+#define KEY_BACKSPACE              0x08
+#define KEY_TAB                    0x09
+#define KEY_ENTER                  0x0D
+#define KEY_ESC                    0x1B
+/* End of Unicode range:     0x0010FFFF */
+#define KEY_LEFT             0x00210000
+#define KEY_RIGHT            0x00220000
+#define KEY_UP               0x00230000
+#define KEY_DOWN             0x00240000
+#define KEY_F1               0x00270000
+#define KEY_F2               0x00280000
+#define KEY_F3               0x00290000
+#define KEY_F4               0x002A0000
+#define KEY_F5               0x002B0000
+#define KEY_F6               0x002C0000
+#define KEY_F7               0x002D0000
+#define KEY_F8               0x002E0000
+#define KEY_F9               0x002F0000
+#define KEY_F10              0x00300000
+#define KEY_F11              0x00310000
+#define KEY_F12              0x00320000
+#define KEY_HOME             0x00330000
+#define KEY_END              0x00340000
+#define KEY_INSERT           0x00350000
+#define KEY_DELETE           0x00360000
+#define KEY_MENU             0x00370000
+#define KEY_PAGEUP           0x00390000
+#define KEY_PAGEDOWN         0x003A0000
+#define KEY_PRINT            0x003B0000
+#define KEY_PAUSE            0x003D0000
+
+#define KEY_BROWSER_BACK     0x003F0000
+#define KEY_BROWSER_FORWARD  0x00400000
+#define KEY_BROWSER_REFRESH  0x00410000
+#define KEY_BROWSER_STOP     0x00420000
+#define KEY_BROWSER_SEARCH   0x00430000
+#define KEY_BROWSER_FAVORITES 0x00440000
+#define KEY_BROWSER_HOME     0x00450000
+#define KEY_VOLUME_MUTE      0x00460000
+#define KEY_VOLUME_DOWN      0x00470000
+#define KEY_VOLUME_UP        0x00480000
+#define KEY_MEDIA_NEXT_TRACK 0x00490000
+#define KEY_MEDIA_PREV_TRACK 0x004A0000
+#define KEY_MEDIA_STOP       0x004B0000
+#define KEY_MEDIA_PLAY_PAUSE 0x004C0000
+#define KEY_MEDIA_RECORD     0x004D0000
+#define KEY_MEDIA_REWIND     0x004E0000
+#define KEY_MEDIA_FORWARD    0x004F0000
+#define KEY_MEDIA_REPEAT     0x00500000
+#define KEY_MEDIA_SHUFFLE    0x00510000
+#define KEY_MEDIA_SUBTITLE   0x00520000
+#define KEY_MEDIA_AUDIO      0x00530000
+#define KEY_MEDIA_ANGLE      0x00540000
+#define KEY_MEDIA_TIME       0x00550000
+#define KEY_MEDIA_FRAME_PREV 0x00560000
+#define KEY_MEDIA_FRAME_NEXT 0x00570000
+#define KEY_MEDIA_SELECT     0x00580000
+#define KEY_MEDIA_VIEW       0x00590000
+#define KEY_MEDIA_MENU       0x005A0000
+#define KEY_ZOOM_IN          0x00600000
+#define KEY_ZOOM_OUT         0x00610000
+#define KEY_BRIGHTNESS_UP    0x00620000
+#define KEY_BRIGHTNESS_DOWN  0x00630000
+
+#define KEY_MOUSEWHEELUP     0x00F00000
+#define KEY_MOUSEWHEELDOWN   0x00F10000
+#define KEY_MOUSEWHEELLEFT   0x00F20000
+#define KEY_MOUSEWHEELRIGHT  0x00F30000
+
+VLC_API char *vlc_keycode2str(uint_fast32_t i_key, bool locale) VLC_USED;
+VLC_API uint_fast32_t vlc_str2keycode(const char *str) VLC_USED;
+
+typedef enum vlc_action_id {
+    ACTIONID_NONE = 0,
+    ACTIONID_QUIT,
+    ACTIONID_PLAY_PAUSE,
+    ACTIONID_PLAY,
+    ACTIONID_PAUSE,
+    ACTIONID_STOP,
+    ACTIONID_PREV,
+    ACTIONID_NEXT,
+    ACTIONID_SLOWER,
+    ACTIONID_FASTER,
+    ACTIONID_TOGGLE_FULLSCREEN,
+    ACTIONID_VOL_UP,
+    ACTIONID_VOL_DOWN,
+    ACTIONID_NAV_ACTIVATE,
+    ACTIONID_NAV_UP,
+    ACTIONID_NAV_DOWN,
+    ACTIONID_NAV_LEFT,
+    ACTIONID_NAV_RIGHT,
+    ACTIONID_JUMP_BACKWARD_EXTRASHORT,
+    ACTIONID_JUMP_FORWARD_EXTRASHORT,
+    ACTIONID_JUMP_BACKWARD_SHORT,
+    ACTIONID_JUMP_FORWARD_SHORT,
+    ACTIONID_JUMP_BACKWARD_MEDIUM,
+    ACTIONID_JUMP_FORWARD_MEDIUM,
+    ACTIONID_JUMP_BACKWARD_LONG,
+    ACTIONID_JUMP_FORWARD_LONG,
+    ACTIONID_FRAME_NEXT,
+    ACTIONID_POSITION,
+    ACTIONID_VOL_MUTE,
+/* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
+    ACTIONID_SET_BOOKMARK1,
+    ACTIONID_SET_BOOKMARK2,
+    ACTIONID_SET_BOOKMARK3,
+    ACTIONID_SET_BOOKMARK4,
+    ACTIONID_SET_BOOKMARK5,
+    ACTIONID_SET_BOOKMARK6,
+    ACTIONID_SET_BOOKMARK7,
+    ACTIONID_SET_BOOKMARK8,
+    ACTIONID_SET_BOOKMARK9,
+    ACTIONID_SET_BOOKMARK10,
+    ACTIONID_PLAY_BOOKMARK1,
+    ACTIONID_PLAY_BOOKMARK2,
+    ACTIONID_PLAY_BOOKMARK3,
+    ACTIONID_PLAY_BOOKMARK4,
+    ACTIONID_PLAY_BOOKMARK5,
+    ACTIONID_PLAY_BOOKMARK6,
+    ACTIONID_PLAY_BOOKMARK7,
+    ACTIONID_PLAY_BOOKMARK8,
+    ACTIONID_PLAY_BOOKMARK9,
+    ACTIONID_PLAY_BOOKMARK10,
+    /* end of contiguous zone */
+    ACTIONID_PLAY_CLEAR,
+    ACTIONID_SUBDELAY_UP,
+    ACTIONID_SUBDELAY_DOWN,
+    ACTIONID_SUBSYNC_MARKAUDIO,
+    ACTIONID_SUBSYNC_MARKSUB,
+    ACTIONID_SUBSYNC_APPLY,
+    ACTIONID_SUBSYNC_RESET,
+    ACTIONID_SUBPOS_UP,
+    ACTIONID_SUBPOS_DOWN,
+    ACTIONID_AUDIO_TRACK,
+    ACTIONID_SUBTITLE_REVERSE_TRACK,
+    ACTIONID_SUBTITLE_TRACK,
+    ACTIONID_SUBTITLE_TOGGLE,
+    ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL,
+    ACTIONID_SUBTITLE_TEXT_SCALE_UP,
+    ACTIONID_SUBTITLE_TEXT_SCALE_DOWN,
+    ACTIONID_INTF_TOGGLE_FSC,
+    ACTIONID_INTF_HIDE,
+    ACTIONID_INTF_BOSS,
+    /* chapter and title navigation */
+    ACTIONID_TITLE_PREV,
+    ACTIONID_TITLE_NEXT,
+    ACTIONID_CHAPTER_PREV,
+    ACTIONID_CHAPTER_NEXT,
+    /* end of chapter and title navigation */
+    ACTIONID_AUDIODELAY_UP,
+    ACTIONID_AUDIODELAY_DOWN,
+    ACTIONID_SNAPSHOT,
+    ACTIONID_RECORD,
+    ACTIONID_DISC_MENU,
+    ACTIONID_ASPECT_RATIO,
+    ACTIONID_CROP,
+    ACTIONID_DEINTERLACE,
+    ACTIONID_DEINTERLACE_MODE,
+    ACTIONID_ZOOM,
+    ACTIONID_UNZOOM,
+    ACTIONID_CROP_TOP,
+    ACTIONID_UNCROP_TOP,
+    ACTIONID_CROP_LEFT,
+    ACTIONID_UNCROP_LEFT,
+    ACTIONID_CROP_BOTTOM,
+    ACTIONID_UNCROP_BOTTOM,
+    ACTIONID_CROP_RIGHT,
+    ACTIONID_UNCROP_RIGHT,
+    ACTIONID_RANDOM,
+    ACTIONID_LOOP,
+    ACTIONID_WALLPAPER,
+    ACTIONID_LEAVE_FULLSCREEN,
+    /* Zoom */
+    ACTIONID_ZOOM_QUARTER,
+    ACTIONID_ZOOM_HALF,
+    ACTIONID_ZOOM_ORIGINAL,
+    ACTIONID_ZOOM_DOUBLE,
+    /* Cycle Through Audio Devices */
+    ACTIONID_AUDIODEVICE_CYCLE,
+    /* scaling */
+    ACTIONID_TOGGLE_AUTOSCALE,
+    ACTIONID_SCALE_UP,
+    ACTIONID_SCALE_DOWN,
+    /* */
+    ACTIONID_RATE_NORMAL,
+    ACTIONID_RATE_SLOWER_FINE,
+    ACTIONID_RATE_FASTER_FINE,
+    /* Cycle Through Program Service IDs */
+    ACTIONID_PROGRAM_SID_NEXT,
+    ACTIONID_PROGRAM_SID_PREV,
+    ACTIONID_INTF_POPUP_MENU,
+    /* Viewpoint */
+    ACTIONID_VIEWPOINT_FOV_IN,
+    ACTIONID_VIEWPOINT_FOV_OUT,
+    ACTIONID_VIEWPOINT_ROLL_CLOCK,
+    ACTIONID_VIEWPOINT_ROLL_ANTICLOCK,
+    /* Combo Actions */
+    ACTIONID_COMBO_VOL_FOV_UP,
+    ACTIONID_COMBO_VOL_FOV_DOWN,
+
+} vlc_action_id_t;
+
+VLC_API vlc_action_id_t vlc_GetActionId(const char *psz_key) VLC_USED;
+
+struct hotkey
+{
+    const char *psz_action;
+};
+
+#endif
diff --git a/include/vlc_keys.h b/include/vlc_keys.h
deleted file mode 100644 (file)
index 3744af0..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/*****************************************************************************
- * vlc_keys.h: keycode defines
- *****************************************************************************
- * Copyright (C) 2003-2009 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef VLC_KEYS_H
-#define VLC_KEYS_H 1
-
-/**
- * \file
- * This file defines keys and functions
- */
-
-#define KEY_MODIFIER         0xFF000000
-#define KEY_MODIFIER_ALT     0x01000000
-#define KEY_MODIFIER_SHIFT   0x02000000
-#define KEY_MODIFIER_CTRL    0x04000000
-#define KEY_MODIFIER_META    0x08000000
-#define KEY_MODIFIER_COMMAND 0x10000000
-
-#define KEY_UNSET            0x00000000
-#define KEY_BACKSPACE              0x08
-#define KEY_TAB                    0x09
-#define KEY_ENTER                  0x0D
-#define KEY_ESC                    0x1B
-/* End of Unicode range:     0x0010FFFF */
-#define KEY_LEFT             0x00210000
-#define KEY_RIGHT            0x00220000
-#define KEY_UP               0x00230000
-#define KEY_DOWN             0x00240000
-#define KEY_F1               0x00270000
-#define KEY_F2               0x00280000
-#define KEY_F3               0x00290000
-#define KEY_F4               0x002A0000
-#define KEY_F5               0x002B0000
-#define KEY_F6               0x002C0000
-#define KEY_F7               0x002D0000
-#define KEY_F8               0x002E0000
-#define KEY_F9               0x002F0000
-#define KEY_F10              0x00300000
-#define KEY_F11              0x00310000
-#define KEY_F12              0x00320000
-#define KEY_HOME             0x00330000
-#define KEY_END              0x00340000
-#define KEY_INSERT           0x00350000
-#define KEY_DELETE           0x00360000
-#define KEY_MENU             0x00370000
-#define KEY_PAGEUP           0x00390000
-#define KEY_PAGEDOWN         0x003A0000
-#define KEY_PRINT            0x003B0000
-#define KEY_PAUSE            0x003D0000
-
-#define KEY_BROWSER_BACK     0x003F0000
-#define KEY_BROWSER_FORWARD  0x00400000
-#define KEY_BROWSER_REFRESH  0x00410000
-#define KEY_BROWSER_STOP     0x00420000
-#define KEY_BROWSER_SEARCH   0x00430000
-#define KEY_BROWSER_FAVORITES 0x00440000
-#define KEY_BROWSER_HOME     0x00450000
-#define KEY_VOLUME_MUTE      0x00460000
-#define KEY_VOLUME_DOWN      0x00470000
-#define KEY_VOLUME_UP        0x00480000
-#define KEY_MEDIA_NEXT_TRACK 0x00490000
-#define KEY_MEDIA_PREV_TRACK 0x004A0000
-#define KEY_MEDIA_STOP       0x004B0000
-#define KEY_MEDIA_PLAY_PAUSE 0x004C0000
-#define KEY_MEDIA_RECORD     0x004D0000
-#define KEY_MEDIA_REWIND     0x004E0000
-#define KEY_MEDIA_FORWARD    0x004F0000
-#define KEY_MEDIA_REPEAT     0x00500000
-#define KEY_MEDIA_SHUFFLE    0x00510000
-#define KEY_MEDIA_SUBTITLE   0x00520000
-#define KEY_MEDIA_AUDIO      0x00530000
-#define KEY_MEDIA_ANGLE      0x00540000
-#define KEY_MEDIA_TIME       0x00550000
-#define KEY_MEDIA_FRAME_PREV 0x00560000
-#define KEY_MEDIA_FRAME_NEXT 0x00570000
-#define KEY_MEDIA_SELECT     0x00580000
-#define KEY_MEDIA_VIEW       0x00590000
-#define KEY_MEDIA_MENU       0x005A0000
-#define KEY_ZOOM_IN          0x00600000
-#define KEY_ZOOM_OUT         0x00610000
-#define KEY_BRIGHTNESS_UP    0x00620000
-#define KEY_BRIGHTNESS_DOWN  0x00630000
-
-#define KEY_MOUSEWHEELUP     0x00F00000
-#define KEY_MOUSEWHEELDOWN   0x00F10000
-#define KEY_MOUSEWHEELLEFT   0x00F20000
-#define KEY_MOUSEWHEELRIGHT  0x00F30000
-
-VLC_API char *vlc_keycode2str(uint_fast32_t i_key, bool locale) VLC_USED;
-VLC_API uint_fast32_t vlc_str2keycode(const char *str) VLC_USED;
-
-typedef enum vlc_action_id {
-    ACTIONID_NONE = 0,
-    ACTIONID_QUIT,
-    ACTIONID_PLAY_PAUSE,
-    ACTIONID_PLAY,
-    ACTIONID_PAUSE,
-    ACTIONID_STOP,
-    ACTIONID_PREV,
-    ACTIONID_NEXT,
-    ACTIONID_SLOWER,
-    ACTIONID_FASTER,
-    ACTIONID_TOGGLE_FULLSCREEN,
-    ACTIONID_VOL_UP,
-    ACTIONID_VOL_DOWN,
-    ACTIONID_NAV_ACTIVATE,
-    ACTIONID_NAV_UP,
-    ACTIONID_NAV_DOWN,
-    ACTIONID_NAV_LEFT,
-    ACTIONID_NAV_RIGHT,
-    ACTIONID_JUMP_BACKWARD_EXTRASHORT,
-    ACTIONID_JUMP_FORWARD_EXTRASHORT,
-    ACTIONID_JUMP_BACKWARD_SHORT,
-    ACTIONID_JUMP_FORWARD_SHORT,
-    ACTIONID_JUMP_BACKWARD_MEDIUM,
-    ACTIONID_JUMP_FORWARD_MEDIUM,
-    ACTIONID_JUMP_BACKWARD_LONG,
-    ACTIONID_JUMP_FORWARD_LONG,
-    ACTIONID_FRAME_NEXT,
-    ACTIONID_POSITION,
-    ACTIONID_VOL_MUTE,
-/* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
-    ACTIONID_SET_BOOKMARK1,
-    ACTIONID_SET_BOOKMARK2,
-    ACTIONID_SET_BOOKMARK3,
-    ACTIONID_SET_BOOKMARK4,
-    ACTIONID_SET_BOOKMARK5,
-    ACTIONID_SET_BOOKMARK6,
-    ACTIONID_SET_BOOKMARK7,
-    ACTIONID_SET_BOOKMARK8,
-    ACTIONID_SET_BOOKMARK9,
-    ACTIONID_SET_BOOKMARK10,
-    ACTIONID_PLAY_BOOKMARK1,
-    ACTIONID_PLAY_BOOKMARK2,
-    ACTIONID_PLAY_BOOKMARK3,
-    ACTIONID_PLAY_BOOKMARK4,
-    ACTIONID_PLAY_BOOKMARK5,
-    ACTIONID_PLAY_BOOKMARK6,
-    ACTIONID_PLAY_BOOKMARK7,
-    ACTIONID_PLAY_BOOKMARK8,
-    ACTIONID_PLAY_BOOKMARK9,
-    ACTIONID_PLAY_BOOKMARK10,
-    /* end of contiguous zone */
-    ACTIONID_PLAY_CLEAR,
-    ACTIONID_SUBDELAY_UP,
-    ACTIONID_SUBDELAY_DOWN,
-    ACTIONID_SUBSYNC_MARKAUDIO,
-    ACTIONID_SUBSYNC_MARKSUB,
-    ACTIONID_SUBSYNC_APPLY,
-    ACTIONID_SUBSYNC_RESET,
-    ACTIONID_SUBPOS_UP,
-    ACTIONID_SUBPOS_DOWN,
-    ACTIONID_AUDIO_TRACK,
-    ACTIONID_SUBTITLE_REVERSE_TRACK,
-    ACTIONID_SUBTITLE_TRACK,
-    ACTIONID_SUBTITLE_TOGGLE,
-    ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL,
-    ACTIONID_SUBTITLE_TEXT_SCALE_UP,
-    ACTIONID_SUBTITLE_TEXT_SCALE_DOWN,
-    ACTIONID_INTF_TOGGLE_FSC,
-    ACTIONID_INTF_HIDE,
-    ACTIONID_INTF_BOSS,
-    /* chapter and title navigation */
-    ACTIONID_TITLE_PREV,
-    ACTIONID_TITLE_NEXT,
-    ACTIONID_CHAPTER_PREV,
-    ACTIONID_CHAPTER_NEXT,
-    /* end of chapter and title navigation */
-    ACTIONID_AUDIODELAY_UP,
-    ACTIONID_AUDIODELAY_DOWN,
-    ACTIONID_SNAPSHOT,
-    ACTIONID_RECORD,
-    ACTIONID_DISC_MENU,
-    ACTIONID_ASPECT_RATIO,
-    ACTIONID_CROP,
-    ACTIONID_DEINTERLACE,
-    ACTIONID_DEINTERLACE_MODE,
-    ACTIONID_ZOOM,
-    ACTIONID_UNZOOM,
-    ACTIONID_CROP_TOP,
-    ACTIONID_UNCROP_TOP,
-    ACTIONID_CROP_LEFT,
-    ACTIONID_UNCROP_LEFT,
-    ACTIONID_CROP_BOTTOM,
-    ACTIONID_UNCROP_BOTTOM,
-    ACTIONID_CROP_RIGHT,
-    ACTIONID_UNCROP_RIGHT,
-    ACTIONID_RANDOM,
-    ACTIONID_LOOP,
-    ACTIONID_WALLPAPER,
-    ACTIONID_LEAVE_FULLSCREEN,
-    /* Zoom */
-    ACTIONID_ZOOM_QUARTER,
-    ACTIONID_ZOOM_HALF,
-    ACTIONID_ZOOM_ORIGINAL,
-    ACTIONID_ZOOM_DOUBLE,
-    /* Cycle Through Audio Devices */
-    ACTIONID_AUDIODEVICE_CYCLE,
-    /* scaling */
-    ACTIONID_TOGGLE_AUTOSCALE,
-    ACTIONID_SCALE_UP,
-    ACTIONID_SCALE_DOWN,
-    /* */
-    ACTIONID_RATE_NORMAL,
-    ACTIONID_RATE_SLOWER_FINE,
-    ACTIONID_RATE_FASTER_FINE,
-    /* Cycle Through Program Service IDs */
-    ACTIONID_PROGRAM_SID_NEXT,
-    ACTIONID_PROGRAM_SID_PREV,
-    ACTIONID_INTF_POPUP_MENU,
-    /* Viewpoint */
-    ACTIONID_VIEWPOINT_FOV_IN,
-    ACTIONID_VIEWPOINT_FOV_OUT,
-    ACTIONID_VIEWPOINT_ROLL_CLOCK,
-    ACTIONID_VIEWPOINT_ROLL_ANTICLOCK,
-    /* Combo Actions */
-    ACTIONID_COMBO_VOL_FOV_UP,
-    ACTIONID_COMBO_VOL_FOV_DOWN,
-
-} vlc_action_id_t;
-
-VLC_API vlc_action_id_t vlc_GetActionId(const char *psz_key) VLC_USED;
-
-struct hotkey
-{
-    const char *psz_action;
-};
-
-#endif
index 23f7c0b..e612bac 100644 (file)
@@ -28,7 +28,7 @@
 #include <vlc_picture.h>
 #include <vlc_picture_pool.h>
 #include <vlc_subpicture.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_mouse.h>
 #include <vlc_vout.h>
 #include <vlc_vout_window.h>
index 45ce1c4..6563295 100644 (file)
@@ -35,7 +35,7 @@
 #include <vlc_input.h>
 #include <vlc_vout.h>
 #include <vlc_aout.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #include "libvlc_internal.h"
 #include "media_internal.h" // libvlc_media_set_state()
index 4ac8555..59d2c63 100644 (file)
@@ -35,7 +35,6 @@
 #include <vlc_aout.h>
 #include <vlc_filter.h>
 #include <vlc_viewpoint.h>
-#include <vlc_keys.h>
 
 #include <new>
 #include <vector>
index 15d4714..56a28b5 100644 (file)
@@ -30,7 +30,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_interface.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 /*****************************************************************************
  * Local prototypes
index aceb3cb..d4c335d 100644 (file)
@@ -27,7 +27,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_interface.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <errno.h>
 
 #include <xcb/xcb.h>
index 195bb22..26520bd 100644 (file)
@@ -39,7 +39,7 @@
 #include <vlc_viewpoint.h>
 #include <vlc_vout_osd.h>
 #include <vlc_playlist.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include "math.h"
 
 #include <assert.h>
index b27ef9d..7352c5e 100644 (file)
@@ -36,7 +36,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_interface.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #ifdef HAVE_POLL
 # include <poll.h>
index b09a11c..150e4b0 100644 (file)
@@ -43,7 +43,7 @@
 #include <vlc_aout.h>
 #include <vlc_vout.h>
 #include <vlc_playlist.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #include <sys/types.h>
 #include <unistd.h>
index 56248e8..97be3fd 100644 (file)
@@ -27,7 +27,7 @@
 #include "stream_io_callback.hpp"
 #include "Ebml_parser.hpp"
 
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 event_thread_t::event_thread_t(demux_t *p_demux) : p_demux(p_demux)
 {
index deeeca9..ab78b04 100644 (file)
@@ -28,7 +28,7 @@
 #import <math.h>
 #import <vlc_playlist.h>
 #import <vlc_input.h>
-#import <vlc_keys.h>
+#import <vlc_actions.h>
 #import <vlc_vout.h>
 #import <vlc_vout_osd.h>
 #import <vlc/vlc.h>
index 6b4a4d2..43c8849 100644 (file)
@@ -37,7 +37,7 @@
 #include <string.h>
 #include <vlc_common.h>
 #include <vlc_atomic.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_dialog.h>
 #include <vlc_url.h>
 #include <vlc_variables.h>
index 9d1c54d..abd6cde 100644 (file)
@@ -48,7 +48,7 @@
 #import "VLCResumeDialogController.h"
 #import "VLCOpenWindowController.h"
 
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #import <vlc_interface.h>
 #include <vlc_url.h>
 
index d9d2e2f..422dbda 100644 (file)
@@ -27,7 +27,7 @@
 #import "CompatibilityFixes.h"
 #import "VLCSimplePrefsController.h"
 #import "prefs.h"
-#import <vlc_keys.h>
+#import <vlc_actions.h>
 #import <vlc_interface.h>
 #import <vlc_dialog.h>
 #import <vlc_modules.h>
index 16b80eb..742e045 100644 (file)
@@ -43,7 +43,7 @@ NSString *const kVLCMediaVideoTSFolder = @"VIDEO_TS";
 NSString *const kVLCMediaBDMVFolder = @"BDMV";
 NSString *const kVLCMediaUnknown = @"Unknown";
 
-#import <vlc_keys.h>
+#import <vlc_actions.h>
 #import <vlc_strings.h>
 
 @implementation VLCStringUtility
index 2c40cdf..5054028 100644 (file)
@@ -39,7 +39,7 @@
 
 #import <QuartzCore/QuartzCore.h>
 
-#import <vlc_keys.h>
+#import <vlc_actions.h>
 
 
 /*****************************************************************************
index 7d379a5..acffad8 100644 (file)
@@ -29,7 +29,7 @@
 #import "VLCMainMenu.h"
 #import "VLCControlsBarCommon.h"
 #import "VLCCoreInteraction.h"
-#import <vlc_keys.h>
+#import <vlc_actions.h>
 
 /*****************************************************************************
  * VLCDragDropView
index b984b9e..c8d20b7 100644 (file)
@@ -59,7 +59,7 @@
 #import "VLCSimplePrefsController.h"
 #import "prefs_widgets.h"
 #import "VLCCoreInteraction.h"
-#import <vlc_keys.h>
+#import <vlc_actions.h>
 #import <vlc_modules.h>
 #import <vlc_plugin.h>
 
index e7dfab7..8d137af 100644 (file)
@@ -35,7 +35,7 @@
 #include <vlc_common.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #include "VLCMain.h"
 #include "prefs_widgets.h"
index 4f672da..cc67ff1 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 #include <vlc_vout.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_renderer_discovery.h>
 
 #include "actions_manager.hpp"
index 709e372..1fc21a5 100644 (file)
@@ -35,7 +35,7 @@
 #include "util/customwidgets.hpp"
 #include "util/searchlineedit.hpp"
 #include "util/qt_dirs.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_intf_strings.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
index cf9a0b2..ede4491 100644 (file)
@@ -30,7 +30,7 @@
 #include "input_manager.hpp"
 #include "recents.hpp"
 
-#include <vlc_keys.h>           /* ACTION_ID */
+#include <vlc_actions.h>           /* ACTION_ID */
 #include <vlc_url.h>            /* vlc_uri_decode */
 #include <vlc_strings.h>        /* vlc_strfinput */
 #include <vlc_aout.h>           /* audio_output_t */
index bec22ea..bddd8c9 100644 (file)
@@ -64,7 +64,7 @@
 
 #include <QTimer>
 
-#include <vlc_keys.h>                       /* Wheel event */
+#include <vlc_actions.h>                    /* Wheel event */
 #include <vlc_vout_display.h>               /* vout_thread_t and VOUT_ events */
 
 // #define DEBUG_INTF
index 7ee4ec7..61fd898 100644 (file)
@@ -37,7 +37,7 @@
 #include <QWheelEvent>
 #include <QPixmap>
 #include <QApplication>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 QFramelessButton::QFramelessButton( QWidget *parent )
                     : QPushButton( parent )
index 7a5d89d..c5f7055 100644 (file)
@@ -34,7 +34,7 @@
 #include "../events/evt_key.hpp"
 #include "../events/evt_mouse.hpp"
 #include "../events/evt_scroll.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #define SCROLL_STEP 0.05f
 #define LINE_INTERVAL 1  // Number of pixels inserted between 2 lines
index 63fe050..f851a25 100644 (file)
@@ -39,7 +39,7 @@
 #include "../events/evt_scroll.hpp"
 #include "../events/evt_dragndrop.hpp"
 #include "../vars/playtree.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #define LINE_INTERVAL 1  // Number of pixels inserted between 2 lines
 
index e18d7be..80d299f 100644 (file)
@@ -23,7 +23,7 @@
  *****************************************************************************/
 
 #include "evt_input.hpp"
-#include "vlc_keys.h"
+#include "vlc_actions.h"
 
 const int
     EvtInput::kModNone=0,
index 66c8007..34ed297 100644 (file)
@@ -23,7 +23,7 @@
  *****************************************************************************/
 
 #include "evt_key.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 
 const std::string EvtKey::getAsString() const
index 8d9477e..8206ae5 100644 (file)
@@ -49,7 +49,7 @@ public:
     ActionType_t getKeyState() const { return m_action; }
 
 private:
-    /// The concerned key, stored according to the '#define's in vlc_keys.h
+    /// The concerned key, stored according to the '#define's in vlc_actions.h
     /// but without the modifiers (which are stored in EvtInput)
     int m_key;
     /// Type of action
index 57ba6a2..598718e 100644 (file)
@@ -34,7 +34,7 @@
 #include "../events/evt_mouse.hpp"
 #include "../events/evt_refresh.hpp"
 #include "../events/evt_scroll.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 
 #define GET_X_MP( mp ) ( SHORT1FROMMP( mp ))
index 0e761d0..f447457 100644 (file)
@@ -47,7 +47,7 @@
 #include "../utils/position.hpp"
 #include "../utils/ustring.hpp"
 
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_input.h>
 #include <vlc_url.h>
 #include <list>
index ade94a3..60c2713 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <vlc_vout.h>
 #include <vlc_vout_window.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include "../utils/position.hpp"
 #include "../commands/cmd_generic.hpp"
 #include "../controls/ctrl_video.hpp"
index 9c2bd2d..e50683f 100644 (file)
@@ -30,7 +30,7 @@
 #include "os_window.hpp"
 #include "../events/evt_key.hpp"
 
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 
 VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
index fdd9a0d..bbae954 100644 (file)
@@ -34,7 +34,7 @@
 #include "../events/evt_mouse.hpp"
 #include "../events/evt_refresh.hpp"
 #include "../events/evt_scroll.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 
 // XXX: Cygwin (at least) doesn't define these macros. Too bad...
index d0edf2d..0aa682e 100644 (file)
@@ -42,7 +42,7 @@
 #include "../events/evt_scroll.hpp"
 #include "../commands/async_queue.hpp"
 #include "../utils/var_bool.hpp"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 
 // Maximum interval between clicks for a double-click (in microsec)
index 95d08a7..1bc0dca 100644 (file)
@@ -40,7 +40,7 @@
 #include <vlc_plugin.h>
 #include <vlc_meta.h>
 #include <vlc_interface.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_interrupt.h>
 
 #include "../vlc.h"
index 1e23a3e..c112de9 100644 (file)
@@ -55,7 +55,8 @@
 #include <vlc_filter.h>
 #include <vlc_mouse.h>
 #include <vlc_subpicture.h>
-#include <vlc_keys.h>                  /* KEY_MODIFIER_CTRL */
+#include <vlc_actions.h>               /* KEY_MODIFIER_CTRL */
+
 #include <vlc_network.h>               /* net_*, htonl */
 #include <gcrypt.h>                    /* to encrypt password */
 #include <vlc_gcrypt.h>
index 0e0846a..72f041b 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "win32touch.h"
 
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 #include <assert.h>
 
index b97a679..69b514e 100644 (file)
@@ -36,7 +36,7 @@
 #include <xcb/xcb_keysyms.h>
 #include <X11/keysym.h>
 #include <X11/XF86keysym.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 
 struct key_handler_t
 {
index 49b0679..01388cb 100644 (file)
@@ -1,5 +1,6 @@
 # main sources
 include/vlc_access.h
+include/vlc_actions.h
 include/vlc_aout.h
 include/vlc_arrays.h
 include/vlc_bits.h
@@ -26,7 +27,6 @@ include/vlc_image.h
 include/vlc_input.h
 include/vlc_intf_strings.h
 include/vlc_iso_lang.h
-include/vlc_keys.h
 include/vlc/libvlc_events.h
 include/vlc/libvlc.h
 include/vlc/libvlc_media_list.h
@@ -70,7 +70,6 @@ src/config/core.c
 src/config/file.c
 src/config/help.c
 src/config/intf.c
-src/config/keys.c
 src/darwin/error.c
 src/extras/libc.c
 src/extras/tdestroy.c
@@ -100,6 +99,7 @@ src/interface/interface.c
 src/libvlc.c
 src/libvlc.h
 src/libvlc-module.c
+src/misc/actions.c
 src/misc/block.c
 src/misc/cpu.c
 src/misc/error.c
index 3a23b00..512ee10 100644 (file)
@@ -23,6 +23,7 @@ pluginsincludedir = $(pkgincludedir)/plugins
 
 pluginsinclude_HEADERS = \
        ../include/vlc_access.h \
+       ../include/vlc_actions.h \
        ../include/vlc_addons.h \
        ../include/vlc_aout.h \
        ../include/vlc_aout_volume.h \
@@ -58,7 +59,6 @@ pluginsinclude_HEADERS = \
        ../include/vlc_input.h \
        ../include/vlc_input_item.h \
        ../include/vlc_interface.h \
-       ../include/vlc_keys.h \
        ../include/vlc_keystore.h \
        ../include/vlc_main.h \
        ../include/vlc_md5.h \
@@ -195,7 +195,6 @@ libvlccore_la_SOURCES = \
        config/file.c \
        config/help.c \
        config/intf.c \
-       config/keys.c \
        config/cmdline.c \
        config/getopt.c \
        config/vlc_getopt.h \
@@ -310,6 +309,7 @@ libvlccore_la_SOURCES = \
        text/filesystem.c \
        text/iso_lang.c \
        text/iso-639_def.h \
+       misc/actions.c \
        misc/background_worker.c \
        misc/background_worker.h \
        misc/md5.c \
index 748ee5c..882f224 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <vlc_common.h>
 #include "../libvlc.h"
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_charset.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
index 88f2a5f..4b93834 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
 
index b73839f..6270a6b 100644 (file)
@@ -41,7 +41,7 @@
 #include "../libvlc.h"
 #include <vlc_charset.h>
 #include <vlc_fs.h>
-#include <vlc_keys.h>
+#include <vlc_actions.h>
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
 
diff --git a/src/config/keys.c b/src/config/keys.c
deleted file mode 100644 (file)
index 460ca64..0000000
+++ /dev/null
@@ -1,598 +0,0 @@
-/*****************************************************************************
- * keys.c: keys configuration
- *****************************************************************************
- * Copyright (C) 2003-2009 VLC authors and VideoLAN
- *
- * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/**
- * \file
- * This file defines functions and structures for hotkey handling in vlc
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <limits.h>
-#ifdef HAVE_SEARCH_H
-# include <search.h>
-#endif
-#include <errno.h>
-
-#include <vlc_common.h>
-#include <vlc_keys.h>
-#include <vlc_charset.h>
-#include "configuration.h"
-#include "libvlc.h"
-
-typedef struct key_descriptor_s
-{
-    const char psz_key_string[20];
-    uint32_t i_key_code;
-} key_descriptor_t;
-
-static const struct key_descriptor_s vlc_keys[] =
-{   /* Alphabetical order */
-    { N_("Backspace"),         KEY_BACKSPACE         },
-    { N_("Brightness Down"),   KEY_BRIGHTNESS_DOWN   },
-    { N_("Brightness Up"),     KEY_BRIGHTNESS_UP     },
-    { N_("Browser Back"),      KEY_BROWSER_BACK      },
-    { N_("Browser Favorites"), KEY_BROWSER_FAVORITES },
-    { N_("Browser Forward"),   KEY_BROWSER_FORWARD   },
-    { N_("Browser Home"),      KEY_BROWSER_HOME      },
-    { N_("Browser Refresh"),   KEY_BROWSER_REFRESH   },
-    { N_("Browser Search"),    KEY_BROWSER_SEARCH    },
-    { N_("Browser Stop"),      KEY_BROWSER_STOP      },
-    { N_("Delete"),            KEY_DELETE            },
-    { N_("Down"),              KEY_DOWN              },
-    { N_("End"),               KEY_END               },
-    { N_("Enter"),             KEY_ENTER             },
-    { N_("Esc"),               KEY_ESC               },
-    { N_("F1"),                KEY_F1                },
-    { N_("F10"),               KEY_F10               },
-    { N_("F11"),               KEY_F11               },
-    { N_("F12"),               KEY_F12               },
-    { N_("F2"),                KEY_F2                },
-    { N_("F3"),                KEY_F3                },
-    { N_("F4"),                KEY_F4                },
-    { N_("F5"),                KEY_F5                },
-    { N_("F6"),                KEY_F6                },
-    { N_("F7"),                KEY_F7                },
-    { N_("F8"),                KEY_F8                },
-    { N_("F9"),                KEY_F9                },
-    { N_("Home"),              KEY_HOME              },
-    { N_("Insert"),            KEY_INSERT            },
-    { N_("Left"),              KEY_LEFT              },
-    { N_("Media Angle"),       KEY_MEDIA_ANGLE       },
-    { N_("Media Audio Track"), KEY_MEDIA_AUDIO       },
-    { N_("Media Forward"),     KEY_MEDIA_FORWARD     },
-    { N_("Media Menu"),        KEY_MEDIA_MENU        },
-    { N_("Media Next Frame"),  KEY_MEDIA_FRAME_NEXT  },
-    { N_("Media Next Track"),  KEY_MEDIA_NEXT_TRACK  },
-    { N_("Media Play Pause"),  KEY_MEDIA_PLAY_PAUSE  },
-    { N_("Media Prev Frame"),  KEY_MEDIA_FRAME_PREV  },
-    { N_("Media Prev Track"),  KEY_MEDIA_PREV_TRACK  },
-    { N_("Media Record"),      KEY_MEDIA_RECORD      },
-    { N_("Media Repeat"),      KEY_MEDIA_REPEAT      },
-    { N_("Media Rewind"),      KEY_MEDIA_REWIND      },
-    { N_("Media Select"),      KEY_MEDIA_SELECT      },
-    { N_("Media Shuffle"),     KEY_MEDIA_SHUFFLE     },
-    { N_("Media Stop"),        KEY_MEDIA_STOP        },
-    { N_("Media Subtitle"),    KEY_MEDIA_SUBTITLE    },
-    { N_("Media Time"),        KEY_MEDIA_TIME        },
-    { N_("Media View"),        KEY_MEDIA_VIEW        },
-    { N_("Menu"),              KEY_MENU              },
-    { N_("Mouse Wheel Down"),  KEY_MOUSEWHEELDOWN    },
-    { N_("Mouse Wheel Left"),  KEY_MOUSEWHEELLEFT    },
-    { N_("Mouse Wheel Right"), KEY_MOUSEWHEELRIGHT   },
-    { N_("Mouse Wheel Up"),    KEY_MOUSEWHEELUP      },
-    { N_("Page Down"),         KEY_PAGEDOWN          },
-    { N_("Page Up"),           KEY_PAGEUP            },
-    { N_("Pause"),             KEY_PAUSE             },
-    { N_("Print"),             KEY_PRINT             },
-    { N_("Right"),             KEY_RIGHT             },
-    { N_("Space"),             ' '                   },
-    { N_("Tab"),               KEY_TAB               },
-    { N_("Unset"),             KEY_UNSET             },
-    { N_("Up"),                KEY_UP                },
-    { N_("Volume Down"),       KEY_VOLUME_DOWN       },
-    { N_("Volume Mute"),       KEY_VOLUME_MUTE       },
-    { N_("Volume Up"),         KEY_VOLUME_UP         },
-    { N_("Zoom In"),           KEY_ZOOM_IN           },
-    { N_("Zoom Out"),          KEY_ZOOM_OUT          },
-};
-#define KEYS_COUNT (sizeof(vlc_keys)/sizeof(vlc_keys[0]))
-
-static int keystrcmp (const void *key, const void *elem)
-{
-    const char *sa = key, *sb = elem;
-    return strcmp (sa, sb);
-}
-
-/* Convert Unicode code point to UTF-8 */
-static char *utf8_cp (uint_fast32_t cp, char *buf)
-{
-    if (cp < (1 << 7))
-    {
-        buf[1] = 0;
-        buf[0] = cp;
-    }
-    else if (cp < (1 << 11))
-    {
-        buf[2] = 0;
-        buf[1] = 0x80 | (cp & 0x3F);
-        cp >>= 6;
-        buf[0] = 0xC0 | cp;
-    }
-    else if (cp < (1 << 16))
-    {
-        buf[3] = 0;
-        buf[2] = 0x80 | (cp & 0x3F);
-        cp >>= 6;
-        buf[1] = 0x80 | (cp & 0x3F);
-        cp >>= 6;
-        buf[0] = 0xE0 | cp;
-    }
-    else if (cp < (1 << 21))
-    {
-        buf[4] = 0;
-        buf[3] = 0x80 | (cp & 0x3F);
-        cp >>= 6;
-        buf[2] = 0x80 | (cp & 0x3F);
-        cp >>= 6;
-        buf[1] = 0x80 | (cp & 0x3F);
-        cp >>= 6;
-        buf[0] = 0xE0 | cp;
-    }
-    else
-        return NULL;
-    return buf;
-}
-
-/**
- * Parse a human-readable string representation of a VLC key code.
- * @note This only works with the American English representation
- * (a.k.a. C or POSIX), not with the local representation returned from
- * vlc_keycode2str().
- * @return a VLC key code, or KEY_UNSET on failure.
- */
-uint_fast32_t vlc_str2keycode (const char *name)
-{
-    uint_fast32_t mods = 0;
-    uint32_t code;
-
-    for (;;)
-    {
-        size_t len = strcspn (name, "-+");
-        if (len == 0 || name[len] == '\0')
-            break;
-
-        if (len == 4 && !strncasecmp (name, "Ctrl", 4))
-            mods |= KEY_MODIFIER_CTRL;
-        if (len == 3 && !strncasecmp (name, "Alt", 3))
-            mods |= KEY_MODIFIER_ALT;
-        if (len == 5 && !strncasecmp (name, "Shift", 5))
-            mods |= KEY_MODIFIER_SHIFT;
-        if (len == 4 && !strncasecmp (name, "Meta", 4))
-            mods |= KEY_MODIFIER_META;
-        if (len == 7 && !strncasecmp (name, "Command", 7))
-            mods |= KEY_MODIFIER_COMMAND;
-
-        name += len + 1;
-    }
-
-    key_descriptor_t *d = bsearch (name, vlc_keys, KEYS_COUNT,
-                                   sizeof (vlc_keys[0]), keystrcmp);
-    if (d != NULL)
-        code = d->i_key_code;
-    else
-    if (vlc_towc (name, &code) <= 0)
-        code = KEY_UNSET;
-
-    if (code != KEY_UNSET)
-        code |= mods;
-    return code;
-}
-
-static char *nooptext (const char *txt)
-{
-    return (char *)txt;
-}
-
-/**
- * Format a human-readable and unique representation of a VLC key code
- * (including modifiers).
- * @param code key code to translate to a string
- * @param locale true to get a localized string,
- *               false to get a C string suitable for 'vlcrc'
- * @return a heap-allocated string, or NULL on error.
- */
-char *vlc_keycode2str (uint_fast32_t code, bool locale)
-{
-    char *(*tr) (const char *) = locale ? vlc_gettext : nooptext;
-    const char *name;
-    char *str, buf[5];
-    uintptr_t key = code & ~KEY_MODIFIER;
-
-    for (size_t i = 0; i < KEYS_COUNT; i++)
-        if (vlc_keys[i].i_key_code == key)
-        {
-            name = vlc_keys[i].psz_key_string;
-            goto found;
-        }
-
-    if (utf8_cp (key, buf) == NULL)
-        return NULL;
-    name = buf;
-
-found:
-    if (asprintf (&str, "%s%s%s%s%s%s",
-                  (code & KEY_MODIFIER_CTRL) ? tr(N_("Ctrl+")) : "",
-                  (code & KEY_MODIFIER_ALT) ? tr(N_("Alt+")) : "",
-                  (code & KEY_MODIFIER_SHIFT) ? tr(N_("Shift+")) : "",
-                  (code & KEY_MODIFIER_META) ? tr(N_("Meta+")) : "",
-                  (code & KEY_MODIFIER_COMMAND) ? tr(N_("Command+")) : "",
-                  tr(name)) == -1)
-        return NULL;
-    return str;
-}
-
-
-/*** VLC key map ***/
-
-#define MAXACTION 26
-struct action
-{
-    char name[MAXACTION];
-    vlc_action_id_t value;
-};
-
-static const struct action actions[] =
-{
-    /* *MUST* be sorted (ASCII order) */
-    { "aspect-ratio", ACTIONID_ASPECT_RATIO, },
-    { "audio-track", ACTIONID_AUDIO_TRACK, },
-    { "audiodelay-down", ACTIONID_AUDIODELAY_DOWN, },
-    { "audiodelay-up", ACTIONID_AUDIODELAY_UP, },
-    { "audiodevice-cycle", ACTIONID_AUDIODEVICE_CYCLE, },
-    { "chapter-next", ACTIONID_CHAPTER_NEXT, },
-    { "chapter-prev", ACTIONID_CHAPTER_PREV, },
-    { "clear-playlist", ACTIONID_PLAY_CLEAR, },
-    { "crop", ACTIONID_CROP, },
-    { "crop-bottom", ACTIONID_CROP_BOTTOM, },
-    { "crop-left", ACTIONID_CROP_LEFT, },
-    { "crop-right", ACTIONID_CROP_RIGHT, },
-    { "crop-top", ACTIONID_CROP_TOP, },
-    { "decr-scalefactor", ACTIONID_SCALE_DOWN, },
-    { "deinterlace", ACTIONID_DEINTERLACE, },
-    { "deinterlace-mode", ACTIONID_DEINTERLACE_MODE, },
-    { "disc-menu", ACTIONID_DISC_MENU, },
-    { "faster", ACTIONID_FASTER, },
-    { "frame-next", ACTIONID_FRAME_NEXT, },
-    { "incr-scalefactor", ACTIONID_SCALE_UP, },
-    { "intf-boss", ACTIONID_INTF_BOSS, },
-    { "intf-popup-menu", ACTIONID_INTF_POPUP_MENU, },
-    { "intf-show", ACTIONID_INTF_TOGGLE_FSC, },
-    { "jump+extrashort", ACTIONID_JUMP_FORWARD_EXTRASHORT, },
-    { "jump+long", ACTIONID_JUMP_FORWARD_LONG, },
-    { "jump+medium", ACTIONID_JUMP_FORWARD_MEDIUM, },
-    { "jump+short", ACTIONID_JUMP_FORWARD_SHORT, },
-    { "jump-extrashort", ACTIONID_JUMP_BACKWARD_EXTRASHORT, },
-    { "jump-long", ACTIONID_JUMP_BACKWARD_LONG, },
-    { "jump-medium", ACTIONID_JUMP_BACKWARD_MEDIUM, },
-    { "jump-short", ACTIONID_JUMP_BACKWARD_SHORT, },
-    { "leave-fullscreen", ACTIONID_LEAVE_FULLSCREEN, },
-    { "loop", ACTIONID_LOOP, },
-    { "nav-activate", ACTIONID_NAV_ACTIVATE, },
-    { "nav-down", ACTIONID_NAV_DOWN, },
-    { "nav-left", ACTIONID_NAV_LEFT, },
-    { "nav-right", ACTIONID_NAV_RIGHT, },
-    { "nav-up", ACTIONID_NAV_UP, },
-    { "next", ACTIONID_NEXT, },
-    { "pause", ACTIONID_PAUSE, },
-    { "play", ACTIONID_PLAY, },
-    { "play-bookmark1", ACTIONID_PLAY_BOOKMARK1, },
-    { "play-bookmark10", ACTIONID_PLAY_BOOKMARK10, },
-    { "play-bookmark2", ACTIONID_PLAY_BOOKMARK2, },
-    { "play-bookmark3", ACTIONID_PLAY_BOOKMARK3, },
-    { "play-bookmark4", ACTIONID_PLAY_BOOKMARK4, },
-    { "play-bookmark5", ACTIONID_PLAY_BOOKMARK5, },
-    { "play-bookmark6", ACTIONID_PLAY_BOOKMARK6, },
-    { "play-bookmark7", ACTIONID_PLAY_BOOKMARK7, },
-    { "play-bookmark8", ACTIONID_PLAY_BOOKMARK8, },
-    { "play-bookmark9", ACTIONID_PLAY_BOOKMARK9, },
-    { "play-pause", ACTIONID_PLAY_PAUSE, },
-    { "position", ACTIONID_POSITION, },
-    { "prev", ACTIONID_PREV, },
-    { "program-sid-next", ACTIONID_PROGRAM_SID_NEXT, },
-    { "program-sid-prev", ACTIONID_PROGRAM_SID_PREV, },
-    { "quit", ACTIONID_QUIT, },
-    { "random", ACTIONID_RANDOM, },
-    { "rate-faster-fine", ACTIONID_RATE_FASTER_FINE, },
-    { "rate-normal", ACTIONID_RATE_NORMAL, },
-    { "rate-slower-fine", ACTIONID_RATE_SLOWER_FINE, },
-    { "record", ACTIONID_RECORD, },
-    { "set-bookmark1", ACTIONID_SET_BOOKMARK1, },
-    { "set-bookmark10", ACTIONID_SET_BOOKMARK10, },
-    { "set-bookmark2", ACTIONID_SET_BOOKMARK2, },
-    { "set-bookmark3", ACTIONID_SET_BOOKMARK3, },
-    { "set-bookmark4", ACTIONID_SET_BOOKMARK4, },
-    { "set-bookmark5", ACTIONID_SET_BOOKMARK5, },
-    { "set-bookmark6", ACTIONID_SET_BOOKMARK6, },
-    { "set-bookmark7", ACTIONID_SET_BOOKMARK7, },
-    { "set-bookmark8", ACTIONID_SET_BOOKMARK8, },
-    { "set-bookmark9", ACTIONID_SET_BOOKMARK9, },
-    { "slower", ACTIONID_SLOWER, },
-    { "snapshot", ACTIONID_SNAPSHOT, },
-    { "stop", ACTIONID_STOP, },
-    { "subdelay-down", ACTIONID_SUBDELAY_DOWN, },
-    { "subdelay-up", ACTIONID_SUBDELAY_UP, },
-    { "subpos-down", ACTIONID_SUBPOS_DOWN, },
-    { "subpos-up", ACTIONID_SUBPOS_UP, },
-    { "subsync-apply", ACTIONID_SUBSYNC_APPLY, },
-    { "subsync-markaudio", ACTIONID_SUBSYNC_MARKAUDIO, },
-    { "subsync-marksub", ACTIONID_SUBSYNC_MARKSUB, },
-    { "subsync-reset", ACTIONID_SUBSYNC_RESET, },
-    { "subtitle-revtrack", ACTIONID_SUBTITLE_REVERSE_TRACK, },
-    { "subtitle-text-scale-down", ACTIONID_SUBTITLE_TEXT_SCALE_DOWN, },
-    { "subtitle-text-scale-normal", ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL, },
-    { "subtitle-text-scale-up", ACTIONID_SUBTITLE_TEXT_SCALE_UP, },
-    { "subtitle-toggle", ACTIONID_SUBTITLE_TOGGLE, },
-    { "subtitle-track", ACTIONID_SUBTITLE_TRACK, },
-    { "title-next", ACTIONID_TITLE_NEXT, },
-    { "title-prev", ACTIONID_TITLE_PREV, },
-    { "toggle-autoscale", ACTIONID_TOGGLE_AUTOSCALE, },
-    { "toggle-fullscreen", ACTIONID_TOGGLE_FULLSCREEN, },
-    { "uncrop-bottom", ACTIONID_UNCROP_BOTTOM, },
-    { "uncrop-left", ACTIONID_UNCROP_LEFT, },
-    { "uncrop-right", ACTIONID_UNCROP_RIGHT, },
-    { "uncrop-top", ACTIONID_UNCROP_TOP, },
-    { "unzoom", ACTIONID_UNZOOM, },
-    { "viewpoint-fov-in", ACTIONID_VIEWPOINT_FOV_IN, },
-    { "viewpoint-fov-out", ACTIONID_VIEWPOINT_FOV_OUT, },
-    { "viewpoint-roll-anticlock", ACTIONID_VIEWPOINT_ROLL_ANTICLOCK, },
-    { "viewpoint-roll-clock", ACTIONID_VIEWPOINT_ROLL_CLOCK, },
-    { "vol-down", ACTIONID_VOL_DOWN, },
-    { "vol-mute", ACTIONID_VOL_MUTE, },
-    { "vol-up", ACTIONID_VOL_UP, },
-    { "wallpaper", ACTIONID_WALLPAPER, },
-    { "zoom", ACTIONID_ZOOM, },
-    { "zoom-double", ACTIONID_ZOOM_DOUBLE, },
-    { "zoom-half", ACTIONID_ZOOM_HALF, },
-    { "zoom-original", ACTIONID_ZOOM_ORIGINAL, },
-    { "zoom-quarter", ACTIONID_ZOOM_QUARTER, },
-};
-#define ACTIONS_COUNT (sizeof (actions) / sizeof (actions[0]))
-
-struct mapping
-{
-    uint32_t     key; ///< Key code
-    vlc_action_id_t action; ///< Action ID
-};
-
-static int keycmp (const void *a, const void *b)
-{
-    const struct mapping *ka = a, *kb = b;
-
-    return (ka->key < kb->key) ? -1 : (ka->key > kb->key) ? +1 : 0;
-}
-
-struct vlc_actions
-{
-    void *map; /* Key map */
-    void *global_map; /* Grabbed/global key map */
-    struct hotkey keys[1];
-};
-
-static int vlc_key_to_action (vlc_object_t *obj, const char *varname,
-                              vlc_value_t prevkey, vlc_value_t curkey, void *d)
-{
-    void *const *map = d;
-    const struct mapping **pent;
-    uint32_t keycode = curkey.i_int;
-
-    pent = tfind (&keycode, map, keycmp);
-    if (pent == NULL)
-        return VLC_SUCCESS;
-
-    (void) varname;
-    (void) prevkey;
-    return var_SetInteger (obj, "key-action", (*pent)->action);
-}
-
-/**
- * Adds a mapping from a certain key code to a certain action.
- */
-static int vlc_AddMapping (void **map, uint32_t keycode, vlc_action_id_t action)
-{
-    struct mapping *entry = malloc (sizeof (*entry));
-    if (entry == NULL)
-        return ENOMEM;
-    entry->key = keycode;
-    entry->action = action;
-
-    struct mapping **pent = tsearch (entry, map, keycmp);
-    if (unlikely(pent == NULL))
-        return ENOMEM;
-    if (*pent != entry)
-    {
-        free (entry);
-        return EEXIST;
-    }
-    return 0;
-}
-
-static void vlc_AddWheelMapping (void **map, uint32_t kmore, uint32_t kless,
-                                 int mode)
-{
-    vlc_action_id_t amore = ACTIONID_NONE, aless = ACTIONID_NONE;
-
-    switch (mode)
-    {
-        case 0: /* volume up/down */
-            amore = ACTIONID_COMBO_VOL_FOV_UP;
-            aless = ACTIONID_COMBO_VOL_FOV_DOWN;
-            break;
-        case 2: /* position latter/earlier */
-            amore = ACTIONID_JUMP_FORWARD_EXTRASHORT;
-            aless = ACTIONID_JUMP_BACKWARD_EXTRASHORT;
-            break;
-        case 3: /* position earlier/latter */
-            amore = ACTIONID_JUMP_BACKWARD_EXTRASHORT;
-            aless = ACTIONID_JUMP_FORWARD_EXTRASHORT;
-            break;
-    }
-
-    if (amore != ACTIONID_NONE)
-        vlc_AddMapping (map, kmore, amore);
-    if (aless != ACTIONID_NONE)
-        vlc_AddMapping (map, kless, aless);
-}
-
-
-/**
- * Sets up all key mappings for a given action.
- * \param map tree (of struct mapping entries) to write mappings to
- * \param confname VLC configuration item to read mappings from
- * \param action action ID
- */
-static void vlc_InitAction (vlc_object_t *obj, void **map,
-                            const char *confname, vlc_action_id_t action)
-{
-    char *keys = var_InheritString (obj, confname);
-    if (keys == NULL)
-        return;
-
-    for (char *buf, *key = strtok_r (keys, "\t", &buf);
-         key != NULL;
-         key = strtok_r (NULL, "\t", &buf))
-    {
-        uint32_t code = vlc_str2keycode (key);
-        if (code == KEY_UNSET)
-        {
-            msg_Warn (obj, "Key \"%s\" unrecognized", key);
-            continue;
-        }
-
-        if (vlc_AddMapping (map, code, action) == EEXIST)
-            msg_Warn (obj, "Key \"%s\" bound to multiple actions", key);
-    }
-    free (keys);
-}
-
-/**
- * Initializes the key map from configuration.
- */
-struct vlc_actions *vlc_InitActions (libvlc_int_t *libvlc)
-{
-    vlc_object_t *obj = VLC_OBJECT(libvlc);
-    struct hotkey *keys;
-    struct vlc_actions *as = malloc (sizeof (*as) + ACTIONS_COUNT * sizeof (*keys));
-
-    if (unlikely(as == NULL))
-        return NULL;
-    as->map = NULL;
-    as->global_map = NULL;
-    keys = as->keys;
-
-    var_Create (obj, "key-pressed", VLC_VAR_INTEGER);
-    var_Create (obj, "global-key-pressed", VLC_VAR_INTEGER);
-    var_Create (obj, "key-action", VLC_VAR_INTEGER);
-
-    /* Initialize from configuration */
-    for (size_t i = 0; i < ACTIONS_COUNT; i++)
-    {
-#ifndef NDEBUG
-        if (i > 0
-         && strcmp (actions[i-1].name, actions[i].name) >= 0)
-        {
-            msg_Err (libvlc, "key-%s and key-%s are not ordered properly",
-                     actions[i-1].name, actions[i].name);
-            abort ();
-        }
-#endif
-        keys->psz_action = actions[i].name;
-        keys++;
-
-        char name[12 + MAXACTION];
-
-        snprintf (name, sizeof (name), "global-key-%s", actions[i].name);
-        vlc_InitAction (obj, &as->map, name + 7, actions[i].value);
-        vlc_InitAction (obj, &as->global_map, name, actions[i].value);
-    }
-    keys->psz_action = NULL;
-
-    /* Initialize mouse wheel events */
-    vlc_AddWheelMapping (&as->map, KEY_MOUSEWHEELRIGHT, KEY_MOUSEWHEELLEFT,
-                         var_InheritInteger (obj, "hotkeys-x-wheel-mode"));
-    vlc_AddWheelMapping (&as->map, KEY_MOUSEWHEELUP, KEY_MOUSEWHEELDOWN,
-                         var_InheritInteger (obj, "hotkeys-y-wheel-mode"));
-
-    libvlc->p_hotkeys = as->keys;
-    var_AddCallback (obj, "key-pressed", vlc_key_to_action, &as->map);
-    var_AddCallback (obj, "global-key-pressed", vlc_key_to_action,
-                     &as->global_map);
-    return as;
-}
-
-/**
- * Destroys the key map.
- */
-void vlc_DeinitActions (libvlc_int_t *libvlc, struct vlc_actions *as)
-{
-    if (unlikely(as == NULL))
-        return;
-
-    var_DelCallback (libvlc, "global-key-pressed", vlc_key_to_action,
-                     &as->global_map);
-    var_DelCallback (libvlc, "key-pressed", vlc_key_to_action, &as->map);
-
-    tdestroy (as->global_map, free);
-    tdestroy (as->map, free);
-    free (as);
-    libvlc->p_hotkeys = NULL;
-}
-
-
-static int actcmp(const void *key, const void *ent)
-{
-    const struct action *act = ent;
-    return strcmp(key, act->name);
-}
-
-/**
- * Get the action ID from the action name in the configuration subsystem.
- * @return the action ID or ACTIONID_NONE on error.
- */
-vlc_action_id_t vlc_GetActionId (const char *name)
-{
-    const struct action *act;
-
-    if (strncmp (name, "key-", 4))
-        return ACTIONID_NONE;
-    name += 4;
-
-    act = bsearch(name, actions, ACTIONS_COUNT, sizeof(*act), actcmp);
-    return (act != NULL) ? act->value : ACTIONID_NONE;
-}
index cc25c94..d819e75 100644 (file)
@@ -39,7 +39,7 @@
 #include "modules/modules.h"
 
 //#define Nothing here, this is just to prevent update-po from being stupid
-#include "vlc_keys.h"
+#include "vlc_actions.h"
 #include "vlc_meta.h"
 #include <vlc_aout.h>
 
diff --git a/src/misc/actions.c b/src/misc/actions.c
new file mode 100644 (file)
index 0000000..968a085
--- /dev/null
@@ -0,0 +1,598 @@
+/*****************************************************************************
+ * actions.c: handle vlc actions
+ *****************************************************************************
+ * Copyright (C) 2003-2016 VLC authors and VideoLAN
+ *
+ * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/**
+ * \file
+ * This file defines functions and structures for hotkey handling in vlc
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <limits.h>
+#ifdef HAVE_SEARCH_H
+# include <search.h>
+#endif
+#include <errno.h>
+
+#include <vlc_common.h>
+#include <vlc_actions.h>
+#include <vlc_charset.h>
+#include "config/configuration.h"
+#include "libvlc.h"
+
+typedef struct key_descriptor_s
+{
+    const char psz_key_string[20];
+    uint32_t i_key_code;
+} key_descriptor_t;
+
+static const struct key_descriptor_s vlc_keys[] =
+{   /* Alphabetical order */
+    { N_("Backspace"),         KEY_BACKSPACE         },
+    { N_("Brightness Down"),   KEY_BRIGHTNESS_DOWN   },
+    { N_("Brightness Up"),     KEY_BRIGHTNESS_UP     },
+    { N_("Browser Back"),      KEY_BROWSER_BACK      },
+    { N_("Browser Favorites"), KEY_BROWSER_FAVORITES },
+    { N_("Browser Forward"),   KEY_BROWSER_FORWARD   },
+    { N_("Browser Home"),      KEY_BROWSER_HOME      },
+    { N_("Browser Refresh"),   KEY_BROWSER_REFRESH   },
+    { N_("Browser Search"),    KEY_BROWSER_SEARCH    },
+    { N_("Browser Stop"),      KEY_BROWSER_STOP      },
+    { N_("Delete"),            KEY_DELETE            },
+    { N_("Down"),              KEY_DOWN              },
+    { N_("End"),               KEY_END               },
+    { N_("Enter"),             KEY_ENTER             },
+    { N_("Esc"),               KEY_ESC               },
+    { N_("F1"),                KEY_F1                },
+    { N_("F10"),               KEY_F10               },
+    { N_("F11"),               KEY_F11               },
+    { N_("F12"),               KEY_F12               },
+    { N_("F2"),                KEY_F2                },
+    { N_("F3"),                KEY_F3                },
+    { N_("F4"),                KEY_F4                },
+    { N_("F5"),                KEY_F5                },
+    { N_("F6"),                KEY_F6                },
+    { N_("F7"),                KEY_F7                },
+    { N_("F8"),                KEY_F8                },
+    { N_("F9"),                KEY_F9                },
+    { N_("Home"),              KEY_HOME              },
+    { N_("Insert"),            KEY_INSERT            },
+    { N_("Left"),              KEY_LEFT              },
+    { N_("Media Angle"),       KEY_MEDIA_ANGLE       },
+    { N_("Media Audio Track"), KEY_MEDIA_AUDIO       },
+    { N_("Media Forward"),     KEY_MEDIA_FORWARD     },
+    { N_("Media Menu"),        KEY_MEDIA_MENU        },
+    { N_("Media Next Frame"),  KEY_MEDIA_FRAME_NEXT  },
+    { N_("Media Next Track"),  KEY_MEDIA_NEXT_TRACK  },
+    { N_("Media Play Pause"),  KEY_MEDIA_PLAY_PAUSE  },
+    { N_("Media Prev Frame"),  KEY_MEDIA_FRAME_PREV  },
+    { N_("Media Prev Track"),  KEY_MEDIA_PREV_TRACK  },
+    { N_("Media Record"),      KEY_MEDIA_RECORD      },
+    { N_("Media Repeat"),      KEY_MEDIA_REPEAT      },
+    { N_("Media Rewind"),      KEY_MEDIA_REWIND      },
+    { N_("Media Select"),      KEY_MEDIA_SELECT      },
+    { N_("Media Shuffle"),     KEY_MEDIA_SHUFFLE     },
+    { N_("Media Stop"),        KEY_MEDIA_STOP        },
+    { N_("Media Subtitle"),    KEY_MEDIA_SUBTITLE    },
+    { N_("Media Time"),        KEY_MEDIA_TIME        },
+    { N_("Media View"),        KEY_MEDIA_VIEW        },
+    { N_("Menu"),              KEY_MENU              },
+    { N_("Mouse Wheel Down"),  KEY_MOUSEWHEELDOWN    },
+    { N_("Mouse Wheel Left"),  KEY_MOUSEWHEELLEFT    },
+    { N_("Mouse Wheel Right"), KEY_MOUSEWHEELRIGHT   },
+    { N_("Mouse Wheel Up"),    KEY_MOUSEWHEELUP      },
+    { N_("Page Down"),         KEY_PAGEDOWN          },
+    { N_("Page Up"),           KEY_PAGEUP            },
+    { N_("Pause"),             KEY_PAUSE             },
+    { N_("Print"),             KEY_PRINT             },
+    { N_("Right"),             KEY_RIGHT             },
+    { N_("Space"),             ' '                   },
+    { N_("Tab"),               KEY_TAB               },
+    { N_("Unset"),             KEY_UNSET             },
+    { N_("Up"),                KEY_UP                },
+    { N_("Volume Down"),       KEY_VOLUME_DOWN       },
+    { N_("Volume Mute"),       KEY_VOLUME_MUTE       },
+    { N_("Volume Up"),         KEY_VOLUME_UP         },
+    { N_("Zoom In"),           KEY_ZOOM_IN           },
+    { N_("Zoom Out"),          KEY_ZOOM_OUT          },
+};
+#define KEYS_COUNT (sizeof(vlc_keys)/sizeof(vlc_keys[0]))
+
+static int keystrcmp (const void *key, const void *elem)
+{
+    const char *sa = key, *sb = elem;
+    return strcmp (sa, sb);
+}
+
+/* Convert Unicode code point to UTF-8 */
+static char *utf8_cp (uint_fast32_t cp, char *buf)
+{
+    if (cp < (1 << 7))
+    {
+        buf[1] = 0;
+        buf[0] = cp;
+    }
+    else if (cp < (1 << 11))
+    {
+        buf[2] = 0;
+        buf[1] = 0x80 | (cp & 0x3F);
+        cp >>= 6;
+        buf[0] = 0xC0 | cp;
+    }
+    else if (cp < (1 << 16))
+    {
+        buf[3] = 0;
+        buf[2] = 0x80 | (cp & 0x3F);
+        cp >>= 6;
+        buf[1] = 0x80 | (cp & 0x3F);
+        cp >>= 6;
+        buf[0] = 0xE0 | cp;
+    }
+    else if (cp < (1 << 21))
+    {
+        buf[4] = 0;
+        buf[3] = 0x80 | (cp & 0x3F);
+        cp >>= 6;
+        buf[2] = 0x80 | (cp & 0x3F);
+        cp >>= 6;
+        buf[1] = 0x80 | (cp & 0x3F);
+        cp >>= 6;
+        buf[0] = 0xE0 | cp;
+    }
+    else
+        return NULL;
+    return buf;
+}
+
+/**
+ * Parse a human-readable string representation of a VLC key code.
+ * @note This only works with the American English representation
+ * (a.k.a. C or POSIX), not with the local representation returned from
+ * vlc_keycode2str().
+ * @return a VLC key code, or KEY_UNSET on failure.
+ */
+uint_fast32_t vlc_str2keycode (const char *name)
+{
+    uint_fast32_t mods = 0;
+    uint32_t code;
+
+    for (;;)
+    {
+        size_t len = strcspn (name, "-+");
+        if (len == 0 || name[len] == '\0')
+            break;
+
+        if (len == 4 && !strncasecmp (name, "Ctrl", 4))
+            mods |= KEY_MODIFIER_CTRL;
+        if (len == 3 && !strncasecmp (name, "Alt", 3))
+            mods |= KEY_MODIFIER_ALT;
+        if (len == 5 && !strncasecmp (name, "Shift", 5))
+            mods |= KEY_MODIFIER_SHIFT;
+        if (len == 4 && !strncasecmp (name, "Meta", 4))
+            mods |= KEY_MODIFIER_META;
+        if (len == 7 && !strncasecmp (name, "Command", 7))
+            mods |= KEY_MODIFIER_COMMAND;
+
+        name += len + 1;
+    }
+
+    key_descriptor_t *d = bsearch (name, vlc_keys, KEYS_COUNT,
+                                   sizeof (vlc_keys[0]), keystrcmp);
+    if (d != NULL)
+        code = d->i_key_code;
+    else
+    if (vlc_towc (name, &code) <= 0)
+        code = KEY_UNSET;
+
+    if (code != KEY_UNSET)
+        code |= mods;
+    return code;
+}
+
+static char *nooptext (const char *txt)
+{
+    return (char *)txt;
+}
+
+/**
+ * Format a human-readable and unique representation of a VLC key code
+ * (including modifiers).
+ * @param code key code to translate to a string
+ * @param locale true to get a localized string,
+ *               false to get a C string suitable for 'vlcrc'
+ * @return a heap-allocated string, or NULL on error.
+ */
+char *vlc_keycode2str (uint_fast32_t code, bool locale)
+{
+    char *(*tr) (const char *) = locale ? vlc_gettext : nooptext;
+    const char *name;
+    char *str, buf[5];
+    uintptr_t key = code & ~KEY_MODIFIER;
+
+    for (size_t i = 0; i < KEYS_COUNT; i++)
+        if (vlc_keys[i].i_key_code == key)
+        {
+            name = vlc_keys[i].psz_key_string;
+            goto found;
+        }
+
+    if (utf8_cp (key, buf) == NULL)
+        return NULL;
+    name = buf;
+
+found:
+    if (asprintf (&str, "%s%s%s%s%s%s",
+                  (code & KEY_MODIFIER_CTRL) ? tr(N_("Ctrl+")) : "",
+                  (code & KEY_MODIFIER_ALT) ? tr(N_("Alt+")) : "",
+                  (code & KEY_MODIFIER_SHIFT) ? tr(N_("Shift+")) : "",
+                  (code & KEY_MODIFIER_META) ? tr(N_("Meta+")) : "",
+                  (code & KEY_MODIFIER_COMMAND) ? tr(N_("Command+")) : "",
+                  tr(name)) == -1)
+        return NULL;
+    return str;
+}
+
+
+/*** VLC key map ***/
+
+#define MAXACTION 26
+struct action
+{
+    char name[MAXACTION];
+    vlc_action_id_t value;
+};
+
+static const struct action actions[] =
+{
+    /* *MUST* be sorted (ASCII order) */
+    { "aspect-ratio", ACTIONID_ASPECT_RATIO, },
+    { "audio-track", ACTIONID_AUDIO_TRACK, },
+    { "audiodelay-down", ACTIONID_AUDIODELAY_DOWN, },
+    { "audiodelay-up", ACTIONID_AUDIODELAY_UP, },
+    { "audiodevice-cycle", ACTIONID_AUDIODEVICE_CYCLE, },
+    { "chapter-next", ACTIONID_CHAPTER_NEXT, },
+    { "chapter-prev", ACTIONID_CHAPTER_PREV, },
+    { "clear-playlist", ACTIONID_PLAY_CLEAR, },
+    { "crop", ACTIONID_CROP, },
+    { "crop-bottom", ACTIONID_CROP_BOTTOM, },
+    { "crop-left", ACTIONID_CROP_LEFT, },
+    { "crop-right", ACTIONID_CROP_RIGHT, },
+    { "crop-top", ACTIONID_CROP_TOP, },
+    { "decr-scalefactor", ACTIONID_SCALE_DOWN, },
+    { "deinterlace", ACTIONID_DEINTERLACE, },
+    { "deinterlace-mode", ACTIONID_DEINTERLACE_MODE, },
+    { "disc-menu", ACTIONID_DISC_MENU, },
+    { "faster", ACTIONID_FASTER, },
+    { "frame-next", ACTIONID_FRAME_NEXT, },
+    { "incr-scalefactor", ACTIONID_SCALE_UP, },
+    { "intf-boss", ACTIONID_INTF_BOSS, },
+    { "intf-popup-menu", ACTIONID_INTF_POPUP_MENU, },
+    { "intf-show", ACTIONID_INTF_TOGGLE_FSC, },
+    { "jump+extrashort", ACTIONID_JUMP_FORWARD_EXTRASHORT, },
+    { "jump+long", ACTIONID_JUMP_FORWARD_LONG, },
+    { "jump+medium", ACTIONID_JUMP_FORWARD_MEDIUM, },
+    { "jump+short", ACTIONID_JUMP_FORWARD_SHORT, },
+    { "jump-extrashort", ACTIONID_JUMP_BACKWARD_EXTRASHORT, },
+    { "jump-long", ACTIONID_JUMP_BACKWARD_LONG, },
+    { "jump-medium", ACTIONID_JUMP_BACKWARD_MEDIUM, },
+    { "jump-short", ACTIONID_JUMP_BACKWARD_SHORT, },
+    { "leave-fullscreen", ACTIONID_LEAVE_FULLSCREEN, },
+    { "loop", ACTIONID_LOOP, },
+    { "nav-activate", ACTIONID_NAV_ACTIVATE, },
+    { "nav-down", ACTIONID_NAV_DOWN, },
+    { "nav-left", ACTIONID_NAV_LEFT, },
+    { "nav-right", ACTIONID_NAV_RIGHT, },
+    { "nav-up", ACTIONID_NAV_UP, },
+    { "next", ACTIONID_NEXT, },
+    { "pause", ACTIONID_PAUSE, },
+    { "play", ACTIONID_PLAY, },
+    { "play-bookmark1", ACTIONID_PLAY_BOOKMARK1, },
+    { "play-bookmark10", ACTIONID_PLAY_BOOKMARK10, },
+    { "play-bookmark2", ACTIONID_PLAY_BOOKMARK2, },
+    { "play-bookmark3", ACTIONID_PLAY_BOOKMARK3, },
+    { "play-bookmark4", ACTIONID_PLAY_BOOKMARK4, },
+    { "play-bookmark5", ACTIONID_PLAY_BOOKMARK5, },
+    { "play-bookmark6", ACTIONID_PLAY_BOOKMARK6, },
+    { "play-bookmark7", ACTIONID_PLAY_BOOKMARK7, },
+    { "play-bookmark8", ACTIONID_PLAY_BOOKMARK8, },
+    { "play-bookmark9", ACTIONID_PLAY_BOOKMARK9, },
+    { "play-pause", ACTIONID_PLAY_PAUSE, },
+    { "position", ACTIONID_POSITION, },
+    { "prev", ACTIONID_PREV, },
+    { "program-sid-next", ACTIONID_PROGRAM_SID_NEXT, },
+    { "program-sid-prev", ACTIONID_PROGRAM_SID_PREV, },
+    { "quit", ACTIONID_QUIT, },
+    { "random", ACTIONID_RANDOM, },
+    { "rate-faster-fine", ACTIONID_RATE_FASTER_FINE, },
+    { "rate-normal", ACTIONID_RATE_NORMAL, },
+    { "rate-slower-fine", ACTIONID_RATE_SLOWER_FINE, },
+    { "record", ACTIONID_RECORD, },
+    { "set-bookmark1", ACTIONID_SET_BOOKMARK1, },
+    { "set-bookmark10", ACTIONID_SET_BOOKMARK10, },
+    { "set-bookmark2", ACTIONID_SET_BOOKMARK2, },
+    { "set-bookmark3", ACTIONID_SET_BOOKMARK3, },
+    { "set-bookmark4", ACTIONID_SET_BOOKMARK4, },
+    { "set-bookmark5", ACTIONID_SET_BOOKMARK5, },
+    { "set-bookmark6", ACTIONID_SET_BOOKMARK6, },
+    { "set-bookmark7", ACTIONID_SET_BOOKMARK7, },
+    { "set-bookmark8", ACTIONID_SET_BOOKMARK8, },
+    { "set-bookmark9", ACTIONID_SET_BOOKMARK9, },
+    { "slower", ACTIONID_SLOWER, },
+    { "snapshot", ACTIONID_SNAPSHOT, },
+    { "stop", ACTIONID_STOP, },
+    { "subdelay-down", ACTIONID_SUBDELAY_DOWN, },
+    { "subdelay-up", ACTIONID_SUBDELAY_UP, },
+    { "subpos-down", ACTIONID_SUBPOS_DOWN, },
+    { "subpos-up", ACTIONID_SUBPOS_UP, },
+    { "subsync-apply", ACTIONID_SUBSYNC_APPLY, },
+    { "subsync-markaudio", ACTIONID_SUBSYNC_MARKAUDIO, },
+    { "subsync-marksub", ACTIONID_SUBSYNC_MARKSUB, },
+    { "subsync-reset", ACTIONID_SUBSYNC_RESET, },
+    { "subtitle-revtrack", ACTIONID_SUBTITLE_REVERSE_TRACK, },
+    { "subtitle-text-scale-down", ACTIONID_SUBTITLE_TEXT_SCALE_DOWN, },
+    { "subtitle-text-scale-normal", ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL, },
+    { "subtitle-text-scale-up", ACTIONID_SUBTITLE_TEXT_SCALE_UP, },
+    { "subtitle-toggle", ACTIONID_SUBTITLE_TOGGLE, },
+    { "subtitle-track", ACTIONID_SUBTITLE_TRACK, },
+    { "title-next", ACTIONID_TITLE_NEXT, },
+    { "title-prev", ACTIONID_TITLE_PREV, },
+    { "toggle-autoscale", ACTIONID_TOGGLE_AUTOSCALE, },
+    { "toggle-fullscreen", ACTIONID_TOGGLE_FULLSCREEN, },
+    { "uncrop-bottom", ACTIONID_UNCROP_BOTTOM, },
+    { "uncrop-left", ACTIONID_UNCROP_LEFT, },
+    { "uncrop-right", ACTIONID_UNCROP_RIGHT, },
+    { "uncrop-top", ACTIONID_UNCROP_TOP, },
+    { "unzoom", ACTIONID_UNZOOM, },
+    { "viewpoint-fov-in", ACTIONID_VIEWPOINT_FOV_IN, },
+    { "viewpoint-fov-out", ACTIONID_VIEWPOINT_FOV_OUT, },
+    { "viewpoint-roll-anticlock", ACTIONID_VIEWPOINT_ROLL_ANTICLOCK, },
+    { "viewpoint-roll-clock", ACTIONID_VIEWPOINT_ROLL_CLOCK, },
+    { "vol-down", ACTIONID_VOL_DOWN, },
+    { "vol-mute", ACTIONID_VOL_MUTE, },
+    { "vol-up", ACTIONID_VOL_UP, },
+    { "wallpaper", ACTIONID_WALLPAPER, },
+    { "zoom", ACTIONID_ZOOM, },
+    { "zoom-double", ACTIONID_ZOOM_DOUBLE, },
+    { "zoom-half", ACTIONID_ZOOM_HALF, },
+    { "zoom-original", ACTIONID_ZOOM_ORIGINAL, },
+    { "zoom-quarter", ACTIONID_ZOOM_QUARTER, },
+};
+#define ACTIONS_COUNT (sizeof (actions) / sizeof (actions[0]))
+
+struct mapping
+{
+    uint32_t     key; ///< Key code
+    vlc_action_id_t action; ///< Action ID
+};
+
+static int keycmp (const void *a, const void *b)
+{
+    const struct mapping *ka = a, *kb = b;
+
+    return (ka->key < kb->key) ? -1 : (ka->key > kb->key) ? +1 : 0;
+}
+
+struct vlc_actions
+{
+    void *map; /* Key map */
+    void *global_map; /* Grabbed/global key map */
+    struct hotkey keys[1];
+};
+
+static int vlc_key_to_action (vlc_object_t *obj, const char *varname,
+                              vlc_value_t prevkey, vlc_value_t curkey, void *d)
+{
+    void *const *map = d;
+    const struct mapping **pent;
+    uint32_t keycode = curkey.i_int;
+
+    pent = tfind (&keycode, map, keycmp);
+    if (pent == NULL)
+        return VLC_SUCCESS;
+
+    (void) varname;
+    (void) prevkey;
+    return var_SetInteger (obj, "key-action", (*pent)->action);
+}
+
+/**
+ * Adds a mapping from a certain key code to a certain action.
+ */
+static int vlc_AddMapping (void **map, uint32_t keycode, vlc_action_id_t action)
+{
+    struct mapping *entry = malloc (sizeof (*entry));
+    if (entry == NULL)
+        return ENOMEM;
+    entry->key = keycode;
+    entry->action = action;
+
+    struct mapping **pent = tsearch (entry, map, keycmp);
+    if (unlikely(pent == NULL))
+        return ENOMEM;
+    if (*pent != entry)
+    {
+        free (entry);
+        return EEXIST;
+    }
+    return 0;
+}
+
+static void vlc_AddWheelMapping (void **map, uint32_t kmore, uint32_t kless,
+                                 int mode)
+{
+    vlc_action_id_t amore = ACTIONID_NONE, aless = ACTIONID_NONE;
+
+    switch (mode)
+    {
+        case 0: /* volume up/down */
+            amore = ACTIONID_COMBO_VOL_FOV_UP;
+            aless = ACTIONID_COMBO_VOL_FOV_DOWN;
+            break;
+        case 2: /* position latter/earlier */
+            amore = ACTIONID_JUMP_FORWARD_EXTRASHORT;
+            aless = ACTIONID_JUMP_BACKWARD_EXTRASHORT;
+            break;
+        case 3: /* position earlier/latter */
+            amore = ACTIONID_JUMP_BACKWARD_EXTRASHORT;
+            aless = ACTIONID_JUMP_FORWARD_EXTRASHORT;
+            break;
+    }
+
+    if (amore != ACTIONID_NONE)
+        vlc_AddMapping (map, kmore, amore);
+    if (aless != ACTIONID_NONE)
+        vlc_AddMapping (map, kless, aless);
+}
+
+
+/**
+ * Sets up all key mappings for a given action.
+ * \param map tree (of struct mapping entries) to write mappings to
+ * \param confname VLC configuration item to read mappings from
+ * \param action action ID
+ */
+static void vlc_InitAction (vlc_object_t *obj, void **map,
+                            const char *confname, vlc_action_id_t action)
+{
+    char *keys = var_InheritString (obj, confname);
+    if (keys == NULL)
+        return;
+
+    for (char *buf, *key = strtok_r (keys, "\t", &buf);
+         key != NULL;
+         key = strtok_r (NULL, "\t", &buf))
+    {
+        uint32_t code = vlc_str2keycode (key);
+        if (code == KEY_UNSET)
+        {
+            msg_Warn (obj, "Key \"%s\" unrecognized", key);
+            continue;
+        }
+
+        if (vlc_AddMapping (map, code, action) == EEXIST)
+            msg_Warn (obj, "Key \"%s\" bound to multiple actions", key);
+    }
+    free (keys);
+}
+
+/**
+ * Initializes the key map from configuration.
+ */
+struct vlc_actions *vlc_InitActions (libvlc_int_t *libvlc)
+{
+    vlc_object_t *obj = VLC_OBJECT(libvlc);
+    struct hotkey *keys;
+    struct vlc_actions *as = malloc (sizeof (*as) + ACTIONS_COUNT * sizeof (*keys));
+
+    if (unlikely(as == NULL))
+        return NULL;
+    as->map = NULL;
+    as->global_map = NULL;
+    keys = as->keys;
+
+    var_Create (obj, "key-pressed", VLC_VAR_INTEGER);
+    var_Create (obj, "global-key-pressed", VLC_VAR_INTEGER);
+    var_Create (obj, "key-action", VLC_VAR_INTEGER);
+
+    /* Initialize from configuration */
+    for (size_t i = 0; i < ACTIONS_COUNT; i++)
+    {
+#ifndef NDEBUG
+        if (i > 0
+         && strcmp (actions[i-1].name, actions[i].name) >= 0)
+        {
+            msg_Err (libvlc, "key-%s and key-%s are not ordered properly",
+                     actions[i-1].name, actions[i].name);
+            abort ();
+        }
+#endif
+        keys->psz_action = actions[i].name;
+        keys++;
+
+        char name[12 + MAXACTION];
+
+        snprintf (name, sizeof (name), "global-key-%s", actions[i].name);
+        vlc_InitAction (obj, &as->map, name + 7, actions[i].value);
+        vlc_InitAction (obj, &as->global_map, name, actions[i].value);
+    }
+    keys->psz_action = NULL;
+
+    /* Initialize mouse wheel events */
+    vlc_AddWheelMapping (&as->map, KEY_MOUSEWHEELRIGHT, KEY_MOUSEWHEELLEFT,
+                         var_InheritInteger (obj, "hotkeys-x-wheel-mode"));
+    vlc_AddWheelMapping (&as->map, KEY_MOUSEWHEELUP, KEY_MOUSEWHEELDOWN,
+                         var_InheritInteger (obj, "hotkeys-y-wheel-mode"));
+
+    libvlc->p_hotkeys = as->keys;
+    var_AddCallback (obj, "key-pressed", vlc_key_to_action, &as->map);
+    var_AddCallback (obj, "global-key-pressed", vlc_key_to_action,
+                     &as->global_map);
+    return as;
+}
+
+/**
+ * Destroys the key map.
+ */
+void vlc_DeinitActions (libvlc_int_t *libvlc, struct vlc_actions *as)
+{
+    if (unlikely(as == NULL))
+        return;
+
+    var_DelCallback (libvlc, "global-key-pressed", vlc_key_to_action,
+                     &as->global_map);
+    var_DelCallback (libvlc, "key-pressed", vlc_key_to_action, &as->map);
+
+    tdestroy (as->global_map, free);
+    tdestroy (as->map, free);
+    free (as);
+    libvlc->p_hotkeys = NULL;
+}
+
+
+static int actcmp(const void *key, const void *ent)
+{
+    const struct action *act = ent;
+    return strcmp(key, act->name);
+}
+
+/**
+ * Get the action ID from the action name in the configuration subsystem.
+ * @return the action ID or ACTIONID_NONE on error.
+ */
+vlc_action_id_t vlc_GetActionId (const char *name)
+{
+    const struct action *act;
+
+    if (strncmp (name, "key-", 4))
+        return ACTIONID_NONE;
+    name += 4;
+
+    act = bsearch(name, actions, ACTIONS_COUNT, sizeof(*act), actcmp);
+    return (act != NULL) ? act->value : ACTIONID_NONE;
+}