Use existing event_box_ member.

event_box_.set_above_child(true) prevents the child modules/widgets from receiving any events. Without it the group module registers NOTIFY_LEAVE events when a child widget is entered.

I'm unsure why these events don't get propagated. The widgets' event masks look correct when printing, but the event handlers remain connected.
pull/3044/head
hrdl 2024-03-19 23:11:03 +01:00
parent c41ba10ea6
commit 7df266cbd0
2 changed files with 3 additions and 7 deletions

View File

@ -14,7 +14,6 @@ class Group : public AModule {
Group(const std::string&, const std::string&, const Json::Value&, bool); Group(const std::string&, const std::string&, const Json::Value&, bool);
virtual ~Group() = default; virtual ~Group() = default;
auto update() -> void override; auto update() -> void override;
operator Gtk::Widget&() override;
virtual Gtk::Box& getBox(); virtual Gtk::Box& getBox();
void addWidget(Gtk::Widget& widget); void addWidget(Gtk::Widget& widget);
@ -23,7 +22,6 @@ class Group : public AModule {
protected: protected:
Gtk::Box box; Gtk::Box box;
Gtk::EventBox event_box;
Gtk::Box revealer_box; Gtk::Box revealer_box;
Gtk::Revealer revealer; Gtk::Revealer revealer;
bool is_first_widget = true; bool is_first_widget = true;

View File

@ -79,10 +79,10 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
box.pack_start(revealer); box.pack_start(revealer);
} }
event_box.add(box); event_box_.set_above_child(true);
event_box.set_above_child(true); addHoverHandlerTo(event_box_);
addHoverHandlerTo(event_box);
} }
event_box_.add(box);
} }
bool Group::handleMouseHover(GdkEventCrossing* const& e) { bool Group::handleMouseHover(GdkEventCrossing* const& e) {
@ -124,6 +124,4 @@ void Group::addWidget(Gtk::Widget& widget) {
is_first_widget = false; is_first_widget = false;
} }
Group::operator Gtk::Widget&() { return event_box; }
} // namespace waybar } // namespace waybar