-
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
Allow libmpv frontends for better window-dragging implementation #12782
Comments
Overall, there are 3 features in mpv.net that need to know if the mouse is in inside an OSC menu:
|
I added a description of the issue to the mpv.net manual: For mpv.net it's currently not possible to find out where OSC menus are located,
When the mouse is near a window border, these 3 features are not available. |
Would it suffice to simply add a |
In this case, all OSC scripts would have to do the same, there are about ten OSC scripts available. I don't know if it would be as fast and reliable as a client.h function. |
I think currently this works via input sections which I'm truthfully not familiar with. I'm not sure why libmpv behavior would be any different though. It should be the same (in theory anyway). |
Frontends always implement their own main window, so they need their own window dragging code, and code to show a context menu and code to auto hide the cursor, but it's not possible to do exactly without a hit test function. The only thing that can be done is creating permanent dead zones near the window borders. It can be perceived as bug or limitation. mpv.net currently uses: bool IsMouseInOsc()
{
Point pos = PointToClient(MousePosition);
float top = 0;
if (!Player.Border)
top = ClientSize.Height * 0.1f;
return pos.X < ClientSize.Width * 0.1 ||
pos.X > ClientSize.Width * 0.9 ||
pos.Y < top ||
pos.Y > ClientSize.Height * 0.78;
} So the dead zones are: Left: 10% |
In general, all libmpv clients are on equal grounds and compete for shared resources. I think it's up to the clients to resolve any outstanding conflicts, so Also note that currently some OSC implementations (including the built-in OSC and uosc) use the internal |
For a libmpv frontend to fully support 3rd party OSCs like uosc and support window-dragging, it's necessary to know if the mouse is inside an OSC menu, in this case dragging is undesired.
I couldn't find a way to get this information, so I use a workaround, I simply do no dragging when the mouse is near a window border because OSC menus are usually found near window borders.
If the menu is in the middle, like the context menu of uosc, dragging is still performed. I didn't know uosc is very popular and doesn't fully work in mpv.net until a recent bug report, it works now after delaying the start of the drag operation for a few pixels.
So currently there are two minor defects in my frontend, dragging works only in the middle of the window, not near borders, and if there is a menu in the middle of the window dragging is still performed.
I looked at the mpv code today and what I found is that it appears to hit test here:
Now if there was a hit test function either in client.h or as input command, it would solve my problem, or maybe there is already something I could use, or something simpler.
The text was updated successfully, but these errors were encountered: