From 32c9a594ce6e2d193a0b80d8c300b1db698122be Mon Sep 17 00:00:00 2001 From: Brage Fuglseth Date: Tue, 11 Jun 2024 17:13:06 +0200 Subject: [PATCH] window: Make cursor state update on click should solve #18 --- src/widgets/window/ui_state.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/widgets/window/ui_state.rs b/src/widgets/window/ui_state.rs index 23d99de..eccca22 100644 --- a/src/widgets/window/ui_state.rs +++ b/src/widgets/window/ui_state.rs @@ -31,7 +31,6 @@ impl imp::KpWindow { glib::clone!(@weak self as imp, @strong device => move |_| { if imp.show_cursor.get() && imp.running.get() { imp.header_bar_running.add_css_class("hide-controls"); - imp.hide_cursor(); } }), @@ -51,8 +50,12 @@ impl imp::KpWindow { let click_gesture = gtk::GestureClick::new(); click_gesture.connect_released(glib::clone!(@weak self as imp => move |_, _, _, _| { - if imp.running.get() { - imp.header_bar_running.remove_css_class("hide-controls"); + if !imp.show_cursor.get() && device.timestamp() > imp.cursor_hidden_timestamp.get() { + imp.show_cursor(); + + if imp.running.get() { + imp.header_bar_running.remove_css_class("hide-controls"); + } } })); obj.add_controller(click_gesture);