mirror of
				https://codeberg.org/waydeer/layer-shika.git
				synced 2025-11-04 03:04:23 +00:00 
			
		
		
		
	refactor: minor flush conn
This commit is contained in:
		
							parent
							
								
									584656c07f
								
							
						
					
					
						commit
						96da484043
					
				
					 1 changed files with 5 additions and 6 deletions
				
			
		| 
						 | 
					@ -183,10 +183,11 @@ impl WindowingSystem {
 | 
				
			||||||
        self.setup_wayland_event_source()?;
 | 
					        self.setup_wayland_event_source()?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let event_queue = &mut self.event_queue;
 | 
					        let event_queue = &mut self.event_queue;
 | 
				
			||||||
 | 
					        let connection = &self.connection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.event_loop
 | 
					        self.event_loop
 | 
				
			||||||
            .run(None, &mut self.state, move |shared_data| {
 | 
					            .run(None, &mut self.state, move |shared_data| {
 | 
				
			||||||
                if let Err(e) = Self::process_events(event_queue, shared_data) {
 | 
					                if let Err(e) = Self::process_events(connection, event_queue, shared_data) {
 | 
				
			||||||
                    error!("Error processing events: {}", e);
 | 
					                    error!("Error processing events: {}", e);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
| 
						 | 
					@ -202,11 +203,7 @@ impl WindowingSystem {
 | 
				
			||||||
            .handle()
 | 
					            .handle()
 | 
				
			||||||
            .insert_source(
 | 
					            .insert_source(
 | 
				
			||||||
                calloop::generic::Generic::new(connection, Interest::READ, Mode::Level),
 | 
					                calloop::generic::Generic::new(connection, Interest::READ, Mode::Level),
 | 
				
			||||||
                move |_, connection, _shared_data| {
 | 
					                move |_, _connection, _shared_data| Ok(PostAction::Continue),
 | 
				
			||||||
                    connection.flush().unwrap();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    Ok(PostAction::Continue)
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            .map_err(|e| anyhow::anyhow!("Failed to set up Wayland event source: {}", e))?;
 | 
					            .map_err(|e| anyhow::anyhow!("Failed to set up Wayland event source: {}", e))?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -214,6 +211,7 @@ impl WindowingSystem {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn process_events(
 | 
					    fn process_events(
 | 
				
			||||||
 | 
					        connection: &Connection,
 | 
				
			||||||
        event_queue: &mut EventQueue<WindowState>,
 | 
					        event_queue: &mut EventQueue<WindowState>,
 | 
				
			||||||
        shared_data: &mut WindowState,
 | 
					        shared_data: &mut WindowState,
 | 
				
			||||||
    ) -> Result<()> {
 | 
					    ) -> Result<()> {
 | 
				
			||||||
| 
						 | 
					@ -222,6 +220,7 @@ impl WindowingSystem {
 | 
				
			||||||
                .read()
 | 
					                .read()
 | 
				
			||||||
                .map_err(|e| anyhow::anyhow!("Failed to read events: {}", e))?;
 | 
					                .map_err(|e| anyhow::anyhow!("Failed to read events: {}", e))?;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        connection.flush().unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        event_queue.dispatch_pending(shared_data)?;
 | 
					        event_queue.dispatch_pending(shared_data)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue