@@ -84,7 +84,9 @@ impl VirtualDisplay {
8484 ) ) ;
8585 }
8686 DeviceNode :: get ( ) . ok_or_else ( || {
87- Error :: VirtualDisplayCreation ( "Failed to get EVDI device after adding" . to_string ( ) )
87+ Error :: VirtualDisplayCreation (
88+ "Failed to get EVDI device after adding" . to_string ( ) ,
89+ )
8890 } ) ?
8991 }
9092 } ;
@@ -117,9 +119,10 @@ impl VirtualDisplay {
117119
118120 /// Initialize the buffer after mode is received (call this from async context)
119121 pub async fn init_buffer ( & mut self ) -> Result < ( ) > {
120- let handle = self . handle . as_ref ( ) . ok_or_else ( || {
121- Error :: CaptureError ( "Virtual display not enabled" . to_string ( ) )
122- } ) ?;
122+ let handle = self
123+ . handle
124+ . as_ref ( )
125+ . ok_or_else ( || Error :: CaptureError ( "Virtual display not enabled" . to_string ( ) ) ) ?;
123126
124127 let mut handle_guard = handle. lock ( ) . await ;
125128
@@ -145,7 +148,10 @@ impl VirtualDisplay {
145148 . await
146149 . map_err ( |e| Error :: CaptureError ( format ! ( "Timeout waiting for display mode. Did you enable the display in Settings > Displays? Error: {:?}" , e) ) ) ?;
147150
148- info ! ( "Received mode from compositor: {}x{}" , mode. width, mode. height) ;
151+ info ! (
152+ "Received mode from compositor: {}x{}" ,
153+ mode. width, mode. height
154+ ) ;
149155
150156 // Create a buffer for this mode
151157 let buffer_id = handle_guard. new_buffer ( & mode) ;
@@ -176,9 +182,10 @@ impl VirtualDisplay {
176182
177183 /// Capture a frame from the virtual display (async)
178184 pub async fn capture_async ( & mut self ) -> Result < Frame > {
179- let handle = self . handle . as_ref ( ) . ok_or_else ( || {
180- Error :: CaptureError ( "Virtual display not enabled" . to_string ( ) )
181- } ) ?;
185+ let handle = self
186+ . handle
187+ . as_ref ( )
188+ . ok_or_else ( || Error :: CaptureError ( "Virtual display not enabled" . to_string ( ) ) ) ?;
182189
183190 let buffer_id = self . buffer_id . ok_or_else ( || {
184191 Error :: CaptureError ( "Buffer not initialized. Call init_buffer() first" . to_string ( ) )
@@ -189,9 +196,7 @@ impl VirtualDisplay {
189196 // Request an update - timeout is OK, we'll use the last buffer content
190197 // EVDI only sends updates when there are actual changes on screen
191198 let timeout = Duration :: from_millis ( 50 ) ;
192- let _ = handle_guard
193- . request_update ( buffer_id, timeout)
194- . await ;
199+ let _ = handle_guard. request_update ( buffer_id, timeout) . await ;
195200 // Ignore timeout errors - buffer still has valid data from last update
196201
197202 // Get the buffer data (may be from a previous update if timeout)
@@ -200,9 +205,10 @@ impl VirtualDisplay {
200205 . ok_or_else ( || Error :: CaptureError ( "Buffer not found" . to_string ( ) ) ) ?;
201206
202207 let bytes = buffer. bytes ( ) ;
203- let mode = self . mode . as_ref ( ) . ok_or_else ( || {
204- Error :: CaptureError ( "Mode not set" . to_string ( ) )
205- } ) ?;
208+ let mode = self
209+ . mode
210+ . as_ref ( )
211+ . ok_or_else ( || Error :: CaptureError ( "Mode not set" . to_string ( ) ) ) ?;
206212
207213 let width = mode. width ;
208214 let height = mode. height ;
0 commit comments