Skip to content

desktop: Fix gui scale on launch on wayland#15781

Merged
torokati44 merged 1 commit intoruffle-rs:masterfrom
ColinKinloch:wl_resize_gui
Apr 4, 2024
Merged

desktop: Fix gui scale on launch on wayland#15781
torokati44 merged 1 commit intoruffle-rs:masterfrom
ColinKinloch:wl_resize_gui

Conversation

@ColinKinloch
Copy link
Copy Markdown
Contributor

On platforms that support synchronous resizing such as wayland request_inner_size returns the new window size and no WindowEvent::Resize is generated (documented here).

This MR resizes the gui if request_inner_size returns a value different from its original value.

before after
Screenshot from 2024-03-26 12-49-02 Screenshot from 2024-03-26 12-44-55

@torokati44
Copy link
Copy Markdown
Member

Huh, I've never had this problem on KWin before.
I've only had #8870, which this still doesn't fix... Maybe KDE 6 will? :/

Can someone test on Windows please?

X11 (via XWayland) is unaffected, has the correct windows size both before and after.

@torokati44
Copy link
Copy Markdown
Member

Maybe this fixes #15157 though...?

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

ColinKinloch commented Mar 26, 2024

I'm not sure about #15157, the window is the same size, but the image seems to have less gross filtering.

before after
Screenshot from 2024-03-26 13-26-01 Screenshot from 2024-03-26 13-25-24

Is there a proper pixel art swf you can point me to?

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

Huh, I've never had this problem on KWin before.

I assume if you run it with WAYLAND_DEBUG=1 you'll see a xdg_toplevel@*configure when ruffle resizes itself? This doesn't happen on mutter, I assume it's because it is a request from the compositor to change size (drag resize) rather than a notification that it has resized.

@torokati44
Copy link
Copy Markdown
Member

Huh, weird.

Not quite pixel art, but https://z0r.de/L/z0r-de_420.swf for example is relatively small, and should be pixelated (possibly due to #10103, but whatever).
So it's easy to see if the UI is scaled incorrectly, and/or if the window content is stretched by the compositor.

@torokati44
Copy link
Copy Markdown
Member

Yes, I see those requests. So maybe it's KWin who insists on this "factory-default" size too much?

attila ~/projects/ruffle $ git checkout origin/master -f
HEAD is now at 9dfc6dc22 fix(deps): update rust dependencies
attila ~/projects/ruffle $ WAYLAND_DEBUG=1 cargo run -- 'https://z0r.de/L/z0r-de_420.swf' 2>&1 | grep -P 'xdg_toplevel@.*configure'
[2244621.129] xdg_toplevel@29.configure_bounds(1920, 1016)
[2244621.135] xdg_toplevel@29.configure(0, 0, array[0])
[2245301.342] xdg_toplevel@29.configure(800, 600, array[4])
[2245625.470] xdg_toplevel@29.configure(800, 600, array[4])
attila ~/projects/ruffle $ git checkout ColinKinloch/wl_resize_gui -f
Previous HEAD position was 9dfc6dc22 fix(deps): update rust dependencies
HEAD is now at 0cdde301a desktop: Fix gui scale on launch on wayland
attila ~/projects/ruffle $ WAYLAND_DEBUG=1 cargo run -- 'https://z0r.de/L/z0r-de_420.swf' 2>&1 | grep -P 'xdg_toplevel@.*configure'
[2287138.117] xdg_toplevel@29.configure_bounds(1920, 1016)
[2287138.120] xdg_toplevel@29.configure(0, 0, array[0])
[2287811.485] xdg_toplevel@29.configure(800, 600, array[4])
[2288157.708] xdg_toplevel@29.configure(800, 600, array[4])
attila ~/projects/ruffle $ 

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

This bug doesn't manifest if the swf is passed as an argument. I assume ruffle creates the windows/gui if it's already got the file.

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

before after
Screenshot from 2024-03-26 13-49-06 Screenshot from 2024-03-26 13-48-00

@torokati44
Copy link
Copy Markdown
Member

On my machine, it looks and behaves exactly the same way before and after this PR, no matter if I supply the SWF on the command line, or in the "Open" dialog.
On your screenshots, the "after" really does look better, so I'm not against this change.
I'll only have time to look at the code later though.

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

Last one, I promise. 😄

before Screenshot from 2024-03-26 14-01-29
after Screenshot from 2024-03-26 14-13-09

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

ColinKinloch commented Mar 26, 2024

I had a look at it in a nested kwin instance.
Pretty weird, it goes from the initial 800x600 to the requested size (324x216) on load then returns to 800x600 for some reason. 🤷

This is both on master and my branch.

@torokati44
Copy link
Copy Markdown
Member

torokati44 commented Mar 26, 2024

Yep, that's what I'm seeing too. Sad.
Thank you for checking!
I've also checked the fresh Fedora 40 Beta with KDE Plasma 6 - had the exact same behavior... :(

@ColinKinloch
Copy link
Copy Markdown
Contributor Author

More testing. The size reset issue seems to also exist in egui.

And here's this MR a nested weston session:

before after
Screenshot from 2024-03-26 17-56-48 Screenshot from 2024-03-26 17-57-32

@parkerlreed
Copy link
Copy Markdown

parkerlreed commented Mar 26, 2024

Current nightly on Arch Plasma 6 seems to keep the regular 1x GUI scale. Or is it not supposed to stay at 1x?

What's the test case that's supposed to trigger this?

@torokati44
Copy link
Copy Markdown
Member

What I said about Plasma 6 is not a matter of GUI scale, simply window size not matching the content size (as opposed to being reset to 800x600). So these are two related, but not exactly the same, issues.

@torokati44
Copy link
Copy Markdown
Member

torokati44 commented Apr 3, 2024

Ah, right, testing in Weston, I get this before (currently):
image

And with this PR:
image

It's hard to see, but the content matches the window in size just a little bit better! 😄

EDIT: Oh, sorry, this is basically #15781 (comment) ... How did I not realize...?

Copy link
Copy Markdown
Member

@torokati44 torokati44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you yet again! 🥳

@torokati44 torokati44 enabled auto-merge (rebase) April 4, 2024 15:48
@torokati44 torokati44 merged commit 6f568d0 into ruffle-rs:master Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants