diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 3cade9b3acd9c554a23a10edc32e00c7ca1a6193..9e11c55233d272049e82d455d9ce8483419c3db9 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -208,6 +208,13 @@ typedef struct Input_TouchEvent Input_TouchEvent; */ typedef struct Input_AxisEvent Input_AxisEvent; +/** + * @brief Defines the hot key structure. + * + * @since 13 + */ +typedef struct Input_Hotkey Input_Hotkey; + /** * @brief Enumerates error codes. * @@ -1214,6 +1221,113 @@ Input_Result OH_Input_RemoveInputEventInterceptor(void); */ Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval); +/** + * @brief Creates a hot key object. + * + * @return Returns an {@Link Input_Hotkey} pointer object if the operation is successful. Otherwise, a null pointer is + * returned. The possible cause is memory allocation failure. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +Input_Hotkey *OH_Input_CreateHotkey(void); + +/** + * @brief Destroys a hot key object. + * + * @param hotkey Hot key object. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +void OH_Input_DestroyHotkey(Input_Hotkey **hotkey); + +/** + * @brief Sets a modifier key. + * + * @param hotkey Hotkey key object. + * @param preKeys List of modifier keys. + * @param size Number of modifier keys. One or two modifier keys are supported. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size); + +/** + * @brief Obtains a modifier key. + * + * @param hotkey Hotkey key object. + * @param preKeys List of modifier keys. + * @param preKeyCount Number of modifier keys. + * @return OH_Input_GetPreKeys status code, specifically, + * {@link INPUT_SUCCESS} if the operation is successful;\n + * {@link INPUT_PARAMETER_ERROR} The hotkey is NULL or the pressedKeys is NULL or the pressedKeyCount + * is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, int32_t *preKeyCount); + +/** + * @brief Sets a modified key. + * + * @param hotkey Hotkey key object. + * @param finalKey Modified key. Only one modified key is supported. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +void OH_Input_SetFinalKey(Input_Hotkey *hotkey, int32_t finalKey); + +/** + * @brief Obtains a modified key. + * + * @param hotkey Hotkey key object. + * @param finalKeyCode Returns the key value of the decorated key. + * @return OH_Input_GetfinalKey status code, specifically, + * {@link INPUT_SUCCESS} if the operation is successful;\n + * {@link INPUT_PARAMETER_ERROR} The hotkey is NULL or the finalKeyCode is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +Input_Result OH_Input_GetFinalKey(const Input_Hotkey *hotkey, int32_t *finalKeyCode); + +/** + * @brief Creates an array of {@Link Input_Hotkey} instances. + * + * @param count Number of {@Link Input_Hotkey} instances to be created. The count must be the same as the number of + * system shortcut keys. + * @return Returns a pointer to an array of {@Link Input_Hotkey} instances if the operation is successful. If the + * operation fails, a null pointer is returned. The possible cause is memory allocation failure or count is not equal + * to the number of system hotkeys. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count); + +/** + * @brief Destroys an array of {@link Input_Hotkey} instances and reclaims memory. + * + * @param hotkeys Pointer to an array of {@Link Input_Hotkey } instances created by the + * {@Link OH_Input_CreateAllSystemHotkeys} method. + * @param count Count of the array to be destroyed, which must be the same as the number of system shortcut keys. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count); + +/** + * @brief Obtains all hot keys supported by the system. + * + * @param hotkey Array of {@Link Input_Hotkey} instances. + * When calling this API for the first time, you can pass NULL to obtain the array length. + * @param count Number of hot keys supported by the system. + * @return OH_Input_GetAllSystemHotkeys status code, specifically, + * {@link INPUT_SUCCESS} if the operation is successful;\n + * {@link INPUT_PARAMETER_ERROR} The hotkey or count is NULL, or the value of count does not match the number + * of system shortcut keys supported by the system. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 13 + */ +Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count); + #ifdef __cplusplus } #endif diff --git a/multimodalinput/kits/c/ohinput.ndk.json b/multimodalinput/kits/c/ohinput.ndk.json index cfbe993aee96320e1a73e14d8367836b29bd1ad1..60da3d2a8693d8710cb5e5a35efc29fa3157a6c1 100644 --- a/multimodalinput/kits/c/ohinput.ndk.json +++ b/multimodalinput/kits/c/ohinput.ndk.json @@ -314,5 +314,45 @@ { "first_introduced": "12", "name": "OH_Input_RemoveInputEventInterceptor" + }, + { + "first_introduced": "13", + "name": "OH_Input_GetIntervalSinceLastInput" + }, + { + "first_introduced": "13", + "name": "OH_Input_CreateAllSystemHotkeys" + }, + { + "first_introduced": "13", + "name": "OH_Input_DestroyAllSystemHotkeys" + }, + { + "first_introduced": "13", + "name": "OH_Input_GetAllSystemHotkeys" + }, + { + "first_introduced": "13", + "name": "OH_Input_CreateHotkey" + }, + { + "first_introduced": "13", + "name": "OH_Input_DestroyHotkey" + }, + { + "first_introduced": "13", + "name": "OH_Input_SetPreKeys" + }, + { + "first_introduced": "13", + "name": "OH_Input_GetPreKeys" + }, + { + "first_introduced": "13", + "name": "OH_Input_SetFinalKey" + }, + { + "first_introduced": "13", + "name": "OH_Input_GetFinalKey" } ] \ No newline at end of file