-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
RFC: Context Menu API #13677
Comments
Which GUI toolkit do you want mpv to import to implement the context menu? Effectively such a feature would need a libass-based fallback anyway. That would also fix the concern of adding a feature (with high visiblity) that only works one on or two platforms. |
I prefer the native API provided by each platform (for native UI experience), for example win32 Menus is used in mpv-menu-plugin.
It's possible to add a uosc like implementation with lua script. |
For two biggest platforms (macOS and Windows) it can be done using native UI elements. For other platforms like linux, libass fallback can be used or none at all. |
win32 menus fonts rendering very badly on 2K/4K monitors, whereas libass has no such problems. WinUI should be a better solution on Windows. |
Maybe. Win32 menu does scale on 2k/4k, but the default font size and item padding looks bad when the player is in full screen mode, and you can't change it unless creating owner-draw menu, this will introduce complexity. |
Some of my thoughts on this:
|
I'm OK with it, or we may write new code to implement it with WinUI on Windows (if desired). |
Ok, we need to detect whether native menu is working or should we fallback to libass one. In other words detect which menu backend to use.
I don't understand this part? We can use exactly the same interface for libass fallback menu. Backend of handling menu shouldn't change the way it works.
I don't think using WinUI is feasible. Also I don't think there will be much gain, but in the same time feel free to prove me wrong. |
I don't understand this part? We can use exactly the same interface for libass fallback menu. Backend of handling menu shouldn't change the way it works.
This is true, but I'd prefer scripts to draw the fallback menu themselves instead from mpv side to keep the code complexity at minimum. In this case the whole point of this interface is to let the native GUI backend know which contents are there in the menu, and there is no reason for scripts to use this when they're drawing the fallback menu themselves.
|
win32 programs using WinUI3 sounds difficult, but not impossible. MinGW GCC/Clang toolchain already has the most basic WinRT support. |
Let's focus on one objective at the time. There is working win32 backend already implemented, it can be improved / changed, but this issue is about the mpv integration, not WinUI. |
This plugin uses the |
The window handle is used to check whether the mouse is clicked on window, it's not required to context menu. In fact, a C plugin always run in it's own thread, this make it complicated to implement GUI code, because GUI code typically need to run in the GUI thread (may or may not required, ex: main thread is required on macOS). This is a reason why I want to merge the code to mpv core, it's easier because we can write code in the GUI thread directly. |
It has been merged as #13700 |
Expected behavior of the wanted feature
I'd like to upstream the C plugin part of mpv-menu-plugin to mpv.
See also: #5500 (comment)
Things need to be do in mpv:
The reference implementation for win32 can be found in menu.c.
Benefits
dyn_menu.lua is a lua script with support for reading menu from
input.conf
, and support dynamic menu items like tracks/chapters/...Additional information
menu data property structure used by mpv-menu-plugin:
If this RFC is not accepted, I would request #13163 to be resolved (to make mpv-menu-plugin possible on macOS).
The text was updated successfully, but these errors were encountered: