diff --git a/include/modules/sni/item.hpp b/include/modules/sni/item.hpp index 1043157c..ebc08d45 100644 --- a/include/modules/sni/item.hpp +++ b/include/modules/sni/item.hpp @@ -76,6 +76,8 @@ class Item : public sigc::trackable { void makeMenu(); bool handleClick(GdkEventButton* const& /*ev*/); bool handleScroll(GdkEventScroll* const&); + bool handleMouseEnter(GdkEventCrossing* const&); + bool handleMouseLeave(GdkEventCrossing* const&); // smooth scrolling threshold gdouble scroll_threshold_ = 0; diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index c3de2357..b5c0dd85 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -8,6 +8,7 @@ #include #include +#include "gdk/gdk.h" #include "util/format.hpp" #include "util/gtk_icon.hpp" @@ -57,6 +58,8 @@ Item::Item(const std::string& bn, const std::string& op, const Json::Value& conf event_box.add_events(Gdk::BUTTON_PRESS_MASK | Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK); event_box.signal_button_press_event().connect(sigc::mem_fun(*this, &Item::handleClick)); event_box.signal_scroll_event().connect(sigc::mem_fun(*this, &Item::handleScroll)); + event_box.signal_enter_notify_event().connect(sigc::mem_fun(*this, &Item::handleMouseEnter)); + event_box.signal_leave_notify_event().connect(sigc::mem_fun(*this, &Item::handleMouseLeave)); // initial visibility event_box.show_all(); event_box.set_visible(show_passive_); @@ -69,6 +72,16 @@ Item::Item(const std::string& bn, const std::string& op, const Json::Value& conf cancellable_, interface); } +bool Item::handleMouseEnter(GdkEventCrossing* const& e) { + event_box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + return false; +} + +bool Item::handleMouseLeave(GdkEventCrossing* const& e) { + event_box.unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + return false; +} + void Item::onConfigure(GdkEventConfigure* ev) { this->updateImage(); } void Item::proxyReady(Glib::RefPtr& result) {