From c41ba10ea62b6b3099ce430ca9c86a84c38df0b6 Mon Sep 17 00:00:00 2001 From: hrdl <31923882+hrdl-github@users.noreply.github.com> Date: Tue, 19 Mar 2024 23:01:56 +0100 Subject: [PATCH] Use a single EventBox to handle group drawer events Fixes #3029 TODO: contained widgets don't seem to receive any input events --- include/group.hpp | 1 + src/group.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/group.hpp b/include/group.hpp index 67cf4385..d90ec6d6 100644 --- a/include/group.hpp +++ b/include/group.hpp @@ -23,6 +23,7 @@ class Group : public AModule { protected: Gtk::Box box; + Gtk::EventBox event_box; Gtk::Box revealer_box; Gtk::Revealer revealer; bool is_first_widget = true; diff --git a/src/group.cpp b/src/group.cpp index 262cae65..a31e22af 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -79,7 +79,9 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value& box.pack_start(revealer); } - addHoverHandlerTo(revealer); + event_box.add(box); + event_box.set_above_child(true); + addHoverHandlerTo(event_box); } } @@ -114,8 +116,6 @@ void Group::addWidget(Gtk::Widget& widget) { getBox().pack_start(widget, false, false); if (is_drawer) { - // Necessary because of GTK's hitbox detection - addHoverHandlerTo(widget); if (!is_first_widget) { widget.get_style_context()->add_class(add_class_to_drawer_children); } @@ -124,6 +124,6 @@ void Group::addWidget(Gtk::Widget& widget) { is_first_widget = false; } -Group::operator Gtk::Widget&() { return box; } +Group::operator Gtk::Widget&() { return event_box; } } // namespace waybar