With the change to use the new `platform` property,
the platform 'macos' also got renamed to 'darwin',
but the platform checks were not adjusted to the new name.
* feat: apply margin to `osd-margin-y` and `osd-margin-x`
The margins were already set for `osc-margins` and
`user-data/osc/margins`, but osd messages have their own properties
`osd-margin-x` and `osd-margin-y`.
Offsetting `osd-margin-x` and `osd-margin-y` by our margin prevents
overlap of osd messages with the GUI.
Includes how mouse events are dispatched which now handles deduplication and ensures `down` event won't fine `move` as well, which was causing exact and slow seeks in quick succession when clicking on timeline without moving the mouse, causing glitchy looking seeking.
ref #496
The keybindings 'mbtn_left' and 'wheel' were enabled/disabled on every
render, resulting in log files being spammed with corresponding debug
messages.
To avoid that only call the enable/disable function when the current
decision is different to the last one.
`mbtn_left` and `wheel` events are now only fired on a `cursor.on_{event}` object, which resets at the beginning of each frame, so elements need to bind these listeners in their render functions. These properties are overwritable which allows elements to take over cursor event handling from their parents if necessary.
A recently merged PR https://github.com/mpv-player/mpv/pull/11226 made
the console use the new user-data property instead of
shared-script-properties, resulting in our margins being ignored.
This sets the `user-data/osc/margins` property in addition to the old
shared-script-property to keep compatiblity with older mpv versions.
Added option `top_bar_alt_title`, which accepts an alternative title template to be displayed, and `top_bar_alt_title_place` that controls where it should be displayed. It can be either `below` to place it below the main one, or `toggle` to show it in place of the main title when user clicks the top bar or calls the `toggle-title` binding.
The `top_bar_title` now also accepts a custom top bar title template if user wants it to be different from the one defined in `mpv.conf`.
closes#402
This allows 3rd party scripts to replace the handling of built in uosc key bindings with their own logic.
Example that replaces uosc's basic stream quality menu with christoph-heinrich/mpv-quality-menu:
```lua
mp.commandv('script-message-to', 'uosc', 'overwrite-binding', 'stream-quality', 'script-binding quality_menu/video_formats_toggle')
```
`mouse-pos.hover` may or may not be false during touch input
(contrary to mouse input, where false means the cursor left the window)
Detecting a change to false as a leave event, while allowing any
other mouse-pos update to cause an enter event solves this.
`destination_time` accepts one of `total`, `playtime-remaining` (scaled by the current speed), `time-remaining` (remaining length of file).
`total_time` is deprecated, but still works as expected.
* fix: only update resolution when it's > 0
* fix: only render after the resolution has been initialized
* chore: update type annotation to fix warning
- Preselecting previous folder wasn't working sometimes.
- `join_path()` didn't account for drive letters already having a separator.
Also refactors how `open_file_navigation_menu()` stores menu items value. As a side effect this is now a lot faster as we don't have to serialize each item's path into meta table, but instead we now store just a path string and handle it as needed.
closes#355
Instead of calling `utils.readdir()` twice to get directories and files, we now read the directory only once and sort it by item type. Also optimizes extension checking.
ref #344
Splits the monolith file into individual modules with as little code refactoring as possible.
Not too happy with it, mainly because of the weird language server behavior where it doesn't recognize types or variables unless the files defining them are open...
It'd also be better to refactor everything from the ground up to not depend on global variables but if I had that much time to invest I'd straight up just rewrite everything in typescript and use TS→Lua transpiler.