diff --git a/include/components/bar.hpp b/include/components/bar.hpp index ec71d817..9cab5fd9 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -79,6 +79,7 @@ class bar : public xpp::event::sink m_dblclicks{false}; mousebtn m_buttonpress_btn{mousebtn::NONE}; int16_t m_buttonpress_pos{0}; diff --git a/src/components/bar.cpp b/src/components/bar.cpp index e2979cd5..0dd45c0b 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -355,6 +355,21 @@ void bar::parse(string&& data, bool force) { } m_renderer->end(); + + const auto check_dblclicks = [&]() -> bool { + for (auto&& action : m_renderer->get_actions()) { + if (static_cast(action.button) >= static_cast(mousebtn::DOUBLE_LEFT)) { + return true; + } + } + for (auto&& action : m_opts.actions) { + if (static_cast(action.button) >= static_cast(mousebtn::DOUBLE_LEFT)) { + return true; + } + } + return false; + }; + m_dblclicks = check_dblclicks(); } /** @@ -576,7 +591,11 @@ void bar::handle(const evt::button_press& evt) { } }; - if (evt->detail == static_cast(mousebtn::LEFT)) { + // If there are no double click handlers defined we can + // just by-pass the click timer handling + if (!m_dblclicks) { + deferred_fn(0); + } else if (evt->detail == static_cast(mousebtn::LEFT)) { check_double("buttonpress-left", mousebtn::DOUBLE_LEFT); } else if (evt->detail == static_cast(mousebtn::MIDDLE)) { check_double("buttonpress-middle", mousebtn::DOUBLE_MIDDLE); diff --git a/src/components/renderer.cpp b/src/components/renderer.cpp index 1f3b4522..4c89fd0e 100644 --- a/src/components/renderer.cpp +++ b/src/components/renderer.cpp @@ -6,6 +6,7 @@ #include "events/signal_receiver.hpp" #include "utils/factory.hpp" #include "utils/file.hpp" +#include "x11/atoms.hpp" #include "x11/connection.hpp" #include "x11/draw.hpp" #include "x11/extensions/all.hpp"