From 4475d93f0d7d50509e011f58f0026bb52001baac Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Fri, 1 Mar 2024 15:15:05 +0800 Subject: [PATCH] multimodal event Signed-off-by: zhouchaobo Change-Id: Ib3042429da9a3951e2395852305be0402ec45ff1 --- multimodalinput/input/BUILD.gn | 21 +++++ multimodalinput/input/input_event.h | 115 ++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 multimodalinput/input/BUILD.gn create mode 100644 multimodalinput/input/input_event.h diff --git a/multimodalinput/input/BUILD.gn b/multimodalinput/input/BUILD.gn new file mode 100644 index 00000000000..a6b7f3bbc45 --- /dev/null +++ b/multimodalinput/input/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2021-2022 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +ohos_ndk_headers("input_header") { + dest_dir = "$ndk_headers_out_dir/input/" + sources = [ + "input_event.h", + ] +} diff --git a/multimodalinput/input/input_event.h b/multimodalinput/input/input_event.h new file mode 100644 index 00000000000..18eecbf68f3 --- /dev/null +++ b/multimodalinput/input/input_event.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2024 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup MultiModalInput_EventModule + * @{ + * + * @brief Declares the input event capabilities on the native side. + * + * @since 12 + */ + +/** + * @file input_event.h + * + * @brief Provides event definitions on the native side. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ + +#ifndef _MULTIMODALINPUT_INPUT_EVENT_H_ +#define _MULTIMODALINPUT_INPUT_EVENT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Source type definition of the input event. + * + * @since 12 + */ +typedef enum { + /** Indicates an unknown input source type. It is usually used as the initial value. */ + INPUT_EVENT_SOURCE_TYPE_UNKNOWN = 0, + /** Indicates that the input source generates events similar to mouse cursor movement, + * button press and release, and wheel scrolling. */ + INPUT_EVENT_SOURCE_TYPE_MOUSE = 1, + /** Indicates that the input source generates a touchscreen multi-touch event. */ + INPUT_EVENT_SOURCE_TYPE_TOUCHSCREEN = 2, + /** Indicates that the input source generates a touchpad multi-touch event. */ + INPUT_EVENT_SOURCE_TYPE_TOUCHPAD = 3, + /** Indicates joystick-like events generated by the input source, such as button pressing, button lifting, + * and wheel scrolling. */ + INPUT_EVENT_SOURCE_TYPE_JOYSTICK = 4, +} InputEvent_SourceType; + +/** + * @brief Tool type definition of the input event. + * + * @since 12 + */ +typedef enum { + /** Indicates a finger. */ + INPUT_EVENT_TOOL_TYPE_FINGER = 0, + /** Indicates a stylus. */ + INPUT_EVENT_TOOL_TYPE_PEN = 1, + /** Indicates an eraser. */ + INPUT_EVENT_TOOL_TYPE_RUBBER = 2, + /** Indicates a brush. */ + INPUT_EVENT_TOOL_TYPE_BRUSH = 3, + /** Indicates a pencil. */ + INPUT_EVENT_TOOL_TYPE_PENCIL = 4, + /** Indicates an air brush. */ + INPUT_EVENT_TOOL_TYPE_AIRBRUSH = 5, + /** Indicates a mouse. */ + INPUT_EVENT_TOOL_TYPE_MOUSE = 6, + /** Indicates a lens. */ + INPUT_EVENT_TOOL_TYPE_LENS = 7, + /** Indicates a knuckle. */ + INPUT_EVENT_TOOL_TYPE_KNUCKLE = 8, + /** Indicates a touchpad. */ + INPUT_EVENT_TOOL_TYPE_TOUCHPAD = 9, + /** Indicates a palm. */ + INPUT_EVENT_TOOL_TYPE_PALM = 10, +} InputEvent_ToolType; + +/** + * @brief Action type definition of the Touch event. + * + * @since 12 + */ +typedef enum { + /** Indicates an unknown touch action. It is usually used as initial value. */ + TOUCH_EVENT_ACTION_UNKNOWN = 0, + /** Indicates a touch action that has been canceled. */ + TOUCH_EVENT_ACTION_CANCEL = 1, + /** Indicates a touch action representing that a finger is pressed on a touchscreen or touchpad. */ + TOUCH_EVENT_ACTION_DOWN = 2, + /** Indicates a touch action representing that a finger moves on a touchscreen or touchpad or a mouse + * pointer moves. */ + TOUCH_EVENT_ACTION_MOVE = 3, + /** Indicates a touch action representing that a finger leaves the touchscreen or touchpad.*/ + TOUCH_EVENT_ACTION_UP = 4, +} TouchEvent_Action; + +#ifdef __cplusplus +}; +#endif + +#endif // _MULTIMODALINPUT_INPUT_EVENT_H_ +/** @} */ -- Gitee