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

边栏推荐
- 哈希表、哈希函数、布隆过滤器、一致性哈希
- js 闭包
- Record the online bug solving list (unfinished to be continued 7/4)
- colResizable.js自动调整表格宽度插件
- Pytorch---使用Pytorch实现LinkNet进行语义分割
- vim异步问题
- 《动手学深度学习》(三) -- 卷积神经网络 CNN
- LeetCode+ 81 - 85 单调栈专题
- Explication détaillée du mécanisme de distribution des événements d'entrée multimodes
- Automatic insertion of captions in word
猜你喜欢

Quelques suggestions pour la conception de l'interface
![[observation] Lenovo: 3x (1+n) smart office solution, releasing the](/img/e4/f660461c42eb81ab8c94fd87503a83.png)
[observation] Lenovo: 3x (1+n) smart office solution, releasing the "multiplier effect" of office productivity

五子棋 上班摸鱼工具 可局域网/人机

NetWare r7000 Merlin system virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements. Solution, is it necessary to create virtual memory??

Pytorch---使用Pytorch实现LinkNet进行语义分割

D3.js+Three.js数据可视化3d地球js特效

Advantages of RFID warehouse management system solution
![[1200. Minimum absolute difference]](/img/fa/4ffbedd8f24c75a20d3eaeaf0430ae.png)
[1200. Minimum absolute difference]

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

shp数据制作3DTiles白膜
随机推荐
MySQL statement execution details
分析伦敦银走势图的技巧
多模输入事件分发机制详解
字节测试工程师十年经验直击UI 自动化测试痛点
js 闭包
heatmap.js图片热点热力图插件
idea恢复默认快捷键
[1200. Différence absolue minimale]
Leetcode+ 81 - 85 monotone stack topic
How does wincc7.5 SP1 find variables and their positions through cross indexing?
VIM asynchronous problem
Record the online bug solving list (unfinished to be continued 7/4)
[solution] paddlepaddle 2 X call static graph mode
Qt五子棋人机对战画棋子之QPainter的使用误区总结
Remember to build wheels repeatedly at one time (the setting instructions of obsidian plug-in are translated into Chinese)
LeetCode 871. Minimum refueling times
仿ps样式js网页涂鸦板插件
Flet tutorial 06 basic introduction to textbutton (tutorial includes source code)
Why is TCP three handshakes and four waves
GVM使用