当前位置:网站首页>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

边栏推荐
- 托管式服务网络:云原生时代的应用体系架构进化
- 接口设计时的一些建议
- 奏响青春的乐章
- Common verification rules of form components -1 (continuously updating ~)
- Leetcode+ 81 - 85 monotone stack topic
- 科普达人丨一文看懂阿里云的秘密武器“神龙架构”
- Go notes (3) usage of go language FMT package
- [server data recovery] a case of RAID5 data recovery stored in a brand of server
- Automatic generation of interface automatic test cases by actual operation
- 记一次重复造轮子(Obsidian 插件设置说明汉化)
猜你喜欢
What are the functional modules of RFID warehouse management system solution
RFID仓储管理系统解决方案的优点
PS vertical English and digital text how to change direction (vertical display)
idea恢复默认快捷键
黄金k线图中的三角形有几种?
colResizable.js自动调整表格宽度插件
Jmeter 之压测入门
What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened
Some suggestions for interface design
网件r7000梅林系统5g不稳定 5g信号经常掉线解决方法
随机推荐
Android原生数据库的基本使用和升级
js 3D爆炸碎片图片切换js特效
go defer的使用说明
LeetCode 8. String conversion integer (ATOI)
卷积神经网络在深度学习中新发展的5篇论文推荐
Redis分布式锁的实现
【解决方案】PaddlePaddle 2.x调用静态图模式
Common verification rules of form components -1 (continuously updating ~)
The concept and application of hash table
PS vertical English and digital text how to change direction (vertical display)
Automatic generation of interface automatic test cases by actual operation
LeetCode 871. Minimum refueling times
jekins初始化密码没有或找不到
阿里测试师用UI自动化测试实现元素定位
[observation] Lenovo: 3x (1+n) smart office solution, releasing the "multiplier effect" of office productivity
Alibaba testers use UI automated testing to achieve element positioning
【观察】联想:3X(1+N)智慧办公解决方案,释放办公生产力“乘数效应”
记录线上bug解决list(未完待续7/4)
[server data recovery] a case of RAID5 data recovery stored in a brand of server
E-week finance | Q1 the number of active people in the insurance industry was 86.8867 million, and the licenses of 19 Payment institutions were cancelled