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 `--border-background` option
|
||||||
- add `video-target-params` property
|
- add `video-target-params` property
|
||||||
- add `hdr10plus` sub-parameter to `format` video filter
|
- add `hdr10plus` sub-parameter to `format` video filter
|
||||||
|
- remove `--focus-on-open` and add replacement `--focus-on`
|
||||||
--- mpv 0.37.0 ---
|
--- mpv 0.37.0 ---
|
||||||
- `--save-position-on-quit` and its associated commands now store state files
|
- `--save-position-on-quit` and its associated commands now store state files
|
||||||
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
|
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.
|
:desktop: On top of the Desktop behind windows and Desktop icons.
|
||||||
:level: A level as integer.
|
:level: A level as integer.
|
||||||
|
|
||||||
``--focus-on-open``, ``--no-focus-on-open``
|
``--focus-on=<never|open|all>``,
|
||||||
(macOS only)
|
(macOS only)
|
||||||
Focus the video window on creation and makes it the front most window. This
|
Focus the video window and make it the front most window on specific events (default: open).
|
||||||
is on by default.
|
|
||||||
|
: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>``
|
``--window-corners=<default|donotround|round|roundsmall>``
|
||||||
(Windows only)
|
(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-scale", OPT_DOUBLE(window_scale), M_RANGE(0.001, 100)},
|
||||||
{"window-minimized", OPT_BOOL(window_minimized)},
|
{"window-minimized", OPT_BOOL(window_minimized)},
|
||||||
{"window-maximized", OPT_BOOL(window_maximized)},
|
{"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-render", OPT_BOOL(force_render)},
|
||||||
{"force-window-position", OPT_BOOL(force_window_position)},
|
{"force-window-position", OPT_BOOL(force_window_position)},
|
||||||
{"x11-name", OPT_STRING(winname)},
|
{"x11-name", OPT_STRING(winname)},
|
||||||
|
@ -254,7 +255,7 @@ const struct m_sub_options vo_sub_opts = {
|
||||||
.ontop_level = -1,
|
.ontop_level = -1,
|
||||||
.timing_offset = 0.050,
|
.timing_offset = 0.050,
|
||||||
.swapchain_depth = 3,
|
.swapchain_depth = 3,
|
||||||
.focus_on_open = true,
|
.focus_on = 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ typedef struct mp_vo_opts {
|
||||||
bool all_workspaces;
|
bool all_workspaces;
|
||||||
bool window_minimized;
|
bool window_minimized;
|
||||||
bool window_maximized;
|
bool window_maximized;
|
||||||
bool focus_on_open;
|
int focus_on;
|
||||||
|
|
||||||
int screen_id;
|
int screen_id;
|
||||||
char *screen_name;
|
char *screen_name;
|
||||||
|
|
|
@ -68,6 +68,9 @@ class CocoaCB: Common {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.updateWindowSize(vo)
|
self.updateWindowSize(vo)
|
||||||
self.layer?.update(force: true)
|
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)
|
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
|
// workaround for macOS 10.15 to refocus the previous App
|
||||||
if (!mpv.opts.focus_on_open) {
|
if mpv.opts.focus_on == 0 {
|
||||||
previousActiveApp?.activate(options: .activateAllWindows)
|
previousActiveApp?.activate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@ class MacCommon: Common {
|
||||||
window?.updateSize(wr.size)
|
window?.updateSize(wr.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if mpv?.opts.focus_on ?? 1 == 2 {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
|
||||||
windowDidResize()
|
windowDidResize()
|
||||||
updateICCProfile()
|
updateICCProfile()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue