1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ARKUI_INPUT_RAW_INPUT_INJECTOR_RAW_INPUT_INJECTING_EXECUTOR_H 17 #define ARKUI_INPUT_RAW_INPUT_INJECTOR_RAW_INPUT_INJECTING_EXECUTOR_H 18 19 #include <string> 20 #include <vector> 21 22 #include "raw_input_command.h" 23 24 namespace OHOS { 25 namespace Ace { 26 27 struct InjectingInfo { 28 int32_t actionType; 29 int32_t finger; 30 int32_t x; 31 int32_t y; 32 int64_t actionTime; 33 int32_t sourceType; // not used for now 34 }; 35 36 class InjectingExecutor { 37 public: 38 static int32_t GetPointerActionFromCommandType(CommandType type); 39 static CommandType GetCommandTypeFromPointerAction(int32_t pointerActionType); 40 static std::string GetPointerActionName(int32_t pointerActionType); 41 static bool IsEventNeedTriggerImmediatly(int32_t pointerActionType); 42 // 1. the activing injecting will be used as the pointer event object; 43 // 2. all other injectings will be packed into the activing injecting object; 44 // 3. if there is no any activing injecting, the injecting will be given up, and return false as result; 45 // 4. if there are more than 1 activing injecting, they will be injected one by one, and all other injecting info 46 // will be packed into them seperatly; 47 static bool InjectOnePonterEvent( 48 std::vector<InjectingInfo>& activingInjecting, std::vector<InjectingInfo>& allOtherInjectings); 49 50 private: 51 InjectingExecutor() = default; 52 ~InjectingExecutor() = default; 53 }; 54 } // namespace Ace 55 } // namespace OHOS 56 #endif // ARKUI_INPUT_RAW_INPUT_INJECTOR_RAW_INPUT_INJECTING_EXECUTOR_H 57