Only create widgets once if configure event is received
This commit is contained in:
@@ -5,6 +5,7 @@ use std::{
|
|||||||
mem,
|
mem,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
|
sync::Once,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -555,8 +556,16 @@ fn activate(app: >k::Application, runtime_data: Rc<RefCell<RuntimeData>>) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only create the widgets once to avoid issues
|
||||||
|
let configure_once = Once::new();
|
||||||
|
|
||||||
// Create widgets here for proper positioning
|
// Create widgets here for proper positioning
|
||||||
window.connect_configure_event(move |window, event| {
|
window.connect_configure_event(move |window, event| {
|
||||||
|
let runtime_data = runtime_data.clone();
|
||||||
|
let entry = entry.clone();
|
||||||
|
let main_list = main_list.clone();
|
||||||
|
|
||||||
|
configure_once.call_once(move || {
|
||||||
let width = match runtime_data.borrow().config.width {
|
let width = match runtime_data.borrow().config.width {
|
||||||
RelativeNum::Absolute(width) => width,
|
RelativeNum::Absolute(width) => width,
|
||||||
RelativeNum::Fraction(fraction) => (event.size().0 as f32 * fraction) as i32,
|
RelativeNum::Fraction(fraction) => (event.size().0 as f32 * fraction) as i32,
|
||||||
@@ -610,8 +619,9 @@ fn activate(app: >k::Application, runtime_data: Rc<RefCell<RuntimeData>>) {
|
|||||||
|
|
||||||
if runtime_data.borrow().config.show_results_immediately {
|
if runtime_data.borrow().config.show_results_immediately {
|
||||||
// Get initial matches
|
// Get initial matches
|
||||||
refresh_matches(String::new(), runtime_data.clone());
|
refresh_matches(String::new(), runtime_data);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
false
|
false
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user