swift - Ordering of events from addGlobalMonitorForEvents
问题描述
I am trying to monitor mouse click events like so:
clickMonitor = NSEvent.addGlobalMonitorForEvents(
matching: [.leftMouseDown, .rightMouseDown, .leftMouseUp, .rightMouseUp]) {
[unowned self] event in
...
However, it appears that my events are coming in out of order. For instance, often for a double-click, I get two .leftMouseDown
events (with counts 1 and 2) before I get either .leftMouseUp
event.
Are there any guarantees to ensure the ordering that these events will come in? If not, is there any mechanism for ordering them?
解决方案
推荐阅读
- python - 为什么 pygame.surface.get_view() 只有在表面旋转时才会失败?
- mongodb - MongoDB - 随机和独特的结果
- python - 在没有替换功能的情况下替换python中的字符
- windows - 如何在一个或多个热键中使用变量?
- javascript - 通过触摸实现 Drag n' Drop 的 sortableJS 移动实现
- coq - 如何在部分隐式中设置所有出现的变量
- sql - SET IDENTITY_INSERT 给出错误 - 表的 IDENTITY_INSERT 已经为 ON
- vb.net - vb.net 从网络浏览器获取链接(不是图片链接)
- flutter - 画倒三角形
- java - 使用自定义函数的 Java binarySearch