mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-12-02 20:15:54 +00:00
fix: remove popup recreation workaround
This commit is contained in:
parent
c2d5b7ed12
commit
7f99f13c09
2 changed files with 5 additions and 43 deletions
|
|
@ -15,7 +15,7 @@ Please note that this library is currently in early development and is not yet r
|
||||||
- **Wayland**: Comprehensive layer shell protocol support using `smithay-client-toolkit`
|
- **Wayland**: Comprehensive layer shell protocol support using `smithay-client-toolkit`
|
||||||
- Output management and configuration
|
- Output management and configuration
|
||||||
- Surface lifecycle management
|
- Surface lifecycle management
|
||||||
- Basic xdg popup support (currently with double creation workaround, due dependencies limitations)
|
- Basic xdg popup support
|
||||||
- Event handling system
|
- Event handling system
|
||||||
- **UI Integration**: Slint integration layer with custom rendering backend
|
- **UI Integration**: Slint integration layer with custom rendering backend
|
||||||
- **Documentation**: Work in progress
|
- **Documentation**: Work in progress
|
||||||
|
|
@ -25,7 +25,7 @@ Please note that this library is currently in early development and is not yet r
|
||||||
|
|
||||||
- EGL context creation and management
|
- EGL context creation and management
|
||||||
- Wayland layer shell surface creation
|
- Wayland layer shell surface creation
|
||||||
- XDG popup support (with some limitations, new window and resizing needed to work with current workaround)
|
- XDG popup support (with some limitations: resizing needed)
|
||||||
- Basic rendering with femtovg
|
- Basic rendering with femtovg
|
||||||
- Output detection and management
|
- Output detection and management
|
||||||
- Event handling framework
|
- Event handling framework
|
||||||
|
|
|
||||||
|
|
@ -384,13 +384,7 @@ impl ShellContext<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize_popup(
|
pub fn resize_popup(&mut self, handle: PopupHandle, width: f32, height: f32) -> Result<()> {
|
||||||
&mut self,
|
|
||||||
handle: PopupHandle,
|
|
||||||
width: f32,
|
|
||||||
height: f32,
|
|
||||||
resize_control: Option<ShellControl>,
|
|
||||||
) -> Result<()> {
|
|
||||||
let active_window = self.active_or_primary_output().ok_or_else(|| {
|
let active_window = self.active_or_primary_output().ok_or_else(|| {
|
||||||
Error::Domain(DomainError::Configuration {
|
Error::Domain(DomainError::Configuration {
|
||||||
message: "No active or primary output available".to_string(),
|
message: "No active or primary output available".to_string(),
|
||||||
|
|
@ -415,34 +409,7 @@ impl ShellContext<'_> {
|
||||||
let size_changed =
|
let size_changed =
|
||||||
current_size.is_none_or(|(w, h)| (w - width).abs() > 0.01 || (h - height).abs() > 0.01);
|
current_size.is_none_or(|(w, h)| (w - width).abs() > 0.01 || (h - height).abs() > 0.01);
|
||||||
|
|
||||||
let needs_repositioning = request.mode.center_x() || request.mode.center_y();
|
if size_changed {
|
||||||
|
|
||||||
if needs_repositioning && size_changed {
|
|
||||||
log::info!(
|
|
||||||
"Popup needs repositioning due to mode {:?} and size change - recreating with new size {}x{}",
|
|
||||||
request.mode,
|
|
||||||
width,
|
|
||||||
height
|
|
||||||
);
|
|
||||||
|
|
||||||
self.close_popup(handle)?;
|
|
||||||
|
|
||||||
let mut builder = PopupRequest::builder(request.component)
|
|
||||||
.at(request.at)
|
|
||||||
.size(PopupSize::fixed(width, height))
|
|
||||||
.mode(request.mode);
|
|
||||||
|
|
||||||
if let Some(close_cb) = &request.close_callback {
|
|
||||||
builder = builder.close_on(close_cb.clone());
|
|
||||||
}
|
|
||||||
if let Some(resize_cb) = &request.resize_callback {
|
|
||||||
builder = builder.resize_on(resize_cb.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
let new_request = builder.build();
|
|
||||||
|
|
||||||
self.show_popup(&new_request, resize_control)?;
|
|
||||||
} else if size_changed {
|
|
||||||
if let Some(popup_window) = popup_manager.get_popup_window(handle.key()) {
|
if let Some(popup_window) = popup_manager.get_popup_window(handle.key()) {
|
||||||
popup_window.request_resize(width, height);
|
popup_window.request_resize(width, height);
|
||||||
|
|
||||||
|
|
@ -709,12 +676,7 @@ impl App {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
} => {
|
} => {
|
||||||
if let Err(e) = shell_context.resize_popup(
|
if let Err(e) = shell_context.resize_popup(handle, width, height) {
|
||||||
handle,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
Some(control.clone()),
|
|
||||||
) {
|
|
||||||
log::error!("Failed to resize popup: {}", e);
|
log::error!("Failed to resize popup: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue