mirror of https://github.com/mpv-player/mpv
options: remove --focus-on-open and add --focus-on
replaces the old focus-on-open option with a more generic focus-on options that can be extended. adjust the only platform that uses that option. Fixes #8337
This commit is contained in:
parent
a56d8ff184
commit
0ec385bc76
|
@ -63,6 +63,7 @@ Interface changes
|
|||
- add `--border-background` option
|
||||
- add `video-target-params` property
|
||||
- add `hdr10plus` sub-parameter to `format` video filter
|
||||
- remove `--focus-on-open` and add replacement `--focus-on`
|
||||
--- mpv 0.37.0 ---
|
||||
- `--save-position-on-quit` and its associated commands now store state files
|
||||
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
|
||||
|
|
|
@ -3227,10 +3227,13 @@ Window
|
|||
:desktop: On top of the Desktop behind windows and Desktop icons.
|
||||
:level: A level as integer.
|
||||
|
||||
``--focus-on-open``, ``--no-focus-on-open``
|
||||
``--focus-on=<never|open|all>``,
|
||||
(macOS only)
|
||||
Focus the video window on creation and makes it the front most window. This
|
||||
is on by default.
|
||||
Focus the video window and make it the front most window on specific events (default: open).
|
||||
|
||||
:never: Never focus the window on open or new file load events.
|
||||
:open: Focus the window on creation, eg when a vo is initialised.
|
||||
:all: Focus the window on open and new file load event.
|
||||
|
||||
``--window-corners=<default|donotround|round|roundsmall>``
|
||||
(Windows only)
|
||||
|
|
|
@ -131,7 +131,8 @@ static const m_option_t mp_vo_opt_list[] = {
|
|||
{"window-scale", OPT_DOUBLE(window_scale), M_RANGE(0.001, 100)},
|
||||
{"window-minimized", OPT_BOOL(window_minimized)},
|
||||
{"window-maximized", OPT_BOOL(window_maximized)},
|
||||
{"focus-on-open", OPT_BOOL(focus_on_open)},
|
||||
{"focus-on-open", OPT_REMOVED("Replaced by --focus-on")},
|
||||
{"focus-on", OPT_CHOICE(focus_on, {"never", 0}, {"open", 1}, {"all", 2})},
|
||||
{"force-render", OPT_BOOL(force_render)},
|
||||
{"force-window-position", OPT_BOOL(force_window_position)},
|
||||
{"x11-name", OPT_STRING(winname)},
|
||||
|
@ -254,7 +255,7 @@ const struct m_sub_options vo_sub_opts = {
|
|||
.ontop_level = -1,
|
||||
.timing_offset = 0.050,
|
||||
.swapchain_depth = 3,
|
||||
.focus_on_open = true,
|
||||
.focus_on = 1,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ typedef struct mp_vo_opts {
|
|||
bool all_workspaces;
|
||||
bool window_minimized;
|
||||
bool window_maximized;
|
||||
bool focus_on_open;
|
||||
int focus_on;
|
||||
|
||||
int screen_id;
|
||||
char *screen_name;
|
||||
|
|
|
@ -68,6 +68,9 @@ class CocoaCB: Common {
|
|||
DispatchQueue.main.async {
|
||||
self.updateWindowSize(vo)
|
||||
self.layer?.update(force: true)
|
||||
if self.mpv?.opts.focus_on ?? 1 == 2 {
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,11 +122,11 @@ class Common: NSObject {
|
|||
window.orderFront(nil)
|
||||
}
|
||||
|
||||
NSApp.activate(ignoringOtherApps: mpv.opts.focus_on_open)
|
||||
NSApp.activate(ignoringOtherApps: mpv.opts.focus_on >= 1)
|
||||
|
||||
// workaround for macOS 10.15 to refocus the previous App
|
||||
if (!mpv.opts.focus_on_open) {
|
||||
previousActiveApp?.activate(options: .activateAllWindows)
|
||||
if mpv.opts.focus_on == 0 {
|
||||
previousActiveApp?.activate()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,10 @@ class MacCommon: Common {
|
|||
window?.updateSize(wr.size)
|
||||
}
|
||||
|
||||
if mpv?.opts.focus_on ?? 1 == 2 {
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
}
|
||||
|
||||
windowDidResize()
|
||||
updateICCProfile()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue