1 /*
2 * Copyright (c) 2023 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 #include "adapter/ohos/entrance/mmi_event_convertor.h"
17
18 #include "adapter/ohos/entrance/ace_application_info.h"
19 #include "adapter/ohos/entrance/ace_extra_input_data.h"
20 #include "adapter/ohos/entrance/ace_container.h"
21 #include "adapter/ohos/entrance/tsa_advanced_feature.h"
22
23 namespace OHOS::Ace::Platform {
24 namespace {
25 constexpr int32_t ANGLE_0 = 0;
26 constexpr int32_t ANGLE_90 = 90;
27 constexpr int32_t ANGLE_180 = 180;
28 constexpr int32_t ANGLE_270 = 270;
29 constexpr double SIZE_DIVIDE = 2.0;
30 } // namespace
31
GetSourceTool(int32_t orgToolType)32 SourceTool GetSourceTool(int32_t orgToolType)
33 {
34 switch (orgToolType) {
35 case OHOS::MMI::PointerEvent::TOOL_TYPE_FINGER:
36 return SourceTool::FINGER;
37 case OHOS::MMI::PointerEvent::TOOL_TYPE_PEN:
38 return SourceTool::PEN;
39 case OHOS::MMI::PointerEvent::TOOL_TYPE_RUBBER:
40 return SourceTool::RUBBER;
41 case OHOS::MMI::PointerEvent::TOOL_TYPE_BRUSH:
42 return SourceTool::BRUSH;
43 case OHOS::MMI::PointerEvent::TOOL_TYPE_PENCIL:
44 return SourceTool::PENCIL;
45 case OHOS::MMI::PointerEvent::TOOL_TYPE_AIRBRUSH:
46 return SourceTool::AIRBRUSH;
47 case OHOS::MMI::PointerEvent::TOOL_TYPE_MOUSE:
48 return SourceTool::MOUSE;
49 case OHOS::MMI::PointerEvent::TOOL_TYPE_LENS:
50 return SourceTool::LENS;
51 case OHOS::MMI::PointerEvent::TOOL_TYPE_TOUCHPAD:
52 return SourceTool::TOUCHPAD;
53 default:
54 LOGW("unknown tool type");
55 return SourceTool::UNKNOWN;
56 }
57 }
58
GetPointerSensorTime(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)59 uint64_t GetPointerSensorTime(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
60 {
61 if (AceApplicationInfo::GetInstance().GetTouchEventPassMode() != TouchPassMode::ACCELERATE) {
62 return pointerEvent->GetActionTime();
63 }
64 auto inputTime = pointerEvent->GetSensorInputTime();
65 if (inputTime == 0) {
66 // inject event has no sensor time.
67 inputTime = pointerEvent->GetActionTime();
68 }
69 return inputTime;
70 }
71
ConvertTouchPoint(const MMI::PointerEvent::PointerItem & pointerItem)72 TouchPoint ConvertTouchPoint(const MMI::PointerEvent::PointerItem& pointerItem)
73 {
74 TouchPoint touchPoint;
75 // just get the max of width and height
76 touchPoint.size = std::max(pointerItem.GetWidth(), pointerItem.GetHeight()) / 2.0;
77 touchPoint.id = pointerItem.GetPointerId();
78 touchPoint.downTime = TimeStamp(std::chrono::microseconds(pointerItem.GetDownTime()));
79 touchPoint.x = pointerItem.GetWindowX();
80 touchPoint.y = pointerItem.GetWindowY();
81 touchPoint.screenX = pointerItem.GetDisplayX();
82 touchPoint.screenY = pointerItem.GetDisplayY();
83 touchPoint.isPressed = pointerItem.IsPressed();
84 touchPoint.force = static_cast<float>(pointerItem.GetPressure());
85 touchPoint.tiltX = pointerItem.GetTiltX();
86 touchPoint.tiltY = pointerItem.GetTiltY();
87 touchPoint.rollAngle = pointerItem.GetAngle();
88 touchPoint.sourceTool = GetSourceTool(pointerItem.GetToolType());
89 touchPoint.originalId = pointerItem.GetOriginPointerId();
90 touchPoint.width = pointerItem.GetWidth();
91 touchPoint.height = pointerItem.GetHeight();
92 int32_t blobId = pointerItem.GetBlobId();
93 if (blobId < 0) {
94 touchPoint.operatingHand = 0;
95 } else {
96 touchPoint.operatingHand = static_cast<int32_t>(static_cast<uint32_t>(blobId) &
97 (OPERATING_HAND_LEFT | OPERATING_HAND_RIGHT));
98 }
99 return touchPoint;
100 }
101
UpdateTouchEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,TouchEvent & touchEvent)102 void UpdateTouchEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, TouchEvent& touchEvent)
103 {
104 CHECK_NULL_VOID(pointerEvent);
105 auto ids = pointerEvent->GetPointerIds();
106 for (auto&& id : ids) {
107 MMI::PointerEvent::PointerItem item;
108 bool ret = pointerEvent->GetPointerItem(id, item);
109 if (!ret) {
110 LOGE("get pointer item failed.");
111 continue;
112 }
113 auto touchPoint = ConvertTouchPoint(item);
114 touchPoint.CovertId();
115 touchEvent.pointers.emplace_back(std::move(touchPoint));
116 }
117 touchEvent.CovertId();
118 }
119
GetTouchEventOriginOffset(const TouchEvent & event)120 Offset GetTouchEventOriginOffset(const TouchEvent& event)
121 {
122 auto pointerEvent = event.pointerEvent;
123 if (!pointerEvent) {
124 return Offset();
125 }
126 int32_t pointerID = pointerEvent->GetPointerId();
127 MMI::PointerEvent::PointerItem item;
128 bool ret = pointerEvent->GetPointerItem(pointerID, item);
129 if (!ret) {
130 return Offset();
131 } else {
132 return Offset(item.GetWindowX(), item.GetWindowY());
133 }
134 }
135
GetTouchEventOriginTimeStamp(const TouchEvent & event)136 TimeStamp GetTouchEventOriginTimeStamp(const TouchEvent& event)
137 {
138 auto pointerEvent = event.pointerEvent;
139 if (!pointerEvent) {
140 return event.time;
141 }
142 std::chrono::microseconds microseconds(pointerEvent->GetActionTime());
143 TimeStamp time(microseconds);
144 return time;
145 }
146
UpdatePressedKeyCodes(std::vector<KeyCode> & pressedKeyCodes)147 void UpdatePressedKeyCodes(std::vector<KeyCode>& pressedKeyCodes)
148 {
149 auto inputManager = MMI::InputManager::GetInstance();
150 CHECK_NULL_VOID(inputManager);
151
152 std::vector<int32_t> pressedKeys;
153 std::map<int32_t, int32_t> specialKeysState;
154 pressedKeyCodes.clear();
155 auto ret = inputManager->GetKeyState(pressedKeys, specialKeysState);
156 if (ret == 0) {
157 for (const auto& curCode : pressedKeys) {
158 pressedKeyCodes.emplace_back(static_cast<KeyCode>(curCode));
159 }
160 }
161 }
162
UpdateMouseEventForPen(const MMI::PointerEvent::PointerItem & pointerItem,MouseEvent & mouseEvent)163 void UpdateMouseEventForPen(const MMI::PointerEvent::PointerItem& pointerItem, MouseEvent& mouseEvent)
164 {
165 if (mouseEvent.sourceType != SourceType::TOUCH || mouseEvent.sourceTool != SourceTool::PEN) {
166 return;
167 }
168 mouseEvent.id = TOUCH_TOOL_BASE_ID + static_cast<int32_t>(mouseEvent.sourceTool);
169 // Pen use type double XY position.
170 mouseEvent.x = pointerItem.GetWindowXPos();
171 mouseEvent.y = pointerItem.GetWindowYPos();
172 mouseEvent.screenX = pointerItem.GetDisplayXPos();
173 mouseEvent.screenY = pointerItem.GetDisplayYPos();
174 mouseEvent.originalId = mouseEvent.id;
175 }
176
ConvertTouchEventFromTouchPoint(TouchPoint touchPoint)177 TouchEvent ConvertTouchEventFromTouchPoint(TouchPoint touchPoint)
178 {
179 TouchEvent event;
180 event.SetId(touchPoint.id)
181 .SetX(touchPoint.x)
182 .SetY(touchPoint.y)
183 .SetScreenX(touchPoint.screenX)
184 .SetScreenY(touchPoint.screenY)
185 .SetType(TouchType::UNKNOWN)
186 .SetPullType(TouchType::UNKNOWN)
187 .SetSize(touchPoint.size)
188 .SetForce(touchPoint.force)
189 .SetTiltX(touchPoint.tiltX)
190 .SetTiltY(touchPoint.tiltY)
191 .SetRollAngle(touchPoint.rollAngle)
192 .SetSourceType(SourceType::NONE)
193 .SetSourceTool(touchPoint.sourceTool)
194 .SetOriginalId(touchPoint.originalId)
195 .SetSourceType(SourceType::NONE)
196 .SetOperatingHand(touchPoint.operatingHand)
197 .SetPressedTime(touchPoint.downTime)
198 .SetWidth(touchPoint.width)
199 .SetHeight(touchPoint.height);
200 return event;
201 }
202
SetClonedPointerEvent(const MMI::PointerEvent * pointerEvent,ArkUITouchEvent * arkUITouchEventCloned)203 void SetClonedPointerEvent(const MMI::PointerEvent* pointerEvent, ArkUITouchEvent* arkUITouchEventCloned)
204 {
205 if (pointerEvent) {
206 MMI::PointerEvent* clonedEvent = new MMI::PointerEvent(*pointerEvent);
207 arkUITouchEventCloned->rawPointerEvent = clonedEvent;
208 }
209 }
210
SetPostPointerEvent(TouchEvent & touchEvent,ArkUITouchEvent * arkUITouchEventCloned)211 void SetPostPointerEvent(TouchEvent& touchEvent, ArkUITouchEvent* arkUITouchEventCloned)
212 {
213 MMI::PointerEvent* pointerEvent = reinterpret_cast<MMI::PointerEvent*>(arkUITouchEventCloned->rawPointerEvent);
214 if (pointerEvent) {
215 MMI::PointerEvent* clonedEvent = new MMI::PointerEvent(*pointerEvent);
216 arkUITouchEventCloned->rawPointerEvent = clonedEvent;
217 }
218 std::shared_ptr<const MMI::PointerEvent> pointer(pointerEvent);
219 touchEvent.SetPointerEvent(pointer);
220 }
221
DestroyRawPointerEvent(ArkUITouchEvent * arkUITouchEvent)222 void DestroyRawPointerEvent(ArkUITouchEvent* arkUITouchEvent)
223 {
224 MMI::PointerEvent* pointerEvent = reinterpret_cast<MMI::PointerEvent*>(arkUITouchEvent->rawPointerEvent);
225 if (pointerEvent) {
226 delete pointerEvent;
227 pointerEvent = nullptr;
228 }
229 }
230
ConvertTouchEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)231 TouchEvent ConvertTouchEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
232 {
233 CHECK_NULL_RETURN(pointerEvent, TouchEvent());
234 int32_t pointerID = pointerEvent->GetPointerId();
235 MMI::PointerEvent::PointerItem item;
236 bool ret = pointerEvent->GetPointerItem(pointerID, item);
237 if (!ret) {
238 LOGE("get pointer item failed.");
239 return TouchEvent();
240 }
241 auto touchPoint = ConvertTouchPoint(item);
242 TouchEvent event = ConvertTouchEventFromTouchPoint(touchPoint);
243 std::chrono::microseconds microseconds(GetPointerSensorTime(pointerEvent));
244 TimeStamp time(microseconds);
245 event.SetTime(time)
246 .SetDeviceId(pointerEvent->GetDeviceId())
247 .SetTargetDisplayId(pointerEvent->GetTargetDisplayId())
248 .SetTouchEventId(pointerEvent->GetId());
249 AceExtraInputData::ReadToTouchEvent(pointerEvent, event);
250 event.pointerEvent = pointerEvent;
251 int32_t orgDevice = pointerEvent->GetSourceType();
252 GetEventDevice(orgDevice, event);
253 int32_t orgAction = pointerEvent->GetPointerAction();
254 SetTouchEventType(orgAction, event);
255 event.isPrivacyMode = pointerEvent->HasFlag(OHOS::MMI::InputEvent::EVENT_FLAG_PRIVACY_MODE);
256 UpdateTouchEvent(pointerEvent, event);
257 if (event.sourceType == SourceType::TOUCH && event.sourceTool == SourceTool::PEN) {
258 // Pen use type double XY position.
259 event.x = item.GetWindowXPos();
260 event.y = item.GetWindowYPos();
261 event.screenX = item.GetDisplayXPos();
262 event.screenY = item.GetDisplayYPos();
263 }
264 event.pressedKeyCodes_.clear();
265 for (const auto& curCode : pointerEvent->GetPressedKeys()) {
266 event.pressedKeyCodes_.emplace_back(static_cast<KeyCode>(curCode));
267 }
268 return event;
269 }
270
SetTouchEventType(int32_t orgAction,TouchEvent & event)271 void SetTouchEventType(int32_t orgAction, TouchEvent& event)
272 {
273 std::map<int32_t, TouchType> actionMap = {
274 { OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL, TouchType::CANCEL },
275 { OHOS::MMI::PointerEvent::POINTER_ACTION_DOWN, TouchType::DOWN },
276 { OHOS::MMI::PointerEvent::POINTER_ACTION_MOVE, TouchType::MOVE },
277 { OHOS::MMI::PointerEvent::POINTER_ACTION_UP, TouchType::UP },
278 { OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_DOWN, TouchType::PULL_DOWN },
279 { OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_MOVE, TouchType::PULL_MOVE },
280 { OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_UP, TouchType::PULL_UP },
281 { OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_IN_WINDOW, TouchType::PULL_IN_WINDOW },
282 { OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW, TouchType::PULL_OUT_WINDOW },
283 { OHOS::MMI::PointerEvent::POINTER_ACTION_HOVER_ENTER, TouchType::HOVER_ENTER },
284 { OHOS::MMI::PointerEvent::POINTER_ACTION_HOVER_MOVE, TouchType::HOVER_MOVE },
285 { OHOS::MMI::PointerEvent::POINTER_ACTION_HOVER_EXIT, TouchType::HOVER_EXIT },
286 { OHOS::MMI::PointerEvent::POINTER_ACTION_HOVER_CANCEL, TouchType::HOVER_CANCEL },
287 { OHOS::MMI::PointerEvent::POINTER_ACTION_PROXIMITY_IN, TouchType::PROXIMITY_IN },
288 { OHOS::MMI::PointerEvent::POINTER_ACTION_PROXIMITY_OUT, TouchType::PROXIMITY_OUT },
289 };
290 auto typeIter = actionMap.find(orgAction);
291 if (typeIter == actionMap.end()) {
292 TAG_LOGI(AceLogTag::ACE_INPUTKEYFLOW, "unknown touch type");
293 return;
294 }
295 event.type = typeIter->second;
296 if (typeIter->second == TouchType::PULL_DOWN || typeIter->second == TouchType::PULL_MOVE ||
297 typeIter->second == TouchType::PULL_UP || typeIter->second == TouchType::PULL_IN_WINDOW ||
298 typeIter->second == TouchType::PULL_OUT_WINDOW) {
299 event.pullType = typeIter->second;
300 }
301 }
302
GetMouseEventAction(int32_t action,MouseEvent & events,bool isScenceBoardWindow)303 void GetMouseEventAction(int32_t action, MouseEvent& events, bool isScenceBoardWindow)
304 {
305 switch (action) {
306 case OHOS::MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN:
307 events.action = MouseAction::PRESS;
308 break;
309 case OHOS::MMI::PointerEvent::POINTER_ACTION_BUTTON_UP:
310 events.action = MouseAction::RELEASE;
311 break;
312 case OHOS::MMI::PointerEvent::POINTER_ACTION_ENTER_WINDOW:
313 events.action = MouseAction::WINDOW_ENTER;
314 break;
315 case OHOS::MMI::PointerEvent::POINTER_ACTION_LEAVE_WINDOW:
316 events.action = MouseAction::WINDOW_LEAVE;
317 break;
318 case OHOS::MMI::PointerEvent::POINTER_ACTION_MOVE:
319 events.action = MouseAction::MOVE;
320 break;
321 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_DOWN:
322 events.action = MouseAction::PRESS;
323 events.pullAction = MouseAction::PULL_DOWN;
324 break;
325 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_MOVE:
326 events.action = MouseAction::MOVE;
327 events.pullAction = MouseAction::PULL_MOVE;
328 break;
329 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_IN_WINDOW:
330 events.action = MouseAction::WINDOW_ENTER;
331 events.pullAction = MouseAction::PULL_MOVE;
332 return;
333 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW:
334 events.action = MouseAction::WINDOW_LEAVE;
335 events.pullAction = MouseAction::PULL_MOVE;
336 return;
337 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_UP:
338 events.action = MouseAction::RELEASE;
339 events.pullAction = MouseAction::PULL_UP;
340 break;
341 case OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL:
342 events.action = MouseAction::CANCEL;
343 break;
344 default:
345 events.action = MouseAction::NONE;
346 break;
347 }
348 }
349
GetMouseEventButton(int32_t button)350 MouseButton GetMouseEventButton(int32_t button)
351 {
352 switch (button) {
353 case OHOS::MMI::PointerEvent::MOUSE_BUTTON_LEFT:
354 return MouseButton::LEFT_BUTTON;
355 case OHOS::MMI::PointerEvent::MOUSE_BUTTON_RIGHT:
356 return MouseButton::RIGHT_BUTTON;
357 case OHOS::MMI::PointerEvent::MOUSE_BUTTON_MIDDLE:
358 return MouseButton::MIDDLE_BUTTON;
359 case OHOS::MMI::PointerEvent::MOUSE_BUTTON_FORWARD:
360 return MouseButton::FORWARD_BUTTON;
361 case OHOS::MMI::PointerEvent::MOUSE_BUTTON_BACK:
362 return MouseButton::BACK_BUTTON;
363 default:
364 return MouseButton::NONE_BUTTON;
365 }
366 }
367
ConvertMouseEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,MouseEvent & events,bool isScenceBoardWindow)368 void ConvertMouseEvent(
369 const std::shared_ptr<MMI::PointerEvent>& pointerEvent, MouseEvent& events, bool isScenceBoardWindow)
370 {
371 int32_t pointerID = pointerEvent->GetPointerId();
372 MMI::PointerEvent::PointerItem item;
373 bool ret = pointerEvent->GetPointerItem(pointerID, item);
374 if (!ret) {
375 LOGE("get pointer: %{public}d item failed.", pointerID);
376 return;
377 }
378 events.id = pointerID;
379 events.x = item.GetWindowX();
380 events.y = item.GetWindowY();
381 events.screenX = item.GetDisplayX();
382 events.screenY = item.GetDisplayY();
383 events.rawDeltaX = item.GetRawDx();
384 events.rawDeltaY = item.GetRawDy();
385 GetMouseEventAction(pointerEvent->GetPointerAction(), events, isScenceBoardWindow);
386 events.button = GetMouseEventButton(pointerEvent->GetButtonId());
387 GetEventDevice(pointerEvent->GetSourceType(), events);
388 events.isPrivacyMode = pointerEvent->HasFlag(OHOS::MMI::InputEvent::EVENT_FLAG_PRIVACY_MODE);
389 events.targetDisplayId = pointerEvent->GetTargetDisplayId();
390 events.originalId = item.GetOriginPointerId();
391 events.deviceId = pointerEvent->GetDeviceId();
392
393 std::set<int32_t> pressedSet = pointerEvent->GetPressedButtons();
394 uint32_t pressedButtons = 0;
395 if (pressedSet.find(OHOS::MMI::PointerEvent::MOUSE_BUTTON_LEFT) != pressedSet.end()) {
396 pressedButtons &= static_cast<uint32_t>(MouseButton::LEFT_BUTTON);
397 }
398 if (pressedSet.find(OHOS::MMI::PointerEvent::MOUSE_BUTTON_RIGHT) != pressedSet.end()) {
399 pressedButtons &= static_cast<uint32_t>(MouseButton::RIGHT_BUTTON);
400 }
401 if (pressedSet.find(OHOS::MMI::PointerEvent::MOUSE_BUTTON_MIDDLE) != pressedSet.end()) {
402 pressedButtons &= static_cast<uint32_t>(MouseButton::MIDDLE_BUTTON);
403 }
404 events.pressedButtons = static_cast<int32_t>(pressedButtons);
405
406 for (const auto& pressedButton : pressedSet) {
407 auto convertedButton = GetMouseEventButton(pressedButton);
408 if (convertedButton != MouseButton::NONE_BUTTON) {
409 events.pressedButtonsArray.emplace_back(convertedButton);
410 }
411 }
412 events.time = TimeStamp(std::chrono::microseconds(pointerEvent->GetActionTime()));
413 events.pointerEvent = pointerEvent;
414 events.sourceTool = GetSourceTool(item.GetToolType());
415 UpdateMouseEventForPen(item, events);
416 events.touchEventId = pointerEvent->GetId();
417 events.pressedKeyCodes_.clear();
418 for (const auto& curCode : pointerEvent->GetPressedKeys()) {
419 events.pressedKeyCodes_.emplace_back(static_cast<KeyCode>(curCode));
420 }
421 }
422
GetAxisEventAction(int32_t action,AxisEvent & event)423 void GetAxisEventAction(int32_t action, AxisEvent& event)
424 {
425 switch (action) {
426 case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_BEGIN:
427 case OHOS::MMI::PointerEvent::POINTER_ACTION_ROTATE_BEGIN:
428 event.action = AxisAction::BEGIN;
429 break;
430 case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_UPDATE:
431 case OHOS::MMI::PointerEvent::POINTER_ACTION_ROTATE_UPDATE:
432 event.action = AxisAction::UPDATE;
433 break;
434 case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_END:
435 case OHOS::MMI::PointerEvent::POINTER_ACTION_ROTATE_END:
436 event.action = AxisAction::END;
437 break;
438 case OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL:
439 event.action = AxisAction::CANCEL;
440 break;
441 default:
442 event.action = AxisAction::NONE;
443 break;
444 }
445 }
446
GetNonPointerAxisEventAction(int32_t action,NG::FocusAxisEvent & event)447 void GetNonPointerAxisEventAction(int32_t action, NG::FocusAxisEvent& event)
448 {
449 switch (action) {
450 case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_BEGIN:
451 event.action = AxisAction::BEGIN;
452 break;
453 case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_UPDATE:
454 event.action = AxisAction::UPDATE;
455 break;
456 case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_END:
457 event.action = AxisAction::END;
458 break;
459 case OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL:
460 event.action = AxisAction::CANCEL;
461 break;
462 default:
463 event.action = AxisAction::NONE;
464 break;
465 }
466 }
467
ConvertCrownEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,CrownEvent & event)468 void ConvertCrownEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, CrownEvent& event)
469 {
470 event.touchEventId = pointerEvent->GetId();
471 int32_t pointerAction = pointerEvent->GetPointerAction();
472 if (pointerAction == MMI::PointerEvent::POINTER_ACTION_AXIS_BEGIN) {
473 event.action = Ace::CrownAction::BEGIN;
474 } else if (pointerAction == MMI::PointerEvent::POINTER_ACTION_AXIS_UPDATE) {
475 event.action = Ace::CrownAction::UPDATE;
476 } else if (pointerAction == MMI::PointerEvent::POINTER_ACTION_AXIS_END) {
477 event.action = Ace::CrownAction::END;
478 } else {
479 event.action = Ace::CrownAction::UNKNOWN;
480 }
481 int32_t orgDevice = pointerEvent->GetSourceType();
482 GetEventDevice(orgDevice, event);
483 event.angularVelocity = pointerEvent->GetVelocity();
484 event.degree = pointerEvent->GetAxisValue(MMI::PointerEvent::AXIS_TYPE_SCROLL_VERTICAL);
485 std::chrono::microseconds microseconds(pointerEvent->GetActionTime());
486 TimeStamp time(microseconds);
487 event.timeStamp = time;
488 event.SetPointerEvent(pointerEvent);
489 }
490
ConvertAxisEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,AxisEvent & event)491 void ConvertAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, AxisEvent& event)
492 {
493 int32_t pointerID = pointerEvent->GetPointerId();
494 MMI::PointerEvent::PointerItem item;
495 bool ret = pointerEvent->GetPointerItem(pointerID, item);
496 if (!ret) {
497 LOGE("get pointer: %{public}d item failed.", pointerID);
498 return;
499 }
500
501 event.id = item.GetPointerId();
502 event.x = static_cast<float>(item.GetWindowX());
503 event.y = static_cast<float>(item.GetWindowY());
504 event.screenX = static_cast<float>(item.GetDisplayX());
505 event.screenY = static_cast<float>(item.GetDisplayY());
506 event.horizontalAxis = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_SCROLL_HORIZONTAL);
507 event.verticalAxis = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL);
508 event.pinchAxisScale = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_PINCH);
509 event.rotateAxisAngle = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ROTATE);
510 int32_t orgAction = pointerEvent->GetPointerAction();
511 GetAxisEventAction(orgAction, event);
512 event.isRotationEvent = (orgAction >= MMI::PointerEvent::POINTER_ACTION_ROTATE_BEGIN) &&
513 (orgAction <= MMI::PointerEvent::POINTER_ACTION_ROTATE_END);
514 event.scrollStep = pointerEvent->GetScrollRows();
515 int32_t orgDevice = pointerEvent->GetSourceType();
516 GetEventDevice(orgDevice, event);
517 event.sourceTool = GetSourceTool(item.GetToolType());
518 event.pointerEvent = pointerEvent;
519 event.originalId = item.GetOriginPointerId();
520 event.deviceId = pointerEvent->GetDeviceId();
521
522 std::chrono::microseconds microseconds(pointerEvent->GetActionTime());
523 TimeStamp time(microseconds);
524 event.time = time;
525 event.touchEventId = pointerEvent->GetId();
526 event.targetDisplayId = pointerEvent->GetTargetDisplayId();
527 event.pressedCodes.clear();
528 for (const auto& curCode : pointerEvent->GetPressedKeys()) {
529 event.pressedCodes.emplace_back(static_cast<KeyCode>(curCode));
530 }
531 }
532
ConvertKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent,KeyEvent & event)533 void ConvertKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, KeyEvent& event)
534 {
535 CHECK_NULL_VOID(keyEvent);
536 event.rawKeyEvent = keyEvent;
537 event.code = static_cast<KeyCode>(keyEvent->GetKeyCode());
538 event.numLock = keyEvent->GetFunctionKey(MMI::KeyEvent::NUM_LOCK_FUNCTION_KEY);
539 event.keyIntention = static_cast<KeyIntention>(keyEvent->GetKeyIntention());
540 if (keyEvent->GetKeyAction() == OHOS::MMI::KeyEvent::KEY_ACTION_UP) {
541 event.action = KeyAction::UP;
542 } else if (keyEvent->GetKeyAction() == OHOS::MMI::KeyEvent::KEY_ACTION_DOWN) {
543 event.action = KeyAction::DOWN;
544 } else {
545 event.action = KeyAction::UNKNOWN;
546 }
547 auto keyItems = keyEvent->GetKeyItems();
548 for (auto item = keyItems.rbegin(); item != keyItems.rend(); item++) {
549 if (item->GetKeyCode() == keyEvent->GetKeyCode()) {
550 event.unicode = item->GetUnicode();
551 break;
552 } else {
553 event.unicode = 0;
554 }
555 }
556
557 std::chrono::microseconds microseconds(keyEvent->GetActionTime());
558 TimeStamp time(microseconds);
559 event.timeStamp = time;
560 event.key.assign(MMI::KeyEvent::KeyCodeToString(keyEvent->GetKeyCode()));
561 event.deviceId = keyEvent->GetDeviceId();
562 int32_t orgDevice = keyEvent->GetSourceType();
563 event.sourceType =
564 orgDevice == MMI::PointerEvent::SOURCE_TYPE_JOYSTICK ? SourceType::JOYSTICK : SourceType::KEYBOARD;
565 #ifdef SECURITY_COMPONENT_ENABLE
566 event.enhanceData = keyEvent->GetEnhanceData();
567 #endif
568 event.pressedCodes.clear();
569 for (const auto& curCode : keyEvent->GetPressedKeys()) {
570 event.pressedCodes.emplace_back(static_cast<KeyCode>(curCode));
571 }
572 event.enableCapsLock = keyEvent->GetFunctionKey(MMI::KeyEvent::CAPS_LOCK_FUNCTION_KEY);
573 event.numLock = keyEvent->GetFunctionKey(MMI::KeyEvent::NUM_LOCK_FUNCTION_KEY);
574 }
575
ConvertFocusAxisEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,NG::FocusAxisEvent & event)576 void ConvertFocusAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, NG::FocusAxisEvent& event)
577 {
578 int32_t pointerID = pointerEvent->GetPointerId();
579 MMI::PointerEvent::PointerItem item;
580 bool ret = pointerEvent->GetPointerItem(pointerID, item);
581 if (!ret) {
582 LOGE("get pointer: %{public}d item failed.", pointerID);
583 return;
584 }
585
586 event.id = item.GetPointerId();
587 event.absXValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_X);
588 event.absYValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_Y);
589 event.absZValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_Z);
590 event.absRzValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_RZ);
591 event.absHat0XValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_HAT0X);
592 event.absHat0YValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_HAT0Y);
593 event.absBrakeValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_BRAKE);
594 event.absGasValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_GAS);
595 int32_t orgAction = pointerEvent->GetPointerAction();
596 GetNonPointerAxisEventAction(orgAction, event);
597 int32_t orgDevice = pointerEvent->GetSourceType();
598 GetEventDevice(orgDevice, event);
599 event.sourceTool = SourceTool::JOYSTICK;
600 event.pointerEvent = pointerEvent;
601 event.originalId = item.GetOriginPointerId();
602 event.deviceId = pointerEvent->GetDeviceId();
603
604 std::chrono::microseconds microseconds(pointerEvent->GetActionTime());
605 TimeStamp time(microseconds);
606 event.time = time;
607 event.touchEventId = pointerEvent->GetId();
608 event.targetDisplayId = pointerEvent->GetTargetDisplayId();
609 event.pressedCodes.clear();
610 for (const auto& curCode : pointerEvent->GetPressedKeys()) {
611 event.pressedCodes.emplace_back(static_cast<KeyCode>(curCode));
612 }
613 }
614
GetPointerEventAction(int32_t action,DragPointerEvent & event)615 void GetPointerEventAction(int32_t action, DragPointerEvent& event)
616 {
617 switch (action) {
618 case OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL:
619 event.action = PointerAction::CANCEL;
620 break;
621 case OHOS::MMI::PointerEvent::POINTER_ACTION_DOWN:
622 event.action = PointerAction::DOWN;
623 break;
624 case OHOS::MMI::PointerEvent::POINTER_ACTION_MOVE:
625 event.action = PointerAction::MOVE;
626 break;
627 case OHOS::MMI::PointerEvent::POINTER_ACTION_UP:
628 event.action = PointerAction::UP;
629 break;
630 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_MOVE:
631 event.action = PointerAction::PULL_MOVE;
632 break;
633 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_UP:
634 event.action = PointerAction::PULL_UP;
635 break;
636 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_IN_WINDOW:
637 event.action = PointerAction::PULL_IN_WINDOW;
638 break;
639 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW:
640 event.action = PointerAction::PULL_OUT_WINDOW;
641 break;
642 case OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_CANCEL:
643 event.action = PointerAction::PULL_CANCEL;
644 break;
645 default:
646 event.action = PointerAction::UNKNOWN;
647 break;
648 }
649 }
650
651 /**
652 * Only for UIExtension to convert drag event type and dispatch.
653 */
UpdatePointerAction(std::shared_ptr<MMI::PointerEvent> & pointerEvent,const PointerAction action)654 void UpdatePointerAction(std::shared_ptr<MMI::PointerEvent>& pointerEvent, const PointerAction action)
655 {
656 if (action == PointerAction::PULL_IN_WINDOW) {
657 pointerEvent->SetPointerAction(OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_IN_WINDOW);
658 }
659 if (action == PointerAction::PULL_OUT_WINDOW) {
660 pointerEvent->SetPointerAction(OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_OUT_WINDOW);
661 }
662 if (action == PointerAction::UP) {
663 pointerEvent->SetPointerAction(OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_UP);
664 }
665 if (action == PointerAction::PULL_CANCEL) {
666 pointerEvent->SetPointerAction(OHOS::MMI::PointerEvent::POINTER_ACTION_PULL_CANCEL);
667 }
668 }
669
GetPointerEventToolType(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,int32_t & toolType)670 bool GetPointerEventToolType(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, int32_t& toolType)
671 {
672 int32_t pointerID = pointerEvent->GetPointerId();
673 MMI::PointerEvent::PointerItem item;
674 bool ret = pointerEvent->GetPointerItem(pointerID, item);
675 if (!ret) {
676 TAG_LOGE(AceLogTag::ACE_INPUTTRACKING, "get pointer: %{public}d item failed.", pointerID);
677 return false;
678 }
679 toolType = item.GetToolType();
680 return true;
681 }
682
ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,DragPointerEvent & event)683 void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, DragPointerEvent& event)
684 {
685 event.rawPointerEvent = pointerEvent;
686 event.pointerEventId = pointerEvent->GetId();
687 event.pointerId = pointerEvent->GetPointerId();
688 event.pullId = pointerEvent->GetPullId();
689 MMI::PointerEvent::PointerItem pointerItem;
690 pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem);
691 event.pressed = pointerItem.IsPressed();
692 event.windowX = pointerItem.GetWindowX();
693 event.windowY = pointerItem.GetWindowY();
694 event.displayX = pointerItem.GetDisplayX();
695 event.displayY = pointerItem.GetDisplayY();
696 event.size = std::max(pointerItem.GetWidth(), pointerItem.GetHeight()) / SIZE_DIVIDE;
697 event.force = static_cast<float>(pointerItem.GetPressure());
698 event.deviceId = pointerItem.GetDeviceId();
699 event.downTime = TimeStamp(std::chrono::microseconds(pointerItem.GetDownTime()));
700 event.time = TimeStamp(std::chrono::microseconds(pointerEvent->GetActionTime()));
701 event.sourceTool = GetSourceTool(pointerItem.GetToolType());
702 event.targetWindowId = pointerItem.GetTargetWindowId();
703 event.x = event.windowX;
704 event.y = event.windowY;
705 event.pressedKeyCodes.clear();
706 for (const auto& curCode : pointerEvent->GetPressedKeys()) {
707 event.pressedKeyCodes.emplace_back(static_cast<KeyCode>(curCode));
708 }
709 int32_t orgAction = pointerEvent->GetPointerAction();
710 GetPointerEventAction(orgAction, event);
711 }
712
LogPointInfo(const std::shared_ptr<MMI::PointerEvent> & pointerEvent,int32_t instanceId)713 void LogPointInfo(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, int32_t instanceId)
714 {
715 if (pointerEvent->GetSourceType() != OHOS::MMI::PointerEvent::SOURCE_TYPE_MOUSE &&
716 (pointerEvent->GetPointerAction() == OHOS::MMI::PointerEvent::POINTER_ACTION_ENTER_WINDOW ||
717 pointerEvent->GetPointerAction() == OHOS::MMI::PointerEvent::POINTER_ACTION_LEAVE_WINDOW)) {
718 TAG_LOGI(AceLogTag::ACE_INPUTTRACKING, "SourceType:%{public}d error, PointerAction:%{public}d "
719 "instanceId:%{public}d",
720 pointerEvent->GetSourceType(), pointerEvent->GetPointerAction(), instanceId);
721 }
722
723 if (pointerEvent->GetPointerAction() == OHOS::MMI::PointerEvent::POINTER_ACTION_DOWN) {
724 auto container = Platform::AceContainer::GetContainer(instanceId);
725 if (container) {
726 auto pipelineContext = container->GetPipelineContext();
727 if (pipelineContext) {
728 uint32_t windowId = pipelineContext->GetWindowId();
729 TAG_LOGI(AceLogTag::ACE_INPUTTRACKING, "pointdown windowId: %{public}u", windowId);
730 }
731 }
732 }
733 if (SystemProperties::GetDebugEnabled()) {
734 TAG_LOGD(AceLogTag::ACE_DRAG, "point source: %{public}d", pointerEvent->GetSourceType());
735 auto actionId = pointerEvent->GetPointerId();
736 MMI::PointerEvent::PointerItem item;
737 if (pointerEvent->GetPointerItem(actionId, item)) {
738 TAG_LOGD(AceLogTag::ACE_DRAG,
739 "action point info: id: %{public}d, pointerId: %{public}d, action: "
740 "%{public}d, pressure: %{public}f, tiltX: %{public}f, tiltY: %{public}f",
741 pointerEvent->GetId(), actionId, pointerEvent->GetPointerAction(),
742 item.GetPressure(), item.GetTiltX(), item.GetTiltY());
743 }
744 auto ids = pointerEvent->GetPointerIds();
745 for (auto&& id : ids) {
746 MMI::PointerEvent::PointerItem item;
747 if (pointerEvent->GetPointerItem(id, item)) {
748 TAG_LOGD(AceLogTag::ACE_UIEVENT,
749 "all point info: id: %{public}d, x: %{public}d, y: %{public}d, isPressed: %{public}d, pressure: "
750 "%{public}f, tiltX: %{public}f, tiltY: %{public}f",
751 actionId, item.GetWindowX(), item.GetWindowY(), item.IsPressed(), item.GetPressure(),
752 item.GetTiltX(), item.GetTiltY());
753 }
754 }
755 }
756 }
757
CalculatePointerEvent(const std::shared_ptr<MMI::PointerEvent> & point,const RefPtr<NG::FrameNode> & frameNode,bool useRealtimeMatrix)758 void CalculatePointerEvent(const std::shared_ptr<MMI::PointerEvent>& point, const RefPtr<NG::FrameNode>& frameNode,
759 bool useRealtimeMatrix)
760 {
761 CHECK_NULL_VOID(point);
762 int32_t pointerId = point->GetPointerId();
763 MMI::PointerEvent::PointerItem item;
764 bool ret = point->GetPointerItem(pointerId, item);
765 if (ret) {
766 float xRelative = item.GetWindowX();
767 float yRelative = item.GetWindowY();
768 if (point->GetSourceType() == OHOS::MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN &&
769 item.GetToolType() == OHOS::MMI::PointerEvent::TOOL_TYPE_PEN) {
770 xRelative = item.GetWindowXPos();
771 yRelative = item.GetWindowYPos();
772 }
773 NG::PointF transformPoint(xRelative, yRelative);
774 NG::NGGestureRecognizer::Transform(transformPoint, frameNode, useRealtimeMatrix);
775 item.SetWindowX(static_cast<int32_t>(transformPoint.GetX()));
776 item.SetWindowY(static_cast<int32_t>(transformPoint.GetY()));
777 item.SetWindowXPos(transformPoint.GetX());
778 item.SetWindowYPos(transformPoint.GetY());
779 point->UpdatePointerItem(pointerId, item);
780 }
781 }
782
CalculatePointerEvent(const NG::OffsetF & offsetF,const std::shared_ptr<MMI::PointerEvent> & point,const NG::VectorF & scale,int32_t udegree)783 void CalculatePointerEvent(const NG::OffsetF& offsetF, const std::shared_ptr<MMI::PointerEvent>& point,
784 const NG::VectorF& scale, int32_t udegree)
785 {
786 CHECK_NULL_VOID(point);
787 int32_t pointerId = point->GetPointerId();
788 MMI::PointerEvent::PointerItem item;
789 bool ret = point->GetPointerItem(pointerId, item);
790 if (ret) {
791 float xRelative = item.GetWindowX();
792 float yRelative = item.GetWindowY();
793 if (point->GetSourceType() == OHOS::MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN &&
794 item.GetToolType() == OHOS::MMI::PointerEvent::TOOL_TYPE_PEN) {
795 xRelative = item.GetWindowXPos();
796 yRelative = item.GetWindowYPos();
797 }
798 auto windowX = xRelative;
799 auto windowY = yRelative;
800 auto pipelineContext = PipelineBase::GetCurrentContextSafelyWithCheck();
801 CHECK_NULL_VOID(pipelineContext);
802 auto displayWindowRect = pipelineContext->GetDisplayWindowRectInfo();
803 auto windowWidth = displayWindowRect.Width();
804 auto windowHeight = displayWindowRect.Height();
805 switch (udegree) {
806 case ANGLE_0:
807 windowX = xRelative - offsetF.GetX();
808 windowY = yRelative - offsetF.GetY();
809 break;
810 case ANGLE_90:
811 windowX = yRelative - offsetF.GetX();
812 windowY = windowWidth - offsetF.GetY() - xRelative;
813 break;
814 case ANGLE_180:
815 windowX = windowWidth - offsetF.GetX() - xRelative;
816 windowY = windowHeight - offsetF.GetY() - yRelative;
817 break;
818 case ANGLE_270:
819 windowX = windowHeight - offsetF.GetX() - yRelative;
820 windowY = xRelative - offsetF.GetY();
821 break;
822 default:
823 break;
824 }
825 windowX = NearZero(scale.x) ? windowX : windowX / scale.x;
826 windowY = NearZero(scale.y) ? windowY : windowY / scale.y;
827
828 item.SetWindowX(static_cast<int32_t>(windowX));
829 item.SetWindowY(static_cast<int32_t>(windowY));
830 item.SetWindowXPos(windowX);
831 item.SetWindowYPos(windowY);
832 point->UpdatePointerItem(pointerId, item);
833 }
834 }
835
CalculateWindowCoordinate(const NG::OffsetF & offsetF,const std::shared_ptr<MMI::PointerEvent> & point,const NG::VectorF & scale,const int32_t udegree)836 void CalculateWindowCoordinate(const NG::OffsetF& offsetF, const std::shared_ptr<MMI::PointerEvent>& point,
837 const NG::VectorF& scale, const int32_t udegree)
838 {
839 CHECK_NULL_VOID(point);
840 auto ids = point->GetPointerIds();
841 for (auto&& id : ids) {
842 MMI::PointerEvent::PointerItem item;
843 bool ret = point->GetPointerItem(id, item);
844 if (!ret) {
845 LOGE("get pointer:%{public}d item failed", id);
846 continue;
847 }
848 float xRelative = item.GetDisplayX();
849 float yRelative = item.GetDisplayY();
850 if (point->GetSourceType() == OHOS::MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN &&
851 item.GetToolType() == OHOS::MMI::PointerEvent::TOOL_TYPE_PEN) {
852 xRelative = item.GetDisplayXPos();
853 yRelative = item.GetDisplayYPos();
854 }
855 float windowX = xRelative;
856 float windowY = yRelative;
857 int32_t deviceWidth = SystemProperties::GetDevicePhysicalWidth();
858 int32_t deviceHeight = SystemProperties::GetDevicePhysicalHeight();
859
860 if (udegree == ANGLE_0) {
861 windowX = xRelative - offsetF.GetX();
862 windowY = yRelative - offsetF.GetY();
863 }
864 if (udegree == ANGLE_90) {
865 windowX = yRelative - offsetF.GetX();
866 windowY = deviceWidth - offsetF.GetY() - xRelative;
867 }
868 if (udegree == ANGLE_180) {
869 windowX = deviceWidth - offsetF.GetX() - xRelative;
870 windowY = deviceHeight - offsetF.GetY() - yRelative;
871 }
872 if (udegree == ANGLE_270) {
873 windowX = deviceHeight - offsetF.GetX() - yRelative;
874 windowY = xRelative - offsetF.GetY();
875 }
876
877 windowX = NearZero(scale.x) ? windowX : windowX / scale.x;
878 windowY = NearZero(scale.y) ? windowY : windowY / scale.y;
879
880 item.SetWindowX(static_cast<int32_t>(windowX));
881 item.SetWindowY(static_cast<int32_t>(windowY));
882 item.SetWindowXPos(windowX);
883 item.SetWindowYPos(windowY);
884 point->UpdatePointerItem(id, item);
885 }
886 }
887 } // namespace OHOS::Ace::Platform
888