From 0fdf1f51a8f84e1191103524e058cc7ce1bb92d6 Mon Sep 17 00:00:00 2001 From: MistEO Date: Thu, 19 Oct 2023 11:29:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3M=20Touch=20=E5=AD=90?= =?UTF-8?q?=E5=8D=95=E5=85=83=E5=A4=9A=E6=AC=A1=E6=B7=BB=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/MaaControlUnit/Input/MaatouchInput.h | 8 +++++--- source/MaaControlUnit/Input/MinitouchInput.h | 1 + source/MaaControlUnit/Input/MtouchHelper.h | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/MaaControlUnit/Input/MaatouchInput.h b/source/MaaControlUnit/Input/MaatouchInput.h index b19e2ecef..deefdba2e 100644 --- a/source/MaaControlUnit/Input/MaatouchInput.h +++ b/source/MaaControlUnit/Input/MaatouchInput.h @@ -14,6 +14,7 @@ class MaatouchInput : public MtouchHelper, public KeyInputBase public: MaatouchInput(std::filesystem::path agent_path) : agent_path_(std::move(agent_path)) { + TouchInputBase::children_.emplace_back(invoke_app_); KeyInputBase::children_.emplace_back(invoke_app_); } virtual ~MaatouchInput() override = default; @@ -23,17 +24,17 @@ class MaatouchInput : public MtouchHelper, public KeyInputBase virtual void set_io(std::shared_ptr io_ptr) override { - MtouchHelper::set_io(io_ptr); + TouchInputBase::set_io(io_ptr); KeyInputBase::set_io(io_ptr); } virtual void set_replacement(Argv::replacement argv_replace) override { - MtouchHelper::set_replacement(argv_replace); + TouchInputBase::set_replacement(argv_replace); KeyInputBase::set_replacement(argv_replace); } virtual void merge_replacement(Argv::replacement argv_replace, bool _override = true) override { - MtouchHelper::merge_replacement(argv_replace, _override); + TouchInputBase::merge_replacement(argv_replace, _override); KeyInputBase::merge_replacement(argv_replace, _override); } @@ -58,6 +59,7 @@ class MaatouchInput : public MtouchHelper, public KeyInputBase std::filesystem::path agent_path_; std::string package_name_; + std::shared_ptr invoke_app_ = std::make_shared(); }; MAA_CTRL_UNIT_NS_END diff --git a/source/MaaControlUnit/Input/MinitouchInput.h b/source/MaaControlUnit/Input/MinitouchInput.h index e69b3a389..2f30a8a9d 100644 --- a/source/MaaControlUnit/Input/MinitouchInput.h +++ b/source/MaaControlUnit/Input/MinitouchInput.h @@ -52,6 +52,7 @@ class MinitouchInput : public MtouchHelper std::filesystem::path agent_path_; std::vector arch_list_; + std::shared_ptr invoke_app_ = std::make_shared(); }; MAA_CTRL_UNIT_NS_END diff --git a/source/MaaControlUnit/Input/MtouchHelper.h b/source/MaaControlUnit/Input/MtouchHelper.h index 1f81c892e..28d00315e 100644 --- a/source/MaaControlUnit/Input/MtouchHelper.h +++ b/source/MaaControlUnit/Input/MtouchHelper.h @@ -9,7 +9,6 @@ MAA_CTRL_UNIT_NS_BEGIN class MtouchHelper : public TouchInputBase { public: - MtouchHelper() { children_.emplace_back(invoke_app_); } virtual ~MtouchHelper() override = default; public: // from TouchInputAPI @@ -25,7 +24,6 @@ class MtouchHelper : public TouchInputBase virtual std::pair screen_to_touch(int x, int y) = 0; virtual std::pair screen_to_touch(double x, double y) = 0; - std::shared_ptr invoke_app_ = std::make_shared(); std::shared_ptr shell_handler_ = nullptr; int screen_width_ = 0;