-
Notifications
You must be signed in to change notification settings - Fork 3.1k
vo: add win32 context menu support #13700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8ea022e
to
682709b
Compare
e1a423f
to
b3671fd
Compare
28e4ffb
to
4c637ac
Compare
on the macOS side we already have something 'equivalent'. it's just the normal menu instead of a context menu, though the general structure for a context menu is the same. on macOS the 'title' and 'shortcut' need to be separated, see https://github.com/mpv-player/mpv/blob/master/osdep/mac/menu_bar.swift#L271. without looking closely at those changes. i think we had some discussions before. like
|
It's functionless in menu, but working in mpv-menu-plugin because it comes from
Maybe an extra field can be added to menu item definition to determine whether it should override mpv key binding. |
9e14b07
to
4ad8c99
Compare
added a |
Download the artifacts for this pull request: |
i am not sure about this. for one the current definition is imo not flexible enough for a main menu, especially on different platforms. like on macOS you have some convention one should adhere to, but on other platforms those are useless or contrary (like a special touch bar menu or the help menu). anyway i thinks it is fine as a context menu.
just as an info, the shortcuts on macOS take precedence over the ones defined in |
The display of the context menu depends on the implementation of the UI library, it not only needs to be able to display the menu, but also need to be able to set different styles (dark mode, light mode), fonts, internationalization, as well as the use of plugins to dynamically modify it, perhaps we should define the data format of the context menu for the MPV (similar to the playlist), the specific display should be determined by the UI library |
Think about those things later. Not necessary for this PR. |
Shouldn't menu-data be cached in common code and send to vo on changes? Probably should just get menu-data property on vo init if it is already set in mdata. |
It's already cached and watched (the code only work on none null vo), but a script may set It seems there's no good way to read a property in vo, this is the reason why it is not done in the PR.
I’m not sure if the code should live here (said in the PR body), do you have any suggestions? It should work on vos that using |
You can probably observe
Not sure I understand what exactly you refer to. But if you say about What I really mean is that on vo create or init, somewhere it should pull |
This is what I mean too. If we do it in vo, the It seems there's no good way to read a property in vo, this is the reason why it is not done in the PR. |
Indeed, properties are handled fully in command.c and in case of "set" updates appropriate state directly. Unlike options they are not cached. But I think it is not terrible to call In most cases there are more direct way to get data, but here we store menu state as mpv_node. Alternative would be to have implementation agnostic menu representation structure in C instead of keeping it in mpv_node format. But this is just converting things around without much gain. |
Well, sorry I found it's not possible to get |
This can already be done with |
The problem is that it requires the script to be aware of implementation details and when the menu data has to be restored. |
Just document that the scripts need to restore the value after a VO reconfig. They already need to do the same for similar stuffs like |
Ok. |
5787164
to
30f678f
Compare
Generally looks good. Clean enough to not be a burden. Although I have concerns about extensibility of this the property approach, because it works if we think from script point of view. But what if in future we decide to include menu definition in But anyway, it is small enough that we can completely refactor it later if needed and script facing property will not change. |
The dyn_menu.lua in mpv-menu-plugin is what you want (need to add support for this PR), although implementing it in mpv core may be better, but it's tricky to implement support for dynamic lists in C. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some documentation language style changes.
ping @kasper93, is there anything else that blocking this PR to be merged? please let me know. |
We can go with it, thanks. |
This is a draft implementation of #13677 for win32, from mpv-menu-plugin .
I’m not sure if the code should live here, correct me if I’m wrong.
test.lua
TODOs / Questions:
menu-data
, we should querymenu-data
and update menu on vo creation too (added document for it)foo\tCtrl+A
is a windows syntax, it will showCtrl+A
as shortcut in the right, do you think we should add a new field for shortcut, or just use the\t
syntax for all platforms? (addedshortcut
field)