From ac5d91823a154c7380dea9f7a4bd586975de2c34 Mon Sep 17 00:00:00 2001 From: wuliangdong Date: Thu, 12 Jun 2025 10:18:15 +0800 Subject: [PATCH] Feat: Add Function To Support Getter and Setter Of GlobalX/GlobalY For MouseEvent/TouchEvent/AxisEvent. Signed-off-by: wuliangdong Change-Id: I710f67a32b33c5a874eca71c3595f06564a15bf5 --- .../kits/c/input/oh_input_manager.h | 134 +++++++++++++++++- 1 file changed, 133 insertions(+), 1 deletion(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 3934be3b9..27c4b52a6 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -798,6 +798,46 @@ void OH_Input_SetMouseEventDisplayId(struct Input_MouseEvent* mouseEvent, int32_ */ int32_t OH_Input_GetMouseEventDisplayId(const struct Input_MouseEvent* mouseEvent); +/** + * @brief Set the global X coordinate of the mouse event. + * + * @param mouseEvent Mouse event object. + * @param globalX Global X coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +void OH_Input_SetMouseEventGlobalX(struct Input_MouseEvent* mouseEvent, int32_t globalX); + +/** + * @brief Queries the global X coordinate of the mouse event. + * + * @param mouseEvent Mouse event object. + * @return Global X coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +int32_t OH_Input_GetMouseEventGlobalX(const struct Input_MouseEvent* mouseEvent); + +/** + * @brief Set the global Y coordinate of the mouse event. + * + * @param mouseEvent Mouse event object. + * @param globalY Global Y coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +void OH_Input_SetMouseEventGlobalY(struct Input_MouseEvent* mouseEvent, int32_t globalY); + +/** + * @brief Queries the global Y coordinate of the mouse event. + * + * @param mouseEvent Mouse event object. + * @return Global Y coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +int32_t OH_Input_GetMouseEventGlobalY(const struct Input_MouseEvent* mouseEvent); + /** * @brief Inject touch event. * @@ -969,6 +1009,46 @@ void OH_Input_SetTouchEventDisplayId(struct Input_TouchEvent* touchEvent, int32_ */ int32_t OH_Input_GetTouchEventDisplayId(const struct Input_TouchEvent* touchEvent); +/** + * @brief Set the global X coordinate of the touch event. + * + * @param touchEvent Touch event object. + * @param globalX Global X coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +void OH_Input_SetTouchEventGlobalX(struct Input_TouchEvent* touchEvent, int32_t globalX); + +/** + * @brief Queries the global X coordinate of the touch event. + * + * @param touchEvent Touch event object. + * @return Global X coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +int32_t OH_Input_GetTouchEventGlobalX(const struct Input_TouchEvent* touchEvent); + +/** + * @brief Set the global Y coordinate of the touch event. + * + * @param touchEvent Touch event object. + * @param globalY Global Y coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +void OH_Input_SetTouchEventGlobalY(struct Input_TouchEvent* touchEvent, int32_t globalY); + +/** + * @brief Queries the global Y coordinate of the touch event. + * + * @param touchEvent Touch event object. + * @return Global Y coordinate. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +int32_t OH_Input_GetTouchEventGlobalY(const struct Input_TouchEvent* touchEvent); + /** * @brief Cancels event injection and revokes authorization. * @@ -1238,6 +1318,58 @@ Input_Result OH_Input_SetAxisEventDisplayId(Input_AxisEvent* axisEvent, int32_t */ Input_Result OH_Input_GetAxisEventDisplayId(const Input_AxisEvent* axisEvent, int32_t* displayId); +/** + * @brief Set the global X coordinate of the axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param globalX Global X coordinate. + * @return OH_Input_SetAxisEventGlobalX function result code. + * {@link INPUT_SUCCESS} Success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +Input_Result OH_Input_SetAxisEventGlobalX(struct Input_AxisEvent* axisEvent, int32_t globalX); + +/** + * @brief Queries the global X coordinate of the axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param globalX Global X coordinate. + * @return OH_Input_GetAxisEventGlobalX function result code. + * {@link INPUT_SUCCESS} Success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL or the globalX is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +Input_Result OH_Input_GetAxisEventGlobalX(const Input_AxisEvent* axisEvent, int32_t* globalX); + +/** + * @brief Set the global Y coordinate of the axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param globalY Global Y coordinate. + * @return OH_Input_SetAxisEventGlobalY function result code. + * {@link INPUT_SUCCESS} Success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +Input_Result OH_Input_SetAxisEventGlobalY(struct Input_AxisEvent* axisEvent, int32_t globalY); + +/** + * @brief Queries the global Y coordinate of the axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param globalY Global Y coordinate. + * @return OH_Input_GetAxisEventGlobalY function result code. + * {@link INPUT_SUCCESS} Success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL or the globalY is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 20 + */ +Input_Result OH_Input_GetAxisEventGlobalY(const Input_AxisEvent* axisEvent, int32_t* globalY); + /** * @brief Adds a listener of key events. * -- Gitee