This adds a "native" Wayland clipboard backend based on the
ext-data-control-v1 protocol.
This backend overcomes the limitation of the VO (Wayland core protocol)
backend, and does not require the presence of the VO window to receive clipboard
updates.
This backend also supports primary selection if supported by the compositor.
The backend runs in a separate thread, so clipboard reading
does not stall the player like the VO backend.
I have no idea why, but console's blur is smaller than in OSD messages
and stats (regardless of persistent_overlay). It's smaller regardless of
scale_with_window, or if using 0 PlayRes like stats with
persistent_overlay=yes.
With scale_with_window=yes, multiplying the blur by 2.5 seems to make it
the same. This is probably because 2.5 is 720 / 288, which are the base
height sizes scale from and the OSD's PlayResY. With
scale_with_window=no, we need to multiply by osd_h, which is always 720
with scale_with_window=yes.
table.sort() is unstable, meaning that it randomly reorders items with
the same score, so currently fuzzy_find() checks if the line is empty to
not change the original order of the unsorted items. But actually filled
lines have the same problem: e.g. searching foo with filenames like
foo_{1..99}, they are returned in random order.
To fix this sort by score only when 2 items have different score, else
sort by the original position.
It is not clear what update() updates, in fact this rename allows
removing the comment explaining it. render() is clearer and is the same
term used by the OSC.
With this combination of options, the playlist is shuffled every time
the last playlist is reached, instead of when restarting from the first
playlist entry. Abort prefetching in this case, as we can't predict
which file to prefetch until the playlist is shuffled when actually
going to the first file again.
With --prefetch-playlist and --loop-playlist, mp_next_file() is called
continously since the last second of playback or when viewing an image,
which decreases --loop-playlist=N to 1.
Fix this by adding a flag to mp_next_file() to specify whether to
decrement --loop-playlist=N. The first playlist entry is still
prefetched when it's the next one, but without decrementing
--loop-playlist=N.
Give console's overlay a high z only in select mode, since in this case
you want to click it so it should be above other overlays. In particular
console should be above the OSC's box layout with visibility=always when
you show it by clicking its buttons.
Keep using z=0 otherwise when it doesn't handle clicks, to avoid
unintuitive behavior of overlays handling clicks like the OSC being
drawn below console.
Since the legacy mp.set_osd_ass() doesn't accept z, we need to repeat
its caching logic, like 490b3ba007 and 86d24b069b did for the OSC.
This reverts commit 2dd5bd4cd1.
Instead of drawing the box layout below any other overlay with z >= 0
which may not be wanted, the next commit will increase console's z only
in select mode instead.
Currently determine_hovered_item() assumes that each item is
opts.font_size pixels tall, which usually works well. This breaks with
fonts that get drawn taller than that, such as Japanese text, which
makes the calculation inaccurate for the top items and clips the
counter. A couple of users reported that it is inaccurate for them for
the top items even with ASCII characters in track selectors, presumably
because the circles are taken from a different font and make all lines
taller.
To fix this place each selectable item in its own ASS event positioned
like determine_hovered_item() expects.
Unfortunately this breaks --profile=box, so keep placing every item in
one ASS event with it.
This deduplicates the calculation of the y position by assigning it to a
y variable, which will also be used in the next commit. margin_x is also
renamed to x for consistency.
Rename lines_max to max_lines which is the name used in other functions,
and inline the log_messages variable because its name was confusing.
The math.max(0, lines_max) call was not necessary because console
doesn't crash with 0 or negative max lines.
Define the icon font and icons in variables instead of scattering them
throughout the code to make it easy to change them in the future, or for
forks to change them. Also put the hex values in comments to easily
compare which icons in the font are unused, and explain how to get the
decimal values of the bytes.
Copied from ModernX.
This adds a format parameter to screenshot-raw command which controls
the format of the returned image data. In addition to the bgr0 format,
this adds support for 3 other formats: bgra, rgba, rgba64.
bgra is used by overlay-add command and several window systems.
rgba and rgba64 are used by several GPU APIs and are the formats
returned by the gpu and gpu-next screenshot code, which avoid the need
for further format conversion (see convert_image function).
rgba64 also adds the ability to acquire high bit depth screenshots
for screenshot-raw command.
Add a script-opt to pause when console opens and unpause when it closes,
disabled by default.
This is particularly useful for selectors that take several seconds to
open so you don't have to guess when to pause, like the subtitle line
selector with embedded subtitles, or my script which lets you select
which lyrics to download after requesting them with curl.
Make this behave like the comment says it should, because currently when
you show oneshot stats and change file, stats are printed again and hide
--osd-playing-msg. This happens even if you hide the stats by
show-texting something else and change file before the timer expires.
Unlike font and border sizes, the default stats shadow offset is 0 like
--osd-shadow-offset, so it can be inherited from it by default to not
make users configure it in 2 places.
Since 0 and negative numbers are valid offsets, use infinity as the
placeholder for unconfigured values.
It is now handled internally by the libmpv profile.
Since `player` was the default option, the impact should be minimal, as it
is uncommon to override the default option with the same value.
yes/no args will function the same way as before this commit.
3dcc661de7 made the cursor reset to Default style to not apply the blur,
but \blur0 achieves that without resetting every user style. The cursor
can thus respect the user's --osd-back/shadow-color.
Following up 19537a4996, also respect the user-specified color in the
cursor. But the cursor is drawn as a border, so we actually need to use
--osd-color as the border color.
It was requested in
https://github.com/Samillion/ModernZ/issues/259#issuecomment-2556608926
to make console's shadow offset consistent with --osd-shadow-offset. Not
specifying shadow offsets achieves that. This disables console's shadow
by default but there is no reason console should default to having
shadows but the rest of the OSD shouldn't. Users who want shadows can
enable them in the whole OSD with --osd-shadow-offset. console-specific
shadow_{x,y}_offset script-opts can be added if someone requests them
later.
The previous commit changed --osd-back/shadow-color to nearly the same
one console was using. This allows unhardcoding it from there and using
--osd-back-color even with --osd-border-style=outline-and-shadow for
consistency with the rest of the OSD.
The lines in populate_log_with_matches()
if selected_match < first_match_to_print then
first_match_to_print = selected_match
will set first_match_to_print to 1 even if it is not set here since
handle_edit() sets selected_match = 1.