ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.79k stars 821 forks source link

Window size does not match content on Wayland #8870

Open torokati44 opened 1 year ago

torokati44 commented 1 year ago

When opening any content on Linux Desktop, the player window is always the default size.

Reverting to X11 (even via XWayland) fixes this.

Could be a winit or a KDE issue as well.

Expected behavior: The player windows should be the same size as the content - as it is with FP too.

Affected platform: Desktop app Operating system: Fedora Linux 37

torokati44 commented 1 year ago

With https://github.com/rust-windowing/winit/pull/2676 just merged, this will soon be kinda fixable by doing this:

                         WindowEvent::Resized(size) => {
                             // TODO: Change this when winit adds a `Window::minimzed` or `WindowEvent::Minimize`.
                             minimized = size.width == 0 && size.height == 0;

                             let viewport_scale_factor = self.window.scale_factor();
                             let mut player_lock = self.player.lock().expect("Cannot reenter");
                             player_lock.set_viewport_dimensions(ViewportDimensions {
                                 width: size.width,
                                 height: size.height,
                                 scale_factor: viewport_scale_factor,
                             });
                             self.window.request_redraw();
+
+                            self.window.set_inner_size(LogicalSize::new(player_lock.movie_width(), player_lock.movie_height()));
+
                             if matches!(loaded, LoadingState::WaitingForResize) {
                                 loaded = LoadingState::Loaded;
                             }
                         }

But it's uh.... weird. A more sophisticated way should be found I guess.

torokati44 commented 1 year ago

Doing something like https://github.com/slint-ui/slint/pull/3841 could help here.