Skip to content
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

MPV's windows resize completely wrong when tiled #40

Closed
seldon1000 opened this issue Mar 9, 2021 · 9 comments
Closed

MPV's windows resize completely wrong when tiled #40

seldon1000 opened this issue Mar 9, 2021 · 9 comments
Labels
bug Something isn't working help needed Need help

Comments

@seldon1000
Copy link

Describe the bug
MPV's windows resize with completely wrong dimensions and position when I tile them. MPV should add black borders to the image to adapt the window to the desired sizes, but it does not happen when Tiling Assistant is enabled. Whatever media file I open, it can't resize the window correctly.

Steps To Reproduce
Open a MPV window and tile it.

Screenshots/-captures

video_2021-03-09_18-38-05.mp4

System Info:

  • Distro (incl. version): Arch
  • GNOME version: 3.38.4
  • Extensions version: 12
  • XOrg/Wayland: X11
@seldon1000 seldon1000 added the bug Something isn't working label Mar 9, 2021
@Leleat
Copy link
Owner

Leleat commented Mar 9, 2021

Hmm, no idea why that happens. Definitly need help with this

@Leleat Leleat added the help needed Need help label Mar 9, 2021
@c-ridgway
Copy link
Contributor

c-ridgway commented Mar 9, 2021

@Leleat It appears to be the way this app resizes (by ratio). Because you're setting the width and height, it's ending up with the wrong size.

Fortunately I don't see anything other than the odd media player doing this. Totem (Gnome's default) seems to be fine.

@seldon1000
Copy link
Author

Fortunately I don't see anything other than the odd media player doing this. Totem (Gnome's default) seems to be fine.

Yes, I tried gnome-mplayer and celluloid (mpv based) too and both work just fine.

@Leleat
Copy link
Owner

Leleat commented Mar 10, 2021

@seldon1000

I tried to run mpv but it's constantly crashing on me when I open media with it. So I can't test it. But if it's this

It appears to be the way this app resizes (by ratio). Because you're setting the width and height, it's ending up with the wrong size.

Maybe try changing line 509 in ~.local/share/gnome-shell/extensions/tiling-assistant@leleat-on-github/util.js from

window.move_resize_frame(false, rect.x, rect.y, rect.width, rect.height);

to

const workArea = window.get_work_area_current_monitor();
if (newRect.height === workArea.height) {
	window.move_frame(false, rect.x, rect.y);
	window.maximize(Meta.MaximizeFlags.VERTICAL);
} else {
	window.move_resize_frame(false, rect.x, rect.y, rect.width, rect.height);
}

Even if this works, that means my extensions can't tile mpv other then maximized (vertically and/or horizontally)... at least I think so...

@seldon1000
Copy link
Author

@Leleat

Maybe try changing line 509 in ~.local/share/gnome-shell/extensions/tiling-assistant@leleat-on-github/util.js from

window.move_resize_frame(false, rect.x, rect.y, rect.width, rect.height);

to

const workArea = window.get_work_area_current_monitor();
if (newRect.height === workArea.height) {
	window.move_frame(false, rect.x, rect.y);
	window.maximize(Meta.MaximizeFlags.VERTICAL);
} else {
	window.move_resize_frame(false, rect.x, rect.y, rect.width, rect.height);
}

No luck, it didn't make any difference.

@Leleat
Copy link
Owner

Leleat commented Mar 10, 2021

Too bad :/

Just to be sure, you reloaded GNOME shell?

@seldon1000
Copy link
Author

Of course I did, I even rebooted the PC to be sure. I finally reverted to the original code because it seemed to add some weird animation when tiling other windows.

@Turbine1991
Copy link
Contributor

This issue might be resolved with a MPV update. Assuming this is the same issue.

Oschowa @Oschowa · 3 months ago
The relevant mpv commit has been reverted and resizing seems fine in general on mutter 3.38.2, so i'll close this.

@Leleat
Copy link
Owner

Leleat commented Apr 6, 2021

The relevant mpv commit has been reverted and resizing seems fine in general on mutter 3.38.2, so i'll close this.

Couldn't find it the relevant issue in mpv's repo but based on the release notes of v0.33.0 it's probably about Wayland

wayland: make resizing better

I was able to test v0.33.0 with Wayland and my extensions works fine there. So problem is limited to a Xorg session... Here is a gif:

output

Any way closing this issue as it's not really my bug. I am using whatever API Mutter provides for resizing a window (which is just 1 method). So I don't think I can 'fix' it with a gnome extension.

I am compiling a list with incompatible apps at #61. So far mpv is the only known app, which doesn't work (except obvious stuff like popups etc.).

If someone has a fix/workaround or knows a tiling extension which works with mpv, feel free to comment here or directly open a pr.

@Leleat Leleat closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help needed Need help
Projects
None yet
Development

No branches or pull requests

4 participants