mirror of
				https://codeberg.org/waydeer/layer-shika.git
				synced 2025-11-04 03:04:23 +00:00 
			
		
		
		
	fix: output size on popup size fallback
This commit is contained in:
		
							parent
							
								
									47487b7062
								
							
						
					
					
						commit
						5e162850e9
					
				
					 2 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
					@ -175,21 +175,21 @@ impl WaylandWindowingSystem {
 | 
				
			||||||
        let layer_surface = state.layer_surface();
 | 
					        let layer_surface = state.layer_surface();
 | 
				
			||||||
        let queue_handle = event_queue.handle();
 | 
					        let queue_handle = event_queue.handle();
 | 
				
			||||||
        let serial_holder = Rc::clone(shared_serial);
 | 
					        let serial_holder = Rc::clone(shared_serial);
 | 
				
			||||||
        let output_size = *state.output_size();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        #[allow(clippy::cast_precision_loss)]
 | 
					 | 
				
			||||||
        let default_width = output_size.width as f32;
 | 
					 | 
				
			||||||
        #[allow(clippy::cast_precision_loss)]
 | 
					 | 
				
			||||||
        let default_height = output_size.height as f32;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        platform.set_popup_creator(move || {
 | 
					        platform.set_popup_creator(move || {
 | 
				
			||||||
            info!("Popup creator called! Creating popup window...");
 | 
					            info!("Popup creator called! Creating popup window...");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let serial = serial_holder.get();
 | 
					            let serial = serial_holder.get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            let output_size = popup_manager_clone.output_size();
 | 
				
			||||||
 | 
					            #[allow(clippy::cast_precision_loss)]
 | 
				
			||||||
 | 
					            let default_width = output_size.width as f32;
 | 
				
			||||||
 | 
					            #[allow(clippy::cast_precision_loss)]
 | 
				
			||||||
 | 
					            let default_height = output_size.height as f32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let (reference_x, reference_y, width, height, positioning_mode) = get_popup_config()
 | 
					            let (reference_x, reference_y, width, height, positioning_mode) = get_popup_config()
 | 
				
			||||||
                .unwrap_or_else(|| {
 | 
					                .unwrap_or_else(|| {
 | 
				
			||||||
                    log::warn!("No popup config provided, using output size as defaults");
 | 
					                    log::warn!("No popup config provided, using output size ({default_width}x{default_height}) as defaults");
 | 
				
			||||||
                    (
 | 
					                    (
 | 
				
			||||||
                        0.0,
 | 
					                        0.0,
 | 
				
			||||||
                        0.0,
 | 
					                        0.0,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,6 +93,10 @@ impl PopupManager {
 | 
				
			||||||
        *self.current_output_size.borrow_mut() = output_size;
 | 
					        *self.current_output_size.borrow_mut() = output_size;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pub fn output_size(&self) -> PhysicalSize {
 | 
				
			||||||
 | 
					        *self.current_output_size.borrow()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn create_popup(
 | 
					    pub fn create_popup(
 | 
				
			||||||
        self: &Rc<Self>,
 | 
					        self: &Rc<Self>,
 | 
				
			||||||
        queue_handle: &QueueHandle<WindowState>,
 | 
					        queue_handle: &QueueHandle<WindowState>,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue