Commit fa0a6fcc authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove many copies of "key-" in the list of actions

parent ad6f9674
...@@ -225,117 +225,117 @@ found: ...@@ -225,117 +225,117 @@ found:
/*** VLC key map ***/ /*** VLC key map ***/
#define MAXACTION 20
struct action struct action
{ {
char name[24]; char name[MAXACTION];
int value; vlc_key_t value;
}; };
static const struct action actions[] = static const struct action actions[] =
{ {
/* *MUST* be sorted (ASCII order) */ /* *MUST* be sorted (ASCII order) */
{ "key-aspect-ratio", ACTIONID_ASPECT_RATIO, }, { "aspect-ratio", ACTIONID_ASPECT_RATIO, },
{ "key-audio-track", ACTIONID_AUDIO_TRACK, }, { "audio-track", ACTIONID_AUDIO_TRACK, },
{ "key-audiodelay-down", ACTIONID_AUDIODELAY_DOWN, }, { "audiodelay-down", ACTIONID_AUDIODELAY_DOWN, },
{ "key-audiodelay-up", ACTIONID_AUDIODELAY_UP, }, { "audiodelay-up", ACTIONID_AUDIODELAY_UP, },
{ "key-audiodevice-cycle", ACTIONID_AUDIODEVICE_CYCLE, }, { "audiodevice-cycle", ACTIONID_AUDIODEVICE_CYCLE, },
{ "key-chapter-next", ACTIONID_CHAPTER_NEXT, }, { "chapter-next", ACTIONID_CHAPTER_NEXT, },
{ "key-chapter-prev", ACTIONID_CHAPTER_PREV, }, { "chapter-prev", ACTIONID_CHAPTER_PREV, },
{ "key-crop", ACTIONID_CROP, }, { "crop", ACTIONID_CROP, },
{ "key-crop-bottom", ACTIONID_CROP_BOTTOM, }, { "crop-bottom", ACTIONID_CROP_BOTTOM, },
{ "key-crop-left", ACTIONID_CROP_LEFT, }, { "crop-left", ACTIONID_CROP_LEFT, },
{ "key-crop-right", ACTIONID_CROP_RIGHT, }, { "crop-right", ACTIONID_CROP_RIGHT, },
{ "key-crop-top", ACTIONID_CROP_TOP, }, { "crop-top", ACTIONID_CROP_TOP, },
{ "key-decr-scalefactor", ACTIONID_SCALE_DOWN, }, { "decr-scalefactor", ACTIONID_SCALE_DOWN, },
{ "key-deinterlace", ACTIONID_DEINTERLACE, }, { "deinterlace", ACTIONID_DEINTERLACE, },
{ "key-disc-menu", ACTIONID_DISC_MENU, }, { "disc-menu", ACTIONID_DISC_MENU, },
{ "key-faster", ACTIONID_FASTER, }, { "faster", ACTIONID_FASTER, },
{ "key-frame-next", ACTIONID_FRAME_NEXT, }, { "frame-next", ACTIONID_FRAME_NEXT, },
{ "key-incr-scalefactor", ACTIONID_SCALE_UP, }, { "incr-scalefactor", ACTIONID_SCALE_UP, },
{ "key-intf-hide", ACTIONID_INTF_HIDE, }, { "intf-hide", ACTIONID_INTF_HIDE, },
{ "key-intf-show", ACTIONID_INTF_SHOW, }, { "intf-show", ACTIONID_INTF_SHOW, },
{ "key-jump+extrashort", ACTIONID_JUMP_FORWARD_EXTRASHORT, }, { "jump+extrashort", ACTIONID_JUMP_FORWARD_EXTRASHORT, },
{ "key-jump+long", ACTIONID_JUMP_FORWARD_LONG, }, { "jump+long", ACTIONID_JUMP_FORWARD_LONG, },
{ "key-jump+medium", ACTIONID_JUMP_FORWARD_MEDIUM, }, { "jump+medium", ACTIONID_JUMP_FORWARD_MEDIUM, },
{ "key-jump+short", ACTIONID_JUMP_FORWARD_SHORT, }, { "jump+short", ACTIONID_JUMP_FORWARD_SHORT, },
{ "key-jump-extrashort", ACTIONID_JUMP_BACKWARD_EXTRASHORT, }, { "jump-extrashort", ACTIONID_JUMP_BACKWARD_EXTRASHORT, },
{ "key-jump-long", ACTIONID_JUMP_BACKWARD_LONG, }, { "jump-long", ACTIONID_JUMP_BACKWARD_LONG, },
{ "key-jump-medium", ACTIONID_JUMP_BACKWARD_MEDIUM, }, { "jump-medium", ACTIONID_JUMP_BACKWARD_MEDIUM, },
{ "key-jump-short", ACTIONID_JUMP_BACKWARD_SHORT, }, { "jump-short", ACTIONID_JUMP_BACKWARD_SHORT, },
{ "key-leave-fullscreen", ACTIONID_LEAVE_FULLSCREEN, }, { "leave-fullscreen", ACTIONID_LEAVE_FULLSCREEN, },
{ "key-loop", ACTIONID_LOOP, }, { "loop", ACTIONID_LOOP, },
{ "key-menu-down", ACTIONID_MENU_DOWN, }, { "menu-down", ACTIONID_MENU_DOWN, },
{ "key-menu-left", ACTIONID_MENU_LEFT, }, { "menu-left", ACTIONID_MENU_LEFT, },
{ "key-menu-off", ACTIONID_MENU_OFF, }, { "menu-off", ACTIONID_MENU_OFF, },
{ "key-menu-on", ACTIONID_MENU_ON, }, { "menu-on", ACTIONID_MENU_ON, },
{ "key-menu-right", ACTIONID_MENU_RIGHT, }, { "menu-right", ACTIONID_MENU_RIGHT, },
{ "key-menu-select", ACTIONID_MENU_SELECT, }, { "menu-select", ACTIONID_MENU_SELECT, },
{ "key-menu-up", ACTIONID_MENU_UP, }, { "menu-up", ACTIONID_MENU_UP, },
{ "key-nav-activate", ACTIONID_NAV_ACTIVATE, }, { "nav-activate", ACTIONID_NAV_ACTIVATE, },
{ "key-nav-down", ACTIONID_NAV_DOWN, }, { "nav-down", ACTIONID_NAV_DOWN, },
{ "key-nav-left", ACTIONID_NAV_LEFT, }, { "nav-left", ACTIONID_NAV_LEFT, },
{ "key-nav-right", ACTIONID_NAV_RIGHT, }, { "nav-right", ACTIONID_NAV_RIGHT, },
{ "key-nav-up", ACTIONID_NAV_UP, }, { "nav-up", ACTIONID_NAV_UP, },
{ "key-next", ACTIONID_NEXT, }, { "next", ACTIONID_NEXT, },
{ "key-pause", ACTIONID_PAUSE, }, { "pause", ACTIONID_PAUSE, },
{ "key-play", ACTIONID_PLAY, }, { "play", ACTIONID_PLAY, },
{ "key-play-bookmark1", ACTIONID_PLAY_BOOKMARK1, }, { "play-bookmark1", ACTIONID_PLAY_BOOKMARK1, },
{ "key-play-bookmark10", ACTIONID_PLAY_BOOKMARK10, }, { "play-bookmark10", ACTIONID_PLAY_BOOKMARK10, },
{ "key-play-bookmark2", ACTIONID_PLAY_BOOKMARK2, }, { "play-bookmark2", ACTIONID_PLAY_BOOKMARK2, },
{ "key-play-bookmark3", ACTIONID_PLAY_BOOKMARK3, }, { "play-bookmark3", ACTIONID_PLAY_BOOKMARK3, },
{ "key-play-bookmark4", ACTIONID_PLAY_BOOKMARK4, }, { "play-bookmark4", ACTIONID_PLAY_BOOKMARK4, },
{ "key-play-bookmark5", ACTIONID_PLAY_BOOKMARK5, }, { "play-bookmark5", ACTIONID_PLAY_BOOKMARK5, },
{ "key-play-bookmark6", ACTIONID_PLAY_BOOKMARK6, }, { "play-bookmark6", ACTIONID_PLAY_BOOKMARK6, },
{ "key-play-bookmark7", ACTIONID_PLAY_BOOKMARK7, }, { "play-bookmark7", ACTIONID_PLAY_BOOKMARK7, },
{ "key-play-bookmark8", ACTIONID_PLAY_BOOKMARK8, }, { "play-bookmark8", ACTIONID_PLAY_BOOKMARK8, },
{ "key-play-bookmark9", ACTIONID_PLAY_BOOKMARK9, }, { "play-bookmark9", ACTIONID_PLAY_BOOKMARK9, },
{ "key-play-pause", ACTIONID_PLAY_PAUSE, }, { "play-pause", ACTIONID_PLAY_PAUSE, },
{ "key-position", ACTIONID_POSITION, }, { "position", ACTIONID_POSITION, },
{ "key-prev", ACTIONID_PREV, }, { "prev", ACTIONID_PREV, },
{ "key-quit", ACTIONID_QUIT, }, { "quit", ACTIONID_QUIT, },
{ "key-random", ACTIONID_RANDOM, }, { "random", ACTIONID_RANDOM, },
{ "key-rate-faster-fine", ACTIONID_RATE_FASTER_FINE, }, { "rate-faster-fine", ACTIONID_RATE_FASTER_FINE, },
{ "key-rate-normal", ACTIONID_RATE_NORMAL, }, { "rate-normal", ACTIONID_RATE_NORMAL, },
{ "key-rate-slower-fine", ACTIONID_RATE_SLOWER_FINE, }, { "rate-slower-fine", ACTIONID_RATE_SLOWER_FINE, },
{ "key-record", ACTIONID_RECORD, }, { "record", ACTIONID_RECORD, },
{ "key-set-bookmark1", ACTIONID_SET_BOOKMARK1, }, { "set-bookmark1", ACTIONID_SET_BOOKMARK1, },
{ "key-set-bookmark10", ACTIONID_SET_BOOKMARK10, }, { "set-bookmark10", ACTIONID_SET_BOOKMARK10, },
{ "key-set-bookmark2", ACTIONID_SET_BOOKMARK2, }, { "set-bookmark2", ACTIONID_SET_BOOKMARK2, },
{ "key-set-bookmark3", ACTIONID_SET_BOOKMARK3, }, { "set-bookmark3", ACTIONID_SET_BOOKMARK3, },
{ "key-set-bookmark4", ACTIONID_SET_BOOKMARK4, }, { "set-bookmark4", ACTIONID_SET_BOOKMARK4, },
{ "key-set-bookmark5", ACTIONID_SET_BOOKMARK5, }, { "set-bookmark5", ACTIONID_SET_BOOKMARK5, },
{ "key-set-bookmark6", ACTIONID_SET_BOOKMARK6, }, { "set-bookmark6", ACTIONID_SET_BOOKMARK6, },
{ "key-set-bookmark7", ACTIONID_SET_BOOKMARK7, }, { "set-bookmark7", ACTIONID_SET_BOOKMARK7, },
{ "key-set-bookmark8", ACTIONID_SET_BOOKMARK8, }, { "set-bookmark8", ACTIONID_SET_BOOKMARK8, },
{ "key-set-bookmark9", ACTIONID_SET_BOOKMARK9, }, { "set-bookmark9", ACTIONID_SET_BOOKMARK9, },
{ "key-slower", ACTIONID_SLOWER, }, { "slower", ACTIONID_SLOWER, },
{ "key-snapshot", ACTIONID_SNAPSHOT, }, { "snapshot", ACTIONID_SNAPSHOT, },
{ "key-stop", ACTIONID_STOP, }, { "stop", ACTIONID_STOP, },
{ "key-subdelay-down", ACTIONID_SUBDELAY_DOWN, }, { "subdelay-down", ACTIONID_SUBDELAY_DOWN, },
{ "key-subdelay-up", ACTIONID_SUBDELAY_UP, }, { "subdelay-up", ACTIONID_SUBDELAY_UP, },
{ "key-subpos-down", ACTIONID_SUBPOS_DOWN, }, { "subpos-down", ACTIONID_SUBPOS_DOWN, },
{ "key-subpos-up", ACTIONID_SUBPOS_UP, }, { "subpos-up", ACTIONID_SUBPOS_UP, },
{ "key-subtitle-track", ACTIONID_SUBTITLE_TRACK, }, { "subtitle-track", ACTIONID_SUBTITLE_TRACK, },
{ "key-title-next", ACTIONID_TITLE_NEXT, }, { "title-next", ACTIONID_TITLE_NEXT, },
{ "key-title-prev", ACTIONID_TITLE_PREV, }, { "title-prev", ACTIONID_TITLE_PREV, },
{ "key-toggle-autoscale", ACTIONID_TOGGLE_AUTOSCALE, }, { "toggle-autoscale", ACTIONID_TOGGLE_AUTOSCALE, },
{ "key-toggle-fullscreen", ACTIONID_TOGGLE_FULLSCREEN, }, { "toggle-fullscreen", ACTIONID_TOGGLE_FULLSCREEN, },
{ "key-uncrop-bottom", ACTIONID_UNCROP_BOTTOM, }, { "uncrop-bottom", ACTIONID_UNCROP_BOTTOM, },
{ "key-uncrop-left", ACTIONID_UNCROP_LEFT, }, { "uncrop-left", ACTIONID_UNCROP_LEFT, },
{ "key-uncrop-right", ACTIONID_UNCROP_RIGHT, }, { "uncrop-right", ACTIONID_UNCROP_RIGHT, },
{ "key-uncrop-top", ACTIONID_UNCROP_TOP, }, { "uncrop-top", ACTIONID_UNCROP_TOP, },
{ "key-unzoom", ACTIONID_UNZOOM, }, { "unzoom", ACTIONID_UNZOOM, },
{ "key-vol-down", ACTIONID_VOL_DOWN, }, { "vol-down", ACTIONID_VOL_DOWN, },
{ "key-vol-mute", ACTIONID_VOL_MUTE, }, { "vol-mute", ACTIONID_VOL_MUTE, },
{ "key-vol-up", ACTIONID_VOL_UP, }, { "vol-up", ACTIONID_VOL_UP, },
{ "key-wallpaper", ACTIONID_WALLPAPER, }, { "wallpaper", ACTIONID_WALLPAPER, },
{ "key-zoom", ACTIONID_ZOOM, }, { "zoom", ACTIONID_ZOOM, },
{ "key-zoom-double", ACTIONID_ZOOM_DOUBLE, }, { "zoom-double", ACTIONID_ZOOM_DOUBLE, },
{ "key-zoom-half", ACTIONID_ZOOM_HALF, }, { "zoom-half", ACTIONID_ZOOM_HALF, },
{ "key-zoom-original", ACTIONID_ZOOM_ORIGINAL, }, { "zoom-original", ACTIONID_ZOOM_ORIGINAL, },
{ "key-zoom-quarter", ACTIONID_ZOOM_QUARTER, }, { "zoom-quarter", ACTIONID_ZOOM_QUARTER, },
}; };
#define ACTIONS_COUNT (sizeof (actions) / sizeof (actions[0])) #define ACTIONS_COUNT (sizeof (actions) / sizeof (actions[0]))
struct mapping struct mapping
...@@ -442,7 +442,7 @@ struct vlc_actions *vlc_InitActions (libvlc_int_t *libvlc) ...@@ -442,7 +442,7 @@ struct vlc_actions *vlc_InitActions (libvlc_int_t *libvlc)
if (i > 0 if (i > 0
&& strcmp (actions[i-1].name, actions[i].name) >= 0) && strcmp (actions[i-1].name, actions[i].name) >= 0)
{ {
msg_Err (libvlc, "%s and %s are not ordered properly", msg_Err (libvlc, "key-%s and key-%s are not ordered properly",
actions[i-1].name, actions[i].name); actions[i-1].name, actions[i].name);
abort (); abort ();
} }
...@@ -451,9 +451,9 @@ struct vlc_actions *vlc_InitActions (libvlc_int_t *libvlc) ...@@ -451,9 +451,9 @@ struct vlc_actions *vlc_InitActions (libvlc_int_t *libvlc)
keys->i_action = actions[i].value; keys->i_action = actions[i].value;
keys++; keys++;
char name[32]; char name[12 + MAXACTION];
snprintf (name, sizeof (name), "global-%s", actions[i].name); snprintf (name, sizeof (name), "global-key-%s", actions[i].name);
vlc_MapAction (obj, &as->map, name + 7, actions[i].value); vlc_MapAction (obj, &as->map, name + 7, actions[i].value);
vlc_MapAction (obj, &as->global_map, name, actions[i].value); vlc_MapAction (obj, &as->global_map, name, actions[i].value);
} }
...@@ -501,6 +501,10 @@ vlc_key_t vlc_GetActionId(const char *name) ...@@ -501,6 +501,10 @@ vlc_key_t vlc_GetActionId(const char *name)
{ {
const struct action *act; const struct action *act;
if (strncmp (name, "key-", 4))
return ACTIONID_NONE;
name += 4;
act = bsearch(name, actions, ACTIONS_COUNT, sizeof(*act), actcmp); act = bsearch(name, actions, ACTIONS_COUNT, sizeof(*act), actcmp);
return (act != NULL) ? act->value : ACTIONID_NONE; return (act != NULL) ? act->value : ACTIONID_NONE;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment