Format Rust sources at 100 columns
This commit is contained in:
1 parent
4661f595f8
commit
610478f8c7
336 files changed
+23497
-7892
No files matched your search
@@ -33,8 +33,9 @@ impl ModalMaterial {
|
||||
return Err("Dialog materials require Wayland".into());
|
||||
};
|
||||
// Iced lends live native handles; this backend borrows its connection.
|
||||
let backend =
|
||||
unsafe { wayland_client::backend::Backend::from_foreign_display(display.display.as_ptr().cast()) };
|
||||
let backend = unsafe {
|
||||
wayland_client::backend::Backend::from_foreign_display(display.display.as_ptr().cast())
|
||||
};
|
||||
let connection = Connection::from_backend(backend);
|
||||
let id = unsafe {
|
||||
wayland_client::backend::ObjectId::from_ptr(
|
||||
@@ -43,7 +44,8 @@ impl ModalMaterial {
|
||||
)
|
||||
}
|
||||
.map_err(|error| error.to_string())?;
|
||||
let surface = wl_surface::WlSurface::from_id(&connection, id).map_err(|error| error.to_string())?;
|
||||
let surface =
|
||||
wl_surface::WlSurface::from_id(&connection, id).map_err(|error| error.to_string())?;
|
||||
let (globals, mut queue) =
|
||||
registry_queue_init::<MaterialState>(&connection).map_err(|error| error.to_string())?;
|
||||
let qh = queue.handle();
|
||||
@@ -57,7 +59,9 @@ impl ModalMaterial {
|
||||
material,
|
||||
};
|
||||
let mut state = MaterialState::default();
|
||||
queue.roundtrip(&mut state).map_err(|error| error.to_string())?;
|
||||
queue
|
||||
.roundtrip(&mut state)
|
||||
.map_err(|error| error.to_string())?;
|
||||
if !state.ready {
|
||||
return Err("Dialog material attachment was not acknowledged".into());
|
||||
}
|
||||
@@ -116,8 +120,8 @@ delegate_noop!(MaterialState: ignore FereseMaterialManagerV1);
|
||||
mod tests {
|
||||
use super::*;
|
||||
use cosmic::iced::window::raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WaylandDisplayHandle, WaylandWindowHandle,
|
||||
WindowHandle,
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WaylandDisplayHandle,
|
||||
WaylandWindowHandle, WindowHandle,
|
||||
};
|
||||
use std::ptr::NonNull;
|
||||
use wayland_client::protocol::wl_compositor;
|
||||
@@ -166,7 +170,8 @@ mod tests {
|
||||
queue.roundtrip(&mut MaterialState::default()).unwrap();
|
||||
// The compositor rejects duplicate materials. Reattachment proves the final
|
||||
// drop destroyed the first material while preserving the borrowed display.
|
||||
let replacement = ModalMaterial::attach(&window).expect("last clone released the surface material");
|
||||
let replacement =
|
||||
ModalMaterial::attach(&window).expect("last clone released the surface material");
|
||||
drop(replacement);
|
||||
queue.roundtrip(&mut MaterialState::default()).unwrap();
|
||||
window.surface.destroy();
|
||||
|
||||
@@ -110,7 +110,9 @@ mod tests {
|
||||
let server = std::thread::spawn(move || {
|
||||
for revision in [1, 2] {
|
||||
let (mut connection, _) = listener.accept().unwrap();
|
||||
connection.set_read_timeout(Some(Duration::from_secs(5))).unwrap();
|
||||
connection
|
||||
.set_read_timeout(Some(Duration::from_secs(5)))
|
||||
.unwrap();
|
||||
let get: Request = read_frame(&mut connection).unwrap();
|
||||
assert_eq!(get.command, "theme-get");
|
||||
let mut snapshot = fallback();
|
||||
@@ -145,9 +147,11 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(snapshot.revision, revision);
|
||||
}
|
||||
tokio::task::spawn_blocking(move || watch_receive.recv_timeout(Duration::from_secs(5)).unwrap())
|
||||
.await
|
||||
.unwrap();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
watch_receive.recv_timeout(Duration::from_secs(5)).unwrap()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
drop(subscription);
|
||||
});
|
||||
server.join().unwrap();
|
||||
|
||||
Reference in new issue
Block a user