diff options
author | wm4 <wm4@nowhere> | 2014-02-19 15:40:04 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-19 15:40:04 +0100 |
commit | 57c9f5236a43efd9d979b7ee18a25de2d3d88dd5 (patch) | |
tree | d0403c586f3a59c33282e5187c8a6c553955e01a | |
parent | 8b57e4bc1290fd1d6eba7a379e7fa04fc602c945 (diff) | |
download | mpv-57c9f5236a43efd9d979b7ee18a25de2d3d88dd5.tar.bz2 mpv-57c9f5236a43efd9d979b7ee18a25de2d3d88dd5.tar.xz |
input, dvdnav: fix osc stealing input from dvdnav
This is a regression introduced from moving Lua scripts (including the
OSC) to their own threads. Now OSC and dvdnav can add their bindings at
the same time without coordination, which seems to result in the OSC
winning most time, and thus overriding the dvdnav menu bindings.
Fix this by adding a flag that makes dvdnav menu bindings take priority
over all other bindings.
-rw-r--r-- | input/input.c | 14 | ||||
-rw-r--r-- | input/input.h | 6 | ||||
-rw-r--r-- | player/dvdnav.c | 3 |
3 files changed, 18 insertions, 5 deletions
diff --git a/input/input.c b/input/input.c index 41eb794a0e..76cd571a04 100644 --- a/input/input.c +++ b/input/input.c @@ -1220,8 +1220,18 @@ void mp_input_enable_section(struct input_ctx *ictx, char *name, int flags) MP_VERBOSE(ictx, "enable section '%s'\n", name); if (ictx->num_active_sections < MAX_ACTIVE_SECTIONS) { - ictx->active_sections[ictx->num_active_sections++] = - (struct active_section) {name, flags}; + int top = ictx->num_active_sections; + if (!(flags & MP_INPUT_ON_TOP)) { + // insert before the first top entry + for (top = 0; top < ictx->num_active_sections; top++) { + if (ictx->active_sections[top].flags & MP_INPUT_ON_TOP) + break; + } + for (int n = ictx->num_active_sections; n > top; n--) + ictx->active_sections[n] = ictx->active_sections[n - 1]; + } + ictx->active_sections[top] = (struct active_section){name, flags}; + ictx->num_active_sections++; } MP_DBG(ictx, "active section stack:\n"); diff --git a/input/input.h b/input/input.h index 55fd4875de..ee66ff6f8a 100644 --- a/input/input.h +++ b/input/input.h @@ -57,10 +57,12 @@ enum mp_input_section_flags { // other sections for it (like the default section). Instead, an unbound // key warning will be printed. MP_INPUT_EXCLUSIVE = 1, + // Prefer it to other sections. + MP_INPUT_ON_TOP = 2, // Let mp_input_test_dragging() return true, even if inside the mouse area. - MP_INPUT_ALLOW_VO_DRAGGING = 2, + MP_INPUT_ALLOW_VO_DRAGGING = 4, // Don't force mouse pointer visible, even if inside the mouse area. - MP_INPUT_ALLOW_HIDE_CURSOR = 4, + MP_INPUT_ALLOW_HIDE_CURSOR = 8, }; struct input_ctx; diff --git a/player/dvdnav.c b/player/dvdnav.c index fd370599c6..5b40f1256f 100644 --- a/player/dvdnav.c +++ b/player/dvdnav.c @@ -164,7 +164,8 @@ void mp_handle_nav(struct MPContext *mpctx) case MP_NAV_EVENT_MENU_MODE: nav->nav_menu = ev->u.menu_mode.enable; if (nav->nav_menu) { - mp_input_enable_section(mpctx->input, "dvdnav-menu", 0); + mp_input_enable_section(mpctx->input, "dvdnav-menu", + MP_INPUT_ON_TOP); } else { mp_input_disable_section(mpctx->input, "dvdnav-menu"); } |