From f01e5c421d10ccb340846f82b6e0f1386b5d2405 Mon Sep 17 00:00:00 2001 From: Rosita Date: Sat, 21 Jun 2025 04:26:28 +0000 Subject: [PATCH 1/2] add getpointerlocation Signed-off-by: Rosita --- .../kits/c/input/oh_input_manager.h | 26 +++++++++++++++++++ multimodalinput/kits/c/ohinput.ndk.json | 4 +++ 2 files changed, 30 insertions(+) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 56870fe0f..23dd46b58 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -304,6 +304,16 @@ typedef enum Input_Result { * @since 20 */ INPUT_INJECTION_AUTHORIZED_OTHERS = 3900008, + /** + * @error App is not the focused app + * @since 20 + */ + INPUT_APP_NOT_FOCUSED = 3900009, + /** + * @error The device has no pointer + * @since 20 + */ + INPUT_DEVICE_NO_POINTER = 3900010, } Input_Result; /** @@ -1909,6 +1919,22 @@ Input_Result OH_Input_UnregisterDeviceListeners(); * @since 15 */ Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state); + +/** + * @brief Get pointer location. + * + * @param displayId The displayId for the pointer location. + * @param displayX The displayX for the pointer location. + * @param displayY The displayY for the pointer location. + * @return OH_Input_GetPointerLocation function api result code + * {@link INPUT_SUCCESS} if the operation is successful; + * {@link INPUT_PARAMETER_ERROR} if parameter is a null pointer; + * {@link INPUT_APP_NOT_FOCUSED} if the app is not the focused app; + * {@link INPUT_DEVICE_NO_POINTER} if the device has no pointer; + * {@link INPUT_SERVICE_EXCEPTION} if the service is exception. + * @since 20 + */ +Input_Result OH_Input_GetPointerLocation(int32_t *displayId, double *displayX, double *displayY); #ifdef __cplusplus } #endif diff --git a/multimodalinput/kits/c/ohinput.ndk.json b/multimodalinput/kits/c/ohinput.ndk.json index 9b81d6d94..9f94711d5 100644 --- a/multimodalinput/kits/c/ohinput.ndk.json +++ b/multimodalinput/kits/c/ohinput.ndk.json @@ -507,4 +507,8 @@ "first_introduced": "20", "name": "OH_Input_QueryAuthorizedStatus" } + { + "first_introduced": "20", + "name": "OH_Input_GetPointerLocation" + } ] \ No newline at end of file -- Gitee From 1c411e585e8b32cd506bde35366698dbf27bb7f9 Mon Sep 17 00:00:00 2001 From: Rosita Date: Sat, 21 Jun 2025 04:31:37 +0000 Subject: [PATCH 2/2] update multimodalinput/kits/c/ohinput.ndk.json. Signed-off-by: Rosita --- multimodalinput/kits/c/ohinput.ndk.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimodalinput/kits/c/ohinput.ndk.json b/multimodalinput/kits/c/ohinput.ndk.json index 9f94711d5..7672db023 100644 --- a/multimodalinput/kits/c/ohinput.ndk.json +++ b/multimodalinput/kits/c/ohinput.ndk.json @@ -506,7 +506,7 @@ { "first_introduced": "20", "name": "OH_Input_QueryAuthorizedStatus" - } + }, { "first_introduced": "20", "name": "OH_Input_GetPointerLocation" -- Gitee