Wayland: Support integer scaling without wp_fractional_scale (#8886)

Release Notes:
- N/A

`DoubleBuffered` is not currently very necessary because we only care
about a single field `OutputState::scale` but I think it can be useful
for other objects as it's a fairly common pattern in wayland.
This commit is contained in:
bbb651 2024-03-07 04:13:23 +02:00 committed by GitHub
parent 74e7611ceb
commit c8e03ce42a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 162 additions and 13 deletions

View file

@ -6,10 +6,12 @@ use std::sync::Arc;
use blade_graphics as gpu;
use blade_rwh::{HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle};
use collections::HashSet;
use futures::channel::oneshot::Receiver;
use raw_window_handle::{
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WindowHandle,
};
use wayland_backend::client::ObjectId;
use wayland_client::{protocol::wl_surface, Proxy};
use wayland_protocols::wp::viewporter::client::wp_viewport;
use wayland_protocols::xdg::shell::client::xdg_toplevel;
@ -111,6 +113,7 @@ pub(crate) struct WaylandWindowState {
pub(crate) callbacks: RefCell<Callbacks>,
pub(crate) surface: Arc<wl_surface::WlSurface>,
pub(crate) toplevel: Arc<xdg_toplevel::XdgToplevel>,
pub(crate) outputs: RefCell<HashSet<ObjectId>>,
viewport: Option<wp_viewport::WpViewport>,
}
@ -142,6 +145,7 @@ impl WaylandWindowState {
surface: Arc::clone(&wl_surf),
inner: RefCell::new(WaylandWindowInner::new(&wl_surf, bounds)),
callbacks: RefCell::new(Callbacks::default()),
outputs: RefCell::new(HashSet::default()),
toplevel,
viewport,
}