diff options
author | Vivek Jain <viveksjain@gmail.com> | 2013-11-30 21:23:39 -0800 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-12-02 09:03:31 +0100 |
commit | 6fb020f5de1487484712e7113db0e86dd97481bd (patch) | |
tree | 7561b28161f061d8b6c3a1146f131361b59fd686 /mpvcore/input | |
parent | a74d9c1803462e0f7862f7b0659ab70939b92e15 (diff) | |
download | mpv-6fb020f5de1487484712e7113db0e86dd97481bd.tar.bz2 mpv-6fb020f5de1487484712e7113db0e86dd97481bd.tar.xz |
options: add option to disable using right Alt key as Alt Gr
mpv was hardcoded to always consider the right Alt key as Alt Gr, but there
are parituclar combinations of platforms and keyboard layouts where it's more
convenient to treat the right Alt as a keyboard modifier just like the left
one.
Fixes #388
Diffstat (limited to 'mpvcore/input')
-rw-r--r-- | mpvcore/input/input.c | 11 | ||||
-rw-r--r-- | mpvcore/input/input.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c index c1711a94d8..8b31352f72 100644 --- a/mpvcore/input/input.c +++ b/mpvcore/input/input.c @@ -550,6 +550,7 @@ struct input_ctx { pthread_mutex_t mutex; struct mp_log *log; + bool using_alt_gr; bool using_ar; bool using_cocoa_media_keys; @@ -635,6 +636,7 @@ const m_option_t mp_input_opts[] = { OPT_FLAG("joystick", input.use_joystick, CONF_GLOBAL), OPT_FLAG("lirc", input.use_lirc, CONF_GLOBAL), OPT_FLAG("lircc", input.use_lircc, CONF_GLOBAL), + OPT_FLAG("right-alt-gr", input.use_alt_gr, CONF_GLOBAL), #if HAVE_COCOA OPT_FLAG("ar", input.use_ar, CONF_GLOBAL), OPT_FLAG("media-keys", input.use_media_keys, CONF_GLOBAL), @@ -2387,6 +2389,10 @@ struct input_ctx *mp_input_init(struct mpv_global *global) } #endif + if (input_conf->use_alt_gr) { + ictx->using_alt_gr = true; + } + #if HAVE_COCOA if (input_conf->use_ar) { cocoa_init_apple_remote(); @@ -2528,3 +2534,8 @@ unsigned int mp_input_get_mouse_event_counter(struct input_ctx *ictx) input_unlock(ictx); return ret; } + +bool mp_input_use_alt_gr(struct input_ctx *ictx) +{ + return ictx->using_alt_gr; +} diff --git a/mpvcore/input/input.h b/mpvcore/input/input.h index 9e897abbbb..2465fe6010 100644 --- a/mpvcore/input/input.h +++ b/mpvcore/input/input.h @@ -287,6 +287,10 @@ void mp_input_wakeup(struct input_ctx *ictx); // Interruptible usleep: (used by demux) int mp_input_check_interrupt(struct input_ctx *ictx, int time); +// If this returns true, use Right Alt key as Alt Gr to produce special +// characters. If false, count Right Alt as the modifier Alt key. +bool mp_input_use_alt_gr(struct input_ctx *ictx); + extern int async_quit_request; #endif /* MPLAYER_INPUT_H */ |