Add rustfmt.toml and reformat
Browse files at this commitc6838b08e2f65285f1391cec93f918cadb804117Parent: ad3c3f810 changed files +154 -148
- rustfmt.toml +4 -0
- src/grabs/move_grab.rs +8 -9
- src/grabs/resize_grab.rs +30 -20
- src/handlers/compositor.rs +17 -16
- src/handlers/mod.rs +5 -5
- src/handlers/xdg_shell.rs +15 -26
- src/input.rs +12 -12
- src/main.rs +2 -1
- src/state.rs +33 -32
- src/winit.rs +28 -27
rustfmt.tomladded+4 -0
| @@ -0,0 +1,4 @@ | ||
| 1 | +imports_granularity = "Module" | |
| 2 | +group_imports = "StdExternalCrate" | |
| 3 | +wrap_comments = true | |
| 4 | +comment_width = 100 |
src/grabs/move_grab.rsmodified+8 -9
| @@ -1,13 +1,12 @@ | ||
| 1 | -use crate::Smallvil; | |
| 2 | -use smithay::{ | |
| 3 | - desktop::Window, | |
| 4 | - input::pointer::{ | |
| 5 | - AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, | |
| 6 | - PointerInnerHandle, RelativeMotionEvent, | |
| 7 | - }, | |
| 8 | - reexports::wayland_server::protocol::wl_surface::WlSurface, | |
| 9 | - utils::{Logical, Point}, | |
| 1 | +use smithay::desktop::Window; | |
| 2 | +use smithay::input::pointer::{ | |
| 3 | + AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, | |
| 4 | + PointerInnerHandle, RelativeMotionEvent, | |
| 10 | 5 | }; |
| 6 | +use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | |
| 7 | +use smithay::utils::{Logical, Point}; | |
| 8 | + | |
| 9 | +use crate::Smallvil; | |
| 11 | 10 | |
| 12 | 11 | pub struct MoveSurfaceGrab { |
| 13 | 12 | pub start_data: PointerGrabStartData<Smallvil>, |
src/grabs/resize_grab.rsmodified+30 -20
| @@ -1,18 +1,18 @@ | ||
| 1 | -use crate::Smallvil; | |
| 2 | -use smithay::{ | |
| 3 | - desktop::{Space, Window}, | |
| 4 | - input::pointer::{ | |
| 5 | - AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, | |
| 6 | - PointerInnerHandle, RelativeMotionEvent, | |
| 7 | - }, | |
| 8 | - reexports::{ | |
| 9 | - wayland_protocols::xdg::shell::server::xdg_toplevel, wayland_server::protocol::wl_surface::WlSurface, | |
| 10 | - }, | |
| 11 | - utils::{Logical, Point, Rectangle, Size}, | |
| 12 | - wayland::{compositor, shell::xdg::SurfaceCachedState}, | |
| 13 | -}; | |
| 14 | 1 | use std::cell::RefCell; |
| 15 | 2 | |
| 3 | +use smithay::desktop::{Space, Window}; | |
| 4 | +use smithay::input::pointer::{ | |
| 5 | + AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, | |
| 6 | + PointerInnerHandle, RelativeMotionEvent, | |
| 7 | +}; | |
| 8 | +use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; | |
| 9 | +use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | |
| 10 | +use smithay::utils::{Logical, Point, Rectangle, Size}; | |
| 11 | +use smithay::wayland::compositor; | |
| 12 | +use smithay::wayland::shell::xdg::SurfaceCachedState; | |
| 13 | + | |
| 14 | +use crate::Smallvil; | |
| 15 | + | |
| 16 | 16 | bitflags::bitflags! { |
| 17 | 17 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
| 18 | 18 | pub struct ResizeEdge: u32 { |
| @@ -56,7 +56,10 @@ impl ResizeSurfaceGrab { | ||
| 56 | 56 | let initial_rect = initial_window_rect; |
| 57 | 57 | |
| 58 | 58 | ResizeSurfaceState::with(window.toplevel().wl_surface(), |state| { |
| 59 | - *state = ResizeSurfaceState::Resizing { edges, initial_rect }; | |
| 59 | + *state = ResizeSurfaceState::Resizing { | |
| 60 | + edges, | |
| 61 | + initial_rect, | |
| 62 | + }; | |
| 60 | 63 | }); |
| 61 | 64 | |
| 62 | 65 | Self { |
| @@ -101,10 +104,11 @@ impl PointerGrab<Smallvil> for ResizeSurfaceGrab { | ||
| 101 | 104 | new_window_height = (self.initial_rect.size.h as f64 + delta.y) as i32; |
| 102 | 105 | } |
| 103 | 106 | |
| 104 | - let (min_size, max_size) = compositor::with_states(self.window.toplevel().wl_surface(), |states| { | |
| 105 | - let data = states.cached_state.current::<SurfaceCachedState>(); | |
| 106 | - (data.min_size, data.max_size) | |
| 107 | - }); | |
| 107 | + let (min_size, max_size) = | |
| 108 | + compositor::with_states(self.window.toplevel().wl_surface(), |states| { | |
| 109 | + let data = states.cached_state.current::<SurfaceCachedState>(); | |
| 110 | + (data.min_size, data.max_size) | |
| 111 | + }); | |
| 108 | 112 | |
| 109 | 113 | let min_width = min_size.w.max(1); |
| 110 | 114 | let min_height = min_size.h.max(1); |
| @@ -219,8 +223,14 @@ impl ResizeSurfaceState { | ||
| 219 | 223 | |
| 220 | 224 | fn commit(&mut self) -> Option<(ResizeEdge, Rectangle<i32, Logical>)> { |
| 221 | 225 | match *self { |
| 222 | - Self::Resizing { edges, initial_rect } => Some((edges, initial_rect)), | |
| 223 | - Self::WaitingForLastCommit { edges, initial_rect } => { | |
| 226 | + Self::Resizing { | |
| 227 | + edges, | |
| 228 | + initial_rect, | |
| 229 | + } => Some((edges, initial_rect)), | |
| 230 | + Self::WaitingForLastCommit { | |
| 231 | + edges, | |
| 232 | + initial_rect, | |
| 233 | + } => { | |
| 224 | 234 | // The resize is done, let's go back to idle |
| 225 | 235 | *self = Self::Idle; |
| 226 | 236 |
src/handlers/compositor.rsmodified+17 -16
| @@ -1,21 +1,18 @@ | ||
| 1 | -use crate::{grabs::resize_grab, state::ClientState, Smallvil}; | |
| 2 | -use smithay::{ | |
| 3 | - backend::renderer::utils::on_commit_buffer_handler, | |
| 4 | - delegate_compositor, delegate_shm, | |
| 5 | - reexports::wayland_server::{ | |
| 6 | - protocol::{wl_buffer, wl_surface::WlSurface}, | |
| 7 | - Client, | |
| 8 | - }, | |
| 9 | - wayland::{ | |
| 10 | - buffer::BufferHandler, | |
| 11 | - compositor::{ | |
| 12 | - get_parent, is_sync_subsurface, CompositorClientState, CompositorHandler, CompositorState, | |
| 13 | - }, | |
| 14 | - shm::{ShmHandler, ShmState}, | |
| 15 | - }, | |
| 1 | +use smithay::backend::renderer::utils::on_commit_buffer_handler; | |
| 2 | +use smithay::reexports::wayland_server::protocol::wl_buffer; | |
| 3 | +use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | |
| 4 | +use smithay::reexports::wayland_server::Client; | |
| 5 | +use smithay::wayland::buffer::BufferHandler; | |
| 6 | +use smithay::wayland::compositor::{ | |
| 7 | + get_parent, is_sync_subsurface, CompositorClientState, CompositorHandler, CompositorState, | |
| 16 | 8 | }; |
| 9 | +use smithay::wayland::shm::{ShmHandler, ShmState}; | |
| 10 | +use smithay::{delegate_compositor, delegate_shm}; | |
| 17 | 11 | |
| 18 | 12 | use super::xdg_shell; |
| 13 | +use crate::grabs::resize_grab; | |
| 14 | +use crate::state::ClientState; | |
| 15 | +use crate::Smallvil; | |
| 19 | 16 | |
| 20 | 17 | impl CompositorHandler for Smallvil { |
| 21 | 18 | fn compositor_state(&mut self) -> &mut CompositorState { |
| @@ -33,7 +30,11 @@ impl CompositorHandler for Smallvil { | ||
| 33 | 30 | while let Some(parent) = get_parent(&root) { |
| 34 | 31 | root = parent; |
| 35 | 32 | } |
| 36 | - if let Some(window) = self.space.elements().find(|w| w.toplevel().wl_surface() == &root) { | |
| 33 | + if let Some(window) = self | |
| 34 | + .space | |
| 35 | + .elements() | |
| 36 | + .find(|w| w.toplevel().wl_surface() == &root) | |
| 37 | + { | |
| 37 | 38 | window.on_commit(); |
| 38 | 39 | } |
| 39 | 40 | }; |
src/handlers/mod.rsmodified+5 -5
| @@ -1,17 +1,17 @@ | ||
| 1 | 1 | mod compositor; |
| 2 | 2 | mod xdg_shell; |
| 3 | 3 | |
| 4 | -use crate::Smallvil; | |
| 5 | - | |
| 6 | 4 | // |
| 7 | 5 | // Wl Seat |
| 8 | -// | |
| 9 | - | |
| 10 | 6 | use smithay::input::{SeatHandler, SeatState}; |
| 11 | 7 | use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; |
| 12 | -use smithay::wayland::data_device::{ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler}; | |
| 8 | +use smithay::wayland::data_device::{ | |
| 9 | + ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler, | |
| 10 | +}; | |
| 13 | 11 | use smithay::{delegate_data_device, delegate_output, delegate_seat}; |
| 14 | 12 | |
| 13 | +use crate::Smallvil; | |
| 14 | + | |
| 15 | 15 | impl SeatHandler for Smallvil { |
| 16 | 16 | type KeyboardFocus = WlSurface; |
| 17 | 17 | type PointerFocus = WlSurface; |
src/handlers/xdg_shell.rsmodified+15 -26
| @@ -1,31 +1,20 @@ | ||
| 1 | -use smithay::{ | |
| 2 | - delegate_xdg_shell, | |
| 3 | - desktop::{Space, Window}, | |
| 4 | - input::{ | |
| 5 | - pointer::{Focus, GrabStartData as PointerGrabStartData}, | |
| 6 | - Seat, | |
| 7 | - }, | |
| 8 | - reexports::{ | |
| 9 | - wayland_protocols::xdg::shell::server::xdg_toplevel, | |
| 10 | - wayland_server::{ | |
| 11 | - protocol::{wl_seat, wl_surface::WlSurface}, | |
| 12 | - Resource, | |
| 13 | - }, | |
| 14 | - }, | |
| 15 | - utils::{Rectangle, Serial}, | |
| 16 | - wayland::{ | |
| 17 | - compositor::with_states, | |
| 18 | - shell::xdg::{ | |
| 19 | - PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, | |
| 20 | - XdgToplevelSurfaceData, | |
| 21 | - }, | |
| 22 | - }, | |
| 1 | +use smithay::delegate_xdg_shell; | |
| 2 | +use smithay::desktop::{Space, Window}; | |
| 3 | +use smithay::input::pointer::{Focus, GrabStartData as PointerGrabStartData}; | |
| 4 | +use smithay::input::Seat; | |
| 5 | +use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; | |
| 6 | +use smithay::reexports::wayland_server::protocol::wl_seat; | |
| 7 | +use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | |
| 8 | +use smithay::reexports::wayland_server::Resource; | |
| 9 | +use smithay::utils::{Rectangle, Serial}; | |
| 10 | +use smithay::wayland::compositor::with_states; | |
| 11 | +use smithay::wayland::shell::xdg::{ | |
| 12 | + PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, | |
| 13 | + XdgToplevelSurfaceData, | |
| 23 | 14 | }; |
| 24 | 15 | |
| 25 | -use crate::{ | |
| 26 | - grabs::{MoveSurfaceGrab, ResizeSurfaceGrab}, | |
| 27 | - Smallvil, | |
| 28 | -}; | |
| 16 | +use crate::grabs::{MoveSurfaceGrab, ResizeSurfaceGrab}; | |
| 17 | +use crate::Smallvil; | |
| 29 | 18 | |
| 30 | 19 | impl XdgShellHandler for Smallvil { |
| 31 | 20 | fn xdg_shell_state(&mut self) -> &mut XdgShellState { |
src/input.rsmodified+12 -12
| @@ -1,15 +1,11 @@ | ||
| 1 | -use smithay::{ | |
| 2 | - backend::input::{ | |
| 3 | - AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent, | |
| 4 | - KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, | |
| 5 | - }, | |
| 6 | - input::{ | |
| 7 | - keyboard::FilterResult, | |
| 8 | - pointer::{AxisFrame, ButtonEvent, MotionEvent}, | |
| 9 | - }, | |
| 10 | - reexports::wayland_server::protocol::wl_surface::WlSurface, | |
| 11 | - utils::SERIAL_COUNTER, | |
| 1 | +use smithay::backend::input::{ | |
| 2 | + AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent, | |
| 3 | + KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, | |
| 12 | 4 | }; |
| 5 | +use smithay::input::keyboard::FilterResult; | |
| 6 | +use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent}; | |
| 7 | +use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | |
| 8 | +use smithay::utils::SERIAL_COUNTER; | |
| 13 | 9 | |
| 14 | 10 | use crate::state::Smallvil; |
| 15 | 11 | |
| @@ -70,7 +66,11 @@ impl Smallvil { | ||
| 70 | 66 | .map(|(w, l)| (w.clone(), l)) |
| 71 | 67 | { |
| 72 | 68 | self.space.raise_element(&window, true); |
| 73 | - keyboard.set_focus(self, Some(window.toplevel().wl_surface().clone()), serial); | |
| 69 | + keyboard.set_focus( | |
| 70 | + self, | |
| 71 | + Some(window.toplevel().wl_surface().clone()), | |
| 72 | + serial, | |
| 73 | + ); | |
| 74 | 74 | self.space.elements().for_each(|window| { |
| 75 | 75 | window.toplevel().send_pending_configure(); |
| 76 | 76 | }); |
src/main.rsmodified+2 -1
| @@ -7,7 +7,8 @@ mod input; | ||
| 7 | 7 | mod state; |
| 8 | 8 | mod winit; |
| 9 | 9 | |
| 10 | -use smithay::reexports::{calloop::EventLoop, wayland_server::Display}; | |
| 10 | +use smithay::reexports::calloop::EventLoop; | |
| 11 | +use smithay::reexports::wayland_server::Display; | |
| 11 | 12 | pub use state::Smallvil; |
| 12 | 13 | |
| 13 | 14 | pub struct CalloopData { |
src/state.rsmodified+33 -32
| @@ -1,26 +1,22 @@ | ||
| 1 | -use std::{ffi::OsString, os::unix::io::AsRawFd, sync::Arc}; | |
| 2 | - | |
| 3 | -use smithay::{ | |
| 4 | - desktop::{Space, Window, WindowSurfaceType}, | |
| 5 | - input::{pointer::PointerHandle, Seat, SeatState}, | |
| 6 | - reexports::{ | |
| 7 | - calloop::{generic::Generic, EventLoop, Interest, LoopSignal, Mode, PostAction}, | |
| 8 | - wayland_server::{ | |
| 9 | - backend::{ClientData, ClientId, DisconnectReason}, | |
| 10 | - protocol::wl_surface::WlSurface, | |
| 11 | - Display, | |
| 12 | - }, | |
| 13 | - }, | |
| 14 | - utils::{Logical, Point}, | |
| 15 | - wayland::{ | |
| 16 | - compositor::{CompositorClientState, CompositorState}, | |
| 17 | - data_device::DataDeviceState, | |
| 18 | - output::OutputManagerState, | |
| 19 | - shell::xdg::XdgShellState, | |
| 20 | - shm::ShmState, | |
| 21 | - socket::ListeningSocketSource, | |
| 22 | - }, | |
| 23 | -}; | |
| 1 | +use std::ffi::OsString; | |
| 2 | +use std::os::unix::io::AsRawFd; | |
| 3 | +use std::sync::Arc; | |
| 4 | + | |
| 5 | +use smithay::desktop::{Space, Window, WindowSurfaceType}; | |
| 6 | +use smithay::input::pointer::PointerHandle; | |
| 7 | +use smithay::input::{Seat, SeatState}; | |
| 8 | +use smithay::reexports::calloop::generic::Generic; | |
| 9 | +use smithay::reexports::calloop::{EventLoop, Interest, LoopSignal, Mode, PostAction}; | |
| 10 | +use smithay::reexports::wayland_server::backend::{ClientData, ClientId, DisconnectReason}; | |
| 11 | +use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; | |
| 12 | +use smithay::reexports::wayland_server::Display; | |
| 13 | +use smithay::utils::{Logical, Point}; | |
| 14 | +use smithay::wayland::compositor::{CompositorClientState, CompositorState}; | |
| 15 | +use smithay::wayland::data_device::DataDeviceState; | |
| 16 | +use smithay::wayland::output::OutputManagerState; | |
| 17 | +use smithay::wayland::shell::xdg::XdgShellState; | |
| 18 | +use smithay::wayland::shm::ShmState; | |
| 19 | +use smithay::wayland::socket::ListeningSocketSource; | |
| 24 | 20 | |
| 25 | 21 | use crate::CalloopData; |
| 26 | 22 | |
| @@ -59,8 +55,9 @@ impl Smallvil { | ||
| 59 | 55 | // A seat typically has a pointer and maintains a keyboard focus and a pointer focus. |
| 60 | 56 | let mut seat: Seat<Self> = seat_state.new_wl_seat(&dh, "winit"); |
| 61 | 57 | |
| 62 | - // Notify clients that we have a keyboard, for the sake of the example we assume that keyboard is always present. | |
| 63 | - // You may want to track keyboard hot-plug in real compositor. | |
| 58 | + // Notify clients that we have a keyboard, for the sake of the example we assume that | |
| 59 | + // keyboard is always present. You may want to track keyboard hot-plug in real | |
| 60 | + // compositor. | |
| 64 | 61 | seat.add_keyboard(Default::default(), 200, 200).unwrap(); |
| 65 | 62 | |
| 66 | 63 | // Notify clients that we have a pointer (mouse) |
| @@ -99,7 +96,8 @@ impl Smallvil { | ||
| 99 | 96 | display: &mut Display<Smallvil>, |
| 100 | 97 | event_loop: &mut EventLoop<CalloopData>, |
| 101 | 98 | ) -> OsString { |
| 102 | - // Creates a new listening socket, automatically choosing the next available `wayland` socket name. | |
| 99 | + // Creates a new listening socket, automatically choosing the next available `wayland` | |
| 100 | + // socket name. | |
| 103 | 101 | let listening_socket = ListeningSocketSource::new_auto().unwrap(); |
| 104 | 102 | |
| 105 | 103 | // Get the name of the listening socket. |
| @@ -122,7 +120,8 @@ impl Smallvil { | ||
| 122 | 120 | }) |
| 123 | 121 | .expect("Failed to init the wayland event source."); |
| 124 | 122 | |
| 125 | - // You also need to add the display itself to the event loop, so that client events will be processed by wayland-server. | |
| 123 | + // You also need to add the display itself to the event loop, so that client events will be | |
| 124 | + // processed by wayland-server. | |
| 126 | 125 | handle |
| 127 | 126 | .insert_source( |
| 128 | 127 | Generic::new( |
| @@ -145,11 +144,13 @@ impl Smallvil { | ||
| 145 | 144 | pointer: &PointerHandle<Self>, |
| 146 | 145 | ) -> Option<(WlSurface, Point<i32, Logical>)> { |
| 147 | 146 | let pos = pointer.current_location(); |
| 148 | - self.space.element_under(pos).and_then(|(window, location)| { | |
| 149 | - window | |
| 150 | - .surface_under(pos - location.to_f64(), WindowSurfaceType::ALL) | |
| 151 | - .map(|(s, p)| (s, p + location)) | |
| 152 | - }) | |
| 147 | + self.space | |
| 148 | + .element_under(pos) | |
| 149 | + .and_then(|(window, location)| { | |
| 150 | + window | |
| 151 | + .surface_under(pos - location.to_f64(), WindowSurfaceType::ALL) | |
| 152 | + .map(|(s, p)| (s, p + location)) | |
| 153 | + }) | |
| 153 | 154 | } |
| 154 | 155 | } |
| 155 | 156 |
src/winit.rsmodified+28 -27
| @@ -1,19 +1,13 @@ | ||
| 1 | 1 | use std::time::Duration; |
| 2 | 2 | |
| 3 | -use smithay::{ | |
| 4 | - backend::{ | |
| 5 | - renderer::{ | |
| 6 | - damage::OutputDamageTracker, element::surface::WaylandSurfaceRenderElement, gles::GlesRenderer, | |
| 7 | - }, | |
| 8 | - winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend}, | |
| 9 | - }, | |
| 10 | - output::{Mode, Output, PhysicalProperties, Subpixel}, | |
| 11 | - reexports::calloop::{ | |
| 12 | - timer::{TimeoutAction, Timer}, | |
| 13 | - EventLoop, | |
| 14 | - }, | |
| 15 | - utils::{Rectangle, Transform}, | |
| 16 | -}; | |
| 3 | +use smithay::backend::renderer::damage::OutputDamageTracker; | |
| 4 | +use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement; | |
| 5 | +use smithay::backend::renderer::gles::GlesRenderer; | |
| 6 | +use smithay::backend::winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend}; | |
| 7 | +use smithay::output::{Mode, Output, PhysicalProperties, Subpixel}; | |
| 8 | +use smithay::reexports::calloop::timer::{TimeoutAction, Timer}; | |
| 9 | +use smithay::reexports::calloop::EventLoop; | |
| 10 | +use smithay::utils::{Rectangle, Transform}; | |
| 17 | 11 | |
| 18 | 12 | use crate::{CalloopData, Smallvil}; |
| 19 | 13 | |
| @@ -41,7 +35,12 @@ pub fn init_winit( | ||
| 41 | 35 | }, |
| 42 | 36 | ); |
| 43 | 37 | let _global = output.create_global::<Smallvil>(&display.handle()); |
| 44 | - output.change_current_state(Some(mode), Some(Transform::Flipped180), None, Some((0, 0).into())); | |
| 38 | + output.change_current_state( | |
| 39 | + Some(mode), | |
| 40 | + Some(Transform::Flipped180), | |
| 41 | + None, | |
| 42 | + Some((0, 0).into()), | |
| 43 | + ); | |
| 45 | 44 | output.set_preferred(mode); |
| 46 | 45 | |
| 47 | 46 | state.space.map_output(&output, (0, 0)); |
| @@ -53,18 +52,20 @@ pub fn init_winit( | ||
| 53 | 52 | let mut full_redraw = 0u8; |
| 54 | 53 | |
| 55 | 54 | let timer = Timer::immediate(); |
| 56 | - event_loop.handle().insert_source(timer, move |_, _, data| { | |
| 57 | - winit_dispatch( | |
| 58 | - &mut backend, | |
| 59 | - &mut winit, | |
| 60 | - data, | |
| 61 | - &output, | |
| 62 | - &mut damage_tracker, | |
| 63 | - &mut full_redraw, | |
| 64 | - ) | |
| 65 | - .unwrap(); | |
| 66 | - TimeoutAction::ToDuration(Duration::from_millis(16)) | |
| 67 | - })?; | |
| 55 | + event_loop | |
| 56 | + .handle() | |
| 57 | + .insert_source(timer, move |_, _, data| { | |
| 58 | + winit_dispatch( | |
| 59 | + &mut backend, | |
| 60 | + &mut winit, | |
| 61 | + data, | |
| 62 | + &output, | |
| 63 | + &mut damage_tracker, | |
| 64 | + &mut full_redraw, | |
| 65 | + ) | |
| 66 | + .unwrap(); | |
| 67 | + TimeoutAction::ToDuration(Duration::from_millis(16)) | |
| 68 | + })?; | |
| 68 | 69 | |
| 69 | 70 | Ok(()) |
| 70 | 71 | } |