1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 09:32:40 +00:00

libmpv/cocoa: make global events work and get rid of is_cplayer

After @frau's split of macosx_events from macosx_application, `is_cplayer' is
not needed anymore. At the moment only global events such as Media Keys and
Apple Remote work, because the VO-level ones were hardcoded to be disabled.
(that will be fix in a later commit ).
This commit is contained in:
Stefano Pigozzi 2014-10-09 21:02:47 +02:00
parent d1e8bb0f9b
commit ca353fcf92
5 changed files with 15 additions and 10 deletions

View File

@ -90,6 +90,9 @@ static void wakeup(void *);
// NOTE: Interaction with the window seems to be broken for now. // NOTE: Interaction with the window seems to be broken for now.
check_error(mpv_set_option_string(mpv, "input-default-bindings", "yes")); check_error(mpv_set_option_string(mpv, "input-default-bindings", "yes"));
// for testing!
check_error(mpv_set_option_string(mpv, "input-media-keys", "yes"));
check_error(mpv_initialize(mpv)); check_error(mpv_initialize(mpv));
// Register to be woken up whenever mpv generates new events. // Register to be woken up whenever mpv generates new events.

View File

@ -2175,8 +2175,9 @@ Input
or intend to read from stdin later on via the loadfile or loadlist slave or intend to read from stdin later on via the loadfile or loadlist slave
commands. commands.
``--input-appleremote``, ``--no-input-appleremote`` ``--input-appleremote=<yes|no>``
Enable/disable AppleIR remote support. Enabled by default. (OS X only)
Enable/disable Apple Remote support. Enabled by default (except for libmpv).
``--input-cursor``, ``--no-input-cursor`` ``--input-cursor``, ``--no-input-cursor``
Permit mpv to receive pointer events reported by the video output Permit mpv to receive pointer events reported by the video output
@ -2196,8 +2197,9 @@ Input
(LIRC only) (LIRC only)
Specifies a configuration file for LIRC (default: ``~/.lircrc``). Specifies a configuration file for LIRC (default: ``~/.lircrc``).
``--input-media-keys``, ``--no-input-media-keys`` ``--input-media-keys=<yes|no>``
OS X only: Enabled by default. Enables/disable media keys support. (OS X only)
Enable/disable media keys support. Enabled by default (except for libmpv).
``--input-right-alt-gr``, ``--no-input-right-alt-gr`` ``--input-right-alt-gr``, ``--no-input-right-alt-gr``
(Cocoa and Windows only) (Cocoa and Windows only)

View File

@ -405,6 +405,8 @@ mpv_handle *mpv_create(void)
mpv_set_option_string(ctx, "input-default-bindings", "no"); mpv_set_option_string(ctx, "input-default-bindings", "no");
mpv_set_option_string(ctx, "input-vo-keyboard", "no"); mpv_set_option_string(ctx, "input-vo-keyboard", "no");
mpv_set_option_string(ctx, "input-lirc", "no"); mpv_set_option_string(ctx, "input-lirc", "no");
mpv_set_option_string(ctx, "input-media-keys", "no");
mpv_set_option_string(ctx, "input-appleremote", "no");
} else { } else {
mp_destroy(mpctx); mp_destroy(mpctx);
} }

View File

@ -150,7 +150,6 @@ enum playback_status {
typedef struct MPContext { typedef struct MPContext {
bool initialized; bool initialized;
bool is_cplayer;
bool autodetach; bool autodetach;
struct mpv_global *global; struct mpv_global *global;
struct MPOpts *opts; struct MPOpts *opts;

View File

@ -72,6 +72,8 @@
#if HAVE_COCOA_APPLICATION #if HAVE_COCOA_APPLICATION
#include "osdep/macosx_application.h" #include "osdep/macosx_application.h"
#endif
#if HAVE_COCOA
#include "osdep/macosx_events.h" #include "osdep/macosx_events.h"
#endif #endif
@ -418,9 +420,8 @@ int mp_initialize(struct MPContext *mpctx)
mp_get_resume_defaults(mpctx); mp_get_resume_defaults(mpctx);
#if HAVE_COCOA_APPLICATION #if HAVE_COCOA
if (mpctx->is_cplayer) cocoa_set_input_context(mpctx->input);
cocoa_set_input_context(mpctx->input);
#endif #endif
if (opts->force_vo) { if (opts->force_vo) {
@ -465,8 +466,6 @@ int mpv_main(int argc, char *argv[])
struct MPContext *mpctx = mp_create(); struct MPContext *mpctx = mp_create();
struct MPOpts *opts = mpctx->opts; struct MPOpts *opts = mpctx->opts;
mpctx->is_cplayer = true;
char *verbose_env = getenv("MPV_VERBOSE"); char *verbose_env = getenv("MPV_VERBOSE");
if (verbose_env) if (verbose_env)
opts->verbose = atoi(verbose_env); opts->verbose = atoi(verbose_env);