1 /* 2 * Copyright (c) 2021-2022 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 KEY_EVENT_VALUE_TRANSFORMATION_H 17 #define KEY_EVENT_VALUE_TRANSFORMATION_H 18 19 #include <string> 20 #include <map> 21 #include <iostream> 22 #include <xkbcommon/xkbcommon.h> 23 #include "hos_key_event.h" 24 #include "nocopyable.h" 25 26 namespace OHOS { 27 namespace MMI { 28 enum MMI_SYSTEM_KEY_STATE { 29 MMI_NO_SYSTEM_KEY = 0, 30 MMI_SYSTEM_KEY = 1, 31 }; 32 33 struct KeyEventValueTransformations { 34 std::string keyEvent; 35 int16_t keyValueOfNative; 36 int16_t keyValueOfSys; 37 int16_t keyEventOfSys; 38 int16_t isSystemKey; 39 }; 40 41 KeyEventValueTransformations KeyValueTransformationInput(int16_t keyValueOfInput); 42 43 class KeyEventValueTransformation { 44 public: 45 KeyEventValueTransformation(); 46 DISALLOW_COPY_AND_MOVE(KeyEventValueTransformation); 47 virtual ~KeyEventValueTransformation(); 48 49 bool Init(); 50 uint32_t KeyboardHandleKeySym(uint32_t keyboardKey); 51 52 private: 53 struct xkb_state *state_ = nullptr; 54 }; 55 } // namespace MMI 56 } // namespace OHOS 57 58 #endif // KEY_EVENT_VALUE_TRANSFORMATION_H