From 7a569c4b9828b57dcd79e3ef33da1d3853090d39 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Thu, 14 Jan 2021 10:45:28 +0100 Subject: [PATCH] Remove mousebtn argument from action_open --- include/components/renderer.hpp | 2 +- include/components/renderer_interface.hpp | 2 +- src/components/renderer.cpp | 3 +-- src/tags/dispatch.cpp | 2 +- tests/unit_tests/tags/dispatch.cpp | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/components/renderer.hpp b/include/components/renderer.hpp index 133ad6c7..5b70ca0e 100644 --- a/include/components/renderer.hpp +++ b/include/components/renderer.hpp @@ -53,7 +53,7 @@ class renderer : public renderer_interface, void change_alignment(const tags::context& ctxt) override; - void action_open(const tags::context& ctxt, mousebtn btn, tags::action_t id) override; + void action_open(const tags::context& ctxt, tags::action_t id) override; void action_close(const tags::context& ctxt, tags::action_t id) override; protected: diff --git a/include/components/renderer_interface.hpp b/include/components/renderer_interface.hpp index 07ce7895..d0daa203 100644 --- a/include/components/renderer_interface.hpp +++ b/include/components/renderer_interface.hpp @@ -13,7 +13,7 @@ class renderer_interface { virtual void render_text(const tags::context& ctxt, const string&& str) = 0; virtual void change_alignment(const tags::context& ctxt) = 0; - virtual void action_open(const tags::context& ctxt, mousebtn btn, tags::action_t id) = 0; + virtual void action_open(const tags::context& ctxt, tags::action_t id) = 0; virtual void action_close(const tags::context& ctxt, tags::action_t id) = 0; protected: diff --git a/src/components/renderer.cpp b/src/components/renderer.cpp index 2ce64eb3..5eea227f 100644 --- a/src/components/renderer.cpp +++ b/src/components/renderer.cpp @@ -706,8 +706,7 @@ void renderer::change_alignment(const tags::context& ctxt) { } } -void renderer::action_open(const tags::context&, mousebtn btn, tags::action_t id) { - assert(btn != mousebtn::NONE); +void renderer::action_open(const tags::context&, tags::action_t id) { m_action_ctxt.set_start(id, m_blocks.at(m_align).x); } diff --git a/src/tags/dispatch.cpp b/src/tags/dispatch.cpp index 465c80e3..66c7a96d 100644 --- a/src/tags/dispatch.cpp +++ b/src/tags/dispatch.cpp @@ -127,7 +127,7 @@ namespace tags { renderer.action_close(*m_ctxt, id); } else { action_t id = m_action_ctxt.action_open(btn, std::move(cmd), m_ctxt->get_alignment()); - renderer.action_open(*m_ctxt, btn, id); + renderer.action_open(*m_ctxt, id); } } diff --git a/tests/unit_tests/tags/dispatch.cpp b/tests/unit_tests/tags/dispatch.cpp index 895bba57..3c322206 100644 --- a/tests/unit_tests/tags/dispatch.cpp +++ b/tests/unit_tests/tags/dispatch.cpp @@ -18,7 +18,7 @@ class MockRenderer : public renderer_interface { MOCK_METHOD(void, render_offset, (const context& ctxt, int pixels), (override)); MOCK_METHOD(void, render_text, (const context& ctxt, const string&& str), (override)); MOCK_METHOD(void, change_alignment, (const context& ctxt), (override)); - MOCK_METHOD(void, action_open, (const context& ctxt, mousebtn btn, action_t id), (override)); + MOCK_METHOD(void, action_open, (const context& ctxt, action_t id), (override)); MOCK_METHOD(void, action_close, (const context& ctxt, action_t id), (override)); };