group: fix hover regression

We aren't including the hover detection on the revealer, so when the
animation fires we fire the leave event which starts an infinite loop of
enter/leave while we watch boxes move back and forth.
This commit is contained in:
Austin Horstman 2024-08-02 22:32:22 -05:00
parent 4efa123183
commit 3ae81d62bc
No known key found for this signature in database
2 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,7 @@ class Group : public AModule {
bool handleMouseEnter(GdkEventCrossing *const &ev) override;
bool handleMouseLeave(GdkEventCrossing *const &ev) override;
bool handleToggle(GdkEventButton *const &ev) override;
void addHoverHandlerTo(Gtk::Widget &widget);
void show_group();
void hide_group();
};

View File

@ -81,9 +81,16 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
}
}
addHoverHandlerTo(revealer);
event_box_.add(box);
}
void Group::addHoverHandlerTo(Gtk::Widget& widget) {
widget.add_events(Gdk::EventMask::ENTER_NOTIFY_MASK | Gdk::EventMask::LEAVE_NOTIFY_MASK);
widget.signal_enter_notify_event().connect(sigc::mem_fun(*this, &Group::handleMouseEnter));
widget.signal_leave_notify_event().connect(sigc::mem_fun(*this, &Group::handleMouseLeave));
}
void Group::show_group() {
box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
revealer.set_reveal_child(true);