fix: configure window then flush frame clock events, so it stays in sync and prevents crash
This commit is contained in:
parent
d5e042e822
commit
fb95442a0b
2 changed files with 11 additions and 8 deletions
|
|
@ -64,7 +64,7 @@ fn spawn_launcher(tx: Sender<Event>) -> Connection {
|
|||
if let Ok(reply) = m.body::<Vec<Item>>() {
|
||||
let _ = sender.send(Event::WindowList(reply)).await;
|
||||
}
|
||||
Timer::after(Duration::from_millis(10000)).await;
|
||||
Timer::after(Duration::from_millis(200)).await;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -211,8 +211,8 @@ impl Window {
|
|||
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");
|
||||
revealer.set_reveal_child(true);
|
||||
let height = s.height() * s.scale_factor();
|
||||
|
||||
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
||||
|
|
@ -242,9 +242,8 @@ impl Window {
|
|||
&w_conf,
|
||||
)
|
||||
.expect("failed to configure window...");
|
||||
conn.flush().expect("failed to flush");
|
||||
|
||||
} else {
|
||||
conn.flush().expect("failed to flush");let frame_clock = s.frame_clock().unwrap();
|
||||
frame_clock.request_phase(gdk4::FrameClockPhase::FLUSH_EVENTS); } else {
|
||||
println!("failed to get X11 window");
|
||||
}
|
||||
});
|
||||
|
|
@ -256,6 +255,7 @@ impl Window {
|
|||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let resize = glib::clone!(@weak s => move || {
|
||||
// dbg!(r.is_child_revealed());
|
||||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let height = 4;
|
||||
if let Some((display, _surface)) = x::get_window_x11(&window) {
|
||||
let monitor = display
|
||||
|
|
@ -285,7 +285,9 @@ impl Window {
|
|||
)
|
||||
.expect("failed to configure window...");
|
||||
conn.flush().expect("failed to flush");
|
||||
|
||||
s.queue_render();
|
||||
let frame_clock = s.frame_clock().unwrap();
|
||||
frame_clock.request_phase(gdk4::FrameClockPhase::FLUSH_EVENTS);
|
||||
} else {
|
||||
println!("failed to get X11 window");
|
||||
}
|
||||
|
|
@ -329,8 +331,9 @@ impl Window {
|
|||
&w_conf,
|
||||
)
|
||||
.expect("failed to configure window...");
|
||||
conn.flush().expect("failed to flush");
|
||||
|
||||
conn.flush().expect("failed to flush");
|
||||
let frame_clock = s.frame_clock().unwrap();
|
||||
frame_clock.request_phase(gdk4::FrameClockPhase::FLUSH_EVENTS);
|
||||
} else {
|
||||
println!("failed to get X11 window");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue