Resize and move bind and mpv
Hi, I have this bind that takes your window and forces it to be little floating window near corner of the screen (or smaller one in the middle etc).
This can be easily done with this bind (for 1920x1080 resolution)
### Right floating miniature
bindsym $mod+period floating enable, resize set 560 280, move absolute position 1348 788
But mpv doesnt seem to understand these resize events, and moves but doesnt resize, going out of the screen.
After second run (second screen) it draws border correctly but mpv overflows. screen
What is the root cause of issue like this? Or am i just missing some package?
Posted Jul 31, 2022, 10:39 AM UTC
I have the same problem, I made it into a script a while ago and it also frequently does not resize mpv correctly. I have also noticed that it is not consistent. The script is made to toggle between the toggled in the window corner state and the normal tiled state, and, if I keep the bind pressed it will run the script over and over multiple time a second, and at some point the mpv window gets the right size.
I thinks what is happening is that mpv does not correctly react to the resize event correctly, it also tries to force a certain aspect ratio for the window to conform to what the video has
(It might even be a race condition since spamming it works in the end - usually)
i experimented with swaymsg as well, I guessed its caused by those event so fast after each other, but no it is just that resize event. It simply draws outside of its sway border bounds.
I thought this should be impossible so I think my biggest question is, should I report it to sway or is it more like mpv not implementing some protocol, OR is it xwayland that could bridge this properly? Maybe this should be reported there?
Nothing to do with Xwayland I think, for me it's running natively in wayland at least. I think it is an mpv bug. From what I now about wayland, the compositor can communicate a new size for a clients surface, but the surface can also notify the compositor of size changes. In this case it seems to be that sway tells mpv that it has a new size and mpv resize to the closest size that respect the videos aspect ratio, but sometimes doesn't informe sway of it so you can get a partially filled window or window borders that overlap the content. This last scenario happens because even when the client does not follow the size it has been given, sway will just draw it's border were it wants and not crop the content (which I think it should do but that would be very annoying for window that are buggy and do not respect the size assigned to them)