当前位置:网站首页>Detailed explanation of multi-mode input event distribution mechanism
Detailed explanation of multi-mode input event distribution mechanism
2022-07-04 21:06:00 【InfoQ】
One 、 Overview of multimode input
Two 、 Input event and device status data flow introduction

- The input event distribution process will first pass through the input event interception module , When an interceptor is registered , Entering the event will terminate and continue to report , The corresponding interceptor will intercept all input events . This event interception feature currently mainly supports barrier free mode .
- When there is no interceptor registration , The input event will be reported to the input event listening module , System level applications ( Such as : System settings 、 desktop ) By listening to input events , Support system level features ( Such as : The status bar is hidden / Disappear, etc ).
- The event monitoring module will not prevent the event from continuing to report ; Support event monitoring at the same time , Input events will continue to be reported .
- Key events will be reported to the subscription key distribution module for processing , Distribute to the corresponding application for processing , The event distribution process ends .
- Other touch screen events and mouse events will not go through the subscription key distribution module , It will continue to be reported to the application window for processing .
3、 ... and 、 Multimode input event distribution principle
- If there is no button on the mouse to press , Which target is the current mouse pointing to , Mouse input events are distributed to coordinate locked targets .
- If a button on the mouse is pressed , Take the target locked by the mouse coordinate when the first button is pressed as the distribution target , Until all the buttons are lifted .
- Touch screen input , Press the locked target with the first finger as the input event distribution target , Until all fingers are raised .
Four 、OpenHarmony 3.1 Interface description added in version


- Import module first
// Input method in the soft keyboard display logic by subscribing to the status of the physical keyboard : Insert / Pull out
// according to isPhysicalkeyboardExist The value of determines whether the soft keyboard pops up
...
let isPhysicalkeyboardExist = false;
inputDevice.on("change", (callback) => {
console.log("type: " + callback.type + ", deviceId: " + callback.deviceId);
inputDevice.getDevice(callback.deviceId, (ret) => {
console.log("The keyboard type of the device is: " + ret);
if (ret == keyboard.ALPHABETIC_KEYBOARD && callback.type == 'add') { // The hot plug device is keyboard
isPhysicalkeyboardExist = true;
} else if (ret == keyboard.ALPHABETIC_KEYBOARD && callback.type == 'remove') {
isPhysicalkeyboardExist = false;
}
});
});
...
listener: function(data) {
console.log("type: " + data.type + ", deviceId: " + data.deviceId);
}
// Cancel alone listener Listening in .
inputDevice.off("change", this.listener);
// Cancel all listening
inputDevice.off("change");// After canceling listening , The soft keyboard pops up by default

边栏推荐
- Automatic generation of interface automatic test cases by actual operation
- 接口設計時的一些建議
- Play the music of youth
- PermissionError: [Errno 13] Permission denied: ‘data.csv‘
- 记一次重复造轮子(Obsidian 插件设置说明汉化)
- 记录线上bug解决list(未完待续7/4)
- 接口设计时的一些建议
- Hands on deep learning (III) -- convolutional neural network CNN
- Fleet tutorial 08 introduction to AppBar toolbar Basics (tutorial includes source code)
- [1200. Différence absolue minimale]
猜你喜欢

剑指 Offer II 80-100(持续更新)

Qt五子棋人机对战画棋子之QPainter的使用误区总结

What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened

Common verification rules of form components -1 (continuously updating ~)

接口设计时的一些建议

Sword finger offer II 80-100 (continuous update)

JS卡牌样式倒计时天数

Ten years' experience of byte test engineer directly hits the pain point of UI automation test

福昕PDF编辑器v10.1.8绿色版

Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"
随机推荐
hash 表的概念及应用
Foxit pdf editor v10.1.8 green version
idea插件
【1200. 最小绝对差】
tcp为啥是三次握手和四次挥手
mysql语句执行详解
Go notes (1) go language introduction and characteristics
伦敦银走势图分析的新方法
What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened
Advantages of semantic tags and block level inline elements
Vue cleans up the keepalive cache scheme in a timely manner
Managed service network: application architecture evolution in the cloud native Era
Remember to build wheels repeatedly at one time (the setting instructions of obsidian plug-in are translated into Chinese)
【1200. 最小絕對差】
In the face of the same complex test task, why can the elder sort out the solution quickly? Ali's ten-year test engineers showed their skills
网络命名空间
LeetCode 8. String conversion integer (ATOI)
Go notes (3) usage of go language FMT package
嵌入式TC 测试用例
BFC面试简述