From 089b9a20fc3ce21bf306a8686f18f9f7904d4aff Mon Sep 17 00:00:00 2001 From: rellimn <66418892+rellimn@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:51:35 +0200 Subject: [PATCH] Fix module and tray item staying in hover state after opening menu Fixes #3980 --- src/AModule.cpp | 4 ++++ src/modules/sni/item.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/AModule.cpp b/src/AModule.cpp index 259c6a39..c6fdff3e 100644 --- a/src/AModule.cpp +++ b/src/AModule.cpp @@ -172,6 +172,10 @@ bool AModule::handleUserEvent(GdkEventButton* const& e) { // Popup the menu gtk_widget_show_all(GTK_WIDGET(menu_)); gtk_menu_popup_at_pointer(GTK_MENU(menu_), reinterpret_cast(e)); + // Manually reset prelight to make sure the module doesn't stay in a hover state + if (auto* module = event_box_.get_child(); module != nullptr) { + module->unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + } } } // Second call user scripts diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index 4e80eba7..83be42a3 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -443,6 +443,9 @@ void Item::makeMenu() { gtk_menu->attach_to_widget(event_box); } } + // Manually reset prelight to make sure the tray item doesn't stay in a hover state even though + // the menu is focused + event_box.unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); } bool Item::handleClick(GdkEventButton* const& ev) {