fix: configure window in the idle time, so it stays in sync and prevents crash
This commit is contained in:
parent
195470c4e0
commit
d5e042e822
2 changed files with 89 additions and 81 deletions
|
|
@ -135,10 +135,10 @@ fn main() {
|
|||
.call_method(Some(DEST), PATH, Some(DEST), "WindowFocus", &((e,)))
|
||||
.await
|
||||
.expect("Failed to focus selected window");
|
||||
dbg!(_activate_window);
|
||||
}
|
||||
Event::RefreshFromCache => {
|
||||
//TODO refresh the model from cached_results (required after DnD for example)
|
||||
// alternatively dnd source could be changed depending on the context?
|
||||
}
|
||||
Event::WindowList(mut results) => {
|
||||
// sort to make comparison with cache easier
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ impl Window {
|
|||
//TODO clean up duplicated code
|
||||
cursor_event_controller.connect_enter(glib::clone!(@weak revealer, @weak window => move |_evc, _x, _y| {
|
||||
// dbg!("hello, mouse entered me :)");
|
||||
let resize = glib::clone!(@weak window => move || {
|
||||
revealer.set_reveal_child(true);
|
||||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let height = s.height() * s.scale_factor();
|
||||
|
|
@ -246,12 +247,14 @@ impl Window {
|
|||
} else {
|
||||
println!("failed to get X11 window");
|
||||
}
|
||||
|
||||
});
|
||||
glib::source::idle_add_local_once(resize);
|
||||
}));
|
||||
|
||||
revealer.connect_child_revealed_notify(glib::clone!(@weak window => move |r| {
|
||||
if !r.is_child_revealed() {
|
||||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let resize = glib::clone!(@weak s => move || {
|
||||
// dbg!(r.is_child_revealed());
|
||||
let height = 4;
|
||||
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
||||
|
|
@ -286,11 +289,14 @@ impl Window {
|
|||
} else {
|
||||
println!("failed to get X11 window");
|
||||
}
|
||||
});
|
||||
glib::source::idle_add_local_once(resize);
|
||||
}
|
||||
}));
|
||||
|
||||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let surface_resize_handler = glib::clone!(@weak window => move |s: &Surface| {
|
||||
let resize = glib::clone!(@weak s => move || {
|
||||
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
||||
let width = s.width() * s.scale_factor();
|
||||
// let height = s.height() * s.scale_factor();
|
||||
|
|
@ -329,6 +335,8 @@ impl Window {
|
|||
println!("failed to get X11 window");
|
||||
}
|
||||
});
|
||||
glib::source::idle_add_local_once(resize);
|
||||
});
|
||||
s.connect_height_notify(surface_resize_handler.clone());
|
||||
s.connect_width_notify(surface_resize_handler.clone());
|
||||
s.connect_scale_factor_notify(surface_resize_handler);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue