fix sometimes broken line flag
This commit is contained in:
parent
818cc41aac
commit
3749a10137
3 changed files with 10 additions and 35 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -619,8 +619,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "freedesktop-file-parser"
|
name = "freedesktop-file-parser"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/alexmohr/desktop_file_parser?branch=fix-format-and-clippy#2c42c2ce28f474b7b663037b344b2bee9be21ef1"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9874624824ee3ca96cf728451815bd93ae3978cdcd715c1d098edef7130fb0da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"freedesktop-icons",
|
"freedesktop-icons",
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
|
|
|
@ -41,8 +41,7 @@ toml = "0.8.20"
|
||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
crossbeam = "0.8.4"
|
crossbeam = "0.8.4"
|
||||||
libc = "0.2.171"
|
libc = "0.2.171"
|
||||||
freedesktop-file-parser = { git = "https://github.com/alexmohr/desktop_file_parser", branch = "fix-format-and-clippy" }
|
freedesktop-file-parser = "0.2.0"
|
||||||
# freedesktop-file-parser = "0.1.3"
|
|
||||||
strsim = "0.11.1"
|
strsim = "0.11.1"
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
which = "7.0.3"
|
which = "7.0.3"
|
||||||
|
|
|
@ -1144,42 +1144,17 @@ fn window_show_resize<T: Clone + 'static>(config: &Config, ui: &Rc<UiElements<T>
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate target height based on either lines or absolute height
|
|
||||||
let target_height = if let Some(lines) = config.lines() {
|
let target_height = if let Some(lines) = config.lines() {
|
||||||
let (_, _, _, height_search) = ui.search.measure(Orientation::Vertical, 10_000);
|
let (_, _, _, height_search) = ui.search.measure(Orientation::Vertical, 10_000);
|
||||||
let widget = {
|
let height = {
|
||||||
let lock = ui.menu_rows.read().unwrap();
|
let lock = ui.menu_rows.read().unwrap();
|
||||||
lock.iter().next().map(|(w, _)| w.clone())
|
lock.iter().find_map(|(fb, _)| {
|
||||||
|
let (_, _, _, baseline) = fb.measure(Orientation::Vertical, 10_000);
|
||||||
|
if baseline > 0 { Some(baseline) } else { None }
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(widget) = widget {
|
if let Some(height) = height {
|
||||||
log::debug!(
|
|
||||||
"widget, mapped: {}, realized {}, visible {}, has child {}, baseline {}, pref size {:#?}",
|
|
||||||
widget.is_mapped(),
|
|
||||||
widget.is_realized(),
|
|
||||||
widget.is_visible(),
|
|
||||||
widget.child().is_some(),
|
|
||||||
widget.allocated_baseline(),
|
|
||||||
widget.preferred_size()
|
|
||||||
);
|
|
||||||
if !widget.is_mapped() {
|
|
||||||
let c_clone = config.clone();
|
|
||||||
let ui_clone = Rc::clone(ui);
|
|
||||||
widget.connect_realize(move |_| {
|
|
||||||
window_show_resize(&c_clone, &Rc::clone(&ui_clone));
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let (_, nat, _, baseline) = widget.measure(Orientation::Vertical, 10_000);
|
|
||||||
log::debug!("natural height base {baseline}, nat {nat}");
|
|
||||||
// todo fix this eventually properly, so baseline is always set and not only in 85% of cases.
|
|
||||||
let height = if baseline > 0 {
|
|
||||||
baseline
|
|
||||||
} else {
|
|
||||||
nat // for my configuration way bigger than baseline
|
|
||||||
};
|
|
||||||
|
|
||||||
Some((height_search + height) * lines + config.lines_additional_space())
|
Some((height_search + height) * lines + config.lines_additional_space())
|
||||||
} else {
|
} else {
|
||||||
log::warn!("No widget for height calculation available");
|
log::warn!("No widget for height calculation available");
|
||||||
|
|
Loading…
Add table
Reference in a new issue