currently mouse processing only happens on mouse movement which
causes cases where going from never -> auto does not show the
osc even though the cursor might be in proximity.
move mouse processing code to a function and refresh it when
leaving visibility never to avoid such issues.
Fixes: https://github.com/mpv-player/mpv/pull/17954#discussion_r3286015305
currently hide_bar() bypasses set_visible when visibility was
changed to `never`, this can leave the thumbnail hanging.
instead of scattering disable_thumbnail() calls around, just
call set_visible(false) instead.
Fixes: 9ce79bcaa
this currently disables thumbnail even on set_visible(true)
calls which was causing flickering due when scrubbing through
the timeline. only disable thumbnail when hiding the osc.
Fixes: 9ce79bcaa
this was initially part of draw-preview but was later moved to a
separate property because it was deemed useful outside of just
thumbnail preview. however this causes bugs when a thumbnailer
observes draw-request and the draw rectangle doesn't change (e.g
due to getting clamped around the border).
add back hover-sec which makes the draw-request more self
contained and removes this footgun.
Fixes: https://github.com/mpv-player/mpv/pull/17518#discussion_r3256017469
Currently the duration observer is toggled in multiple places to not
call request_init unecessarily. It is much simpler to always observe it
and call request_init conditionally in the callback. This also allows
reusing the cached value throughout the OSC.
Note that dividing by 0 is not an error in Lua so there is no need to
check for both 0 and nil.
This adds _down_command support to bind_mouse_buttons so it can be
used to bind button down actions like mbtn_left_down, and let forward
and backward buttons use bind_mouse_buttons. This makes mouse button
down actions customizable.
The event responder must have up, down, or press suffix, but
940ab99055 removed it for frame stepping
function, making it unusable. Fix this by using the down suffix.
Fixes: 940ab99055
When 0197729949 added state.chapter_list this call was not updated to
use the cached value, but there is no reason not to use it, especially
now that more cached properties are used.
For properties that were already being observed but still retrieved over
and over, cache their values using the new observe_cached().
osd-dimensions observer said that if cached we may have to worry about
property ordering but it seems to work fine. It is nice to cache it
because it was the property retrieved the most frequently, in 5
different places.
Similar to current-tracks, when the selected audio track is combined
with another one or with an ffmpeg filter, show the first selected track
id instead of "-".
This was requested by a user on IRC.
Also avoid fetching aid and sid on each render.
this adds a "standard" api for ui scripts and thumbnailers to
communicate with each other, based on the simple thumbfast api
[0].
the api works as follows:
* To issue a thumbnail draw command, the UI script will set the
property `user-data/osc/draw-preview`.
* To clear the thumbnail, the UI script will set the previously
mentioned property to `nil`.
a more ideal api would make it so that the thumbnailer script
only generates the thumbnail and doesn't need to draw at all.
but such api is vastly more complex [4] and would require a lot
more work and maintenance on mpv's side.
this is a decent enough api that allows arbitrary thumbnailers
and ui scripts to communicate between each other and work
together, while being simple enough that it can be supported
without too much maintenance.
this change has been tested with work with thumbfast [1]. and
for demonstration that this api can be useful outside of osc, it
has also been tested to work on mfpbar's thumbnailer branch [2].
the code to determine thumbnail x,y is based on the osc fork
inside of thumbfast [3].
[0]: https://github.com/po5/thumbfast?tab=readme-ov-file#for-ui-developers-how-to-add-thumbfast-support-to-your-script
[1]: https://github.com/po5/thumbfast/pull/173
[2]: https://codeberg.org/NRK/mpv-toolbox/src/branch/thumbnailer/mfpbar
[3]: https://github.com/po5/thumbfast/tree/vanilla-osc
[4]: https://github.com/mpv-player/mpv/discussions/17654
Since changing the width and alignment of buttons shrinks them or messes
up the layout, manually override the hitbox of buttons at the edges.
Fixes#9791.
Alpha blending is done in gamma light of the target, when the overlay is
drawn. Depending on VO and target format, the alpha value can act quite
differently.
Lower it a little to avoid excessive transparency in some cases. This
should be fixed or workaround in better way, but for now just adjust the
value.
track-list/N is not required to match aid/vid. They are encoded as
track-list/N/id.
This fixes changes in 1a558bf5c2 where it
was asumed that track id is the same in track-list, which is not true,
in general sense.
Makes it nicer for speaker icon to not move around on different volume
levels. Also remove scaling, it was not needed.
This required to rewrite the exclamation mark drawing code, made it look
similar to old icon now.
There is an area between the 2 lines of bottombar and topbar that is not
clickable, e.g. between the menu and play_pause icons. Make it all
clickable so it's easier to click buttons.
This also allows clicking from the bottom in slimbottombar and from the
top in topbottombar.
Window controls are not clickable from the very top of the window, they
have a margin to the top that makes them harder to click. Make them
clickable also from the very top to make them easier to activate.
The close button with the default windowcontrols_alignment=right
specifically is already clickable from the rightmost part of the window.
Partial fix of #9791 (other buttons also need to be updated).
Decoupling fullscreen behavior from the generalized border logic
increases the complexity and also inherently changes the behavior in a
way that is not neccesarily desirable. People in IRC notably were
confused about the window controls not being shown in fullscreen because
of this change. We could default the option to yes, but then there will
likely be people confused as to why they suddenly now have the controls
when it wasn't there previously. The best way to avoid all this is just
undo it. If someone wants special fullscreen behavior with
windowcontrols, this can be done with auto profiles already. There's not
much utility in having a separate option.
This reverts commit 3b66428152.
There is concern that with certain user options or script the value of
`{sub,osd}-margin-y` value may be persisted or overwrite user option
when it's changed while OSD is visible and offset is applied.
Fix this by using dedicated option.
This allows to retain deadzone in the middle of the screen when both top
and bottom bars are enabled. We also doesn't have to show bars that
early before moving mouse down.
If `no-border` or `no-title-bar` was used, window controls would enable
also in fullscreen, this was inconsistent, as window decorations are not
visible ragardless of those options in fullscreen mode.
Those zones use input sections, but in OSC we allow them to overlap. So,
we might switch to the other section, after which point we won't get
mouse_leave event that would hide the bar for the other section.
This makes hidding/showing WC and OSC more consistent.