diff --git a/src/app/mod.rs b/src/app/mod.rs index d5def4b..220c8b5 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -9,7 +9,7 @@ use crate::paintable::svg_picture_colorized; use glib::object::Cast; use glib::timeout_add_local_once; use glib_macros::{clone, closure}; -use gtk4::prelude::{BoxExt, ButtonExt, GObjectPropertyExpressionExt, GtkWindowExt, WidgetExt}; +use gtk4::prelude::{BoxExt, ButtonExt, EventControllerExt, GObjectPropertyExpressionExt, GtkWindowExt, WidgetExt}; use gtk4::{EventControllerKey, GestureClick, PropagationPhase}; use gtk4_layer_shell::{KeyboardMode, LayerShell}; use libadwaita::prelude::AdwApplicationWindowExt; @@ -339,6 +339,20 @@ pub fn create_app(config: &Arc, app: &libadwaita::Application) -> Wle move |_| on_option(&action, delay_ms, service_mode, window) )); + let event_controller_motion = gtk4::EventControllerMotion::new(); + event_controller_motion.connect_enter( + |controller, _x, _y| { + let control_button = controller.widget(); + match control_button { + Some(control_button) => { + control_button.grab_focus(); + } + None => { } + } + } + ); + button.add_controller(event_controller_motion); + button.set_child(Some(&overlay)); buttons_container.append(&button);