检测用户是否按下 Wacom 数位板上的按钮

发布于 2024-09-17 06:51:08 字数 99 浏览 6 评论 0原文

我想知道 Cocoa/Carbon 是否可以检测组合键(例如 Ctrl + Z)是否来自 Wacom 按钮或键盘本身。

谢谢 最好的 克索尼克

I was wondering if it is possible in Cocoa/Carbon to detect whether a key combination (e. g. Ctrl + Z) comes from a Wacom button or the keyboard itself.

Thanks
best
xonic

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倾`听者〃 2024-09-24 06:51:08

我只能假设 Wacom 平板电脑的驱动程序正在伪造绑定到特定按钮的键盘事件。如果是这种情况,我认为您无法区分它们,因为 -pointingDeviceID、-tabletID 和朋友仅对鼠标事件有效(键盘事件(伪造的或真实的)则无效)。

I can only assume a Wacom tablet's driver is faking keyboard events that are bound to specific buttons. If this is the case, I don't think you'll be able to distinguish them as -pointingDeviceID, -tabletID, and friends are only valid for mouse events (which a keyboard event - faked or real - is not).

眉黛浅 2024-09-24 06:51:08

对于“快捷键”,Wacom 通过驱动程序版本 6.1+ 提供自定义事件,

来自 Wacom 开发者文档

WacomTabletDriver 版本 6.1.0 提供了一组 Apple 事件,使应用程序能够控制数位板控件。平板电脑控件分为三种类型:ExpressKeysTouchStripTouchRing。每个控件都有一个或多个与其关联的功能。请勿假设特定平板电脑的控件数量或与控件相关的功能数量。始终使用 API 来查询信息。

应用程序需要执行以下操作来覆盖平板电脑控件:

  1. 为感兴趣的平板电脑创建上下文。
  2. 向分布式通知中心注册,以从用户操作接收被覆盖控件的数据。
  3. 按控件类型(ExpressKeys、TouchStrip、> 或 TouchRing)查询控件数量。
  4. 查询每个控件的功能数量。
  5. 枚举函数以找出可覆盖的函数。
  6. 为可用的控制功能设置覆盖标志。
  7. 处理控制数据通知以实现应用程序所需的控制功能。
  8. 必须在应用程序终止时或应用程序使用完毕后销毁上下文。

要为平板电脑创建覆盖上下文,请向平板电脑驱动程序发送类/类型为 {kAECoreSuite, kAECreateElement} 的 Apple 事件,其中包含 Apple 的 keyAEObjectClass 参数事件填充有 cContextDescTypekeyAEInsertHere 参数填充有平板电脑索引的对象说明符 (cWTDTablet code>) 和用 pContextTypeBlank 的 DescType 填充的 keyASPrepositionFor 参数。

要销毁上下文,请使用 keyDirect Apple 向平板电脑驱动程序发送类/类型为 {kAECore, kAEDelete} 的 Apple 事件事件参数填充上下文 (cContext) uniqueID (formUniqueID) 的对象说明符。

其中大部分内容仅在文档页面的上下文中才有意义,其中为 Carbon 和 Cocoa 定义了许多 C 结构体和辅助函数。 (文档中的这个特定部分相当靠后。)

For the "Express Keys", Wacom provides custom events with the driver version 6.1+

From the Wacom developer docs:

WacomTabletDriver version 6.1.0 provides a set of Apple Events that enable applications to take control of tablet controls. There are three types of tablet controls: ExpressKeys, TouchStrip, and TouchRing. Each control has one or more functions associated with it. Do not make assumption of the number of controls of a specific tablet or the number of functions associated with a control. Always use the APIs to query for the information.

An application needs to do the following to override tablet controls:

  1. Create a context for the tablet of interest.
  2. Register with the distributed notification center to receive the overridden controls’ data from user actions.
  3. Query for number of controls by control type (ExpressKeys, TouchStrip, > or TouchRing).
  4. Query for number of functions of each control.
  5. Enumerate the functions to find out which are available for override.
  6. Set override flag for a control function that’s available.
  7. Handle the control data notifications to implement functionality that the application desires for the control function.
  8. Must destroy the context upon the application’s termination or when the application is done with it.

To create an override context for a tablet, send to the Tablet Driver an Apple Event of class / type {kAECoreSuite, kAECreateElement} with the keyAEObjectClass Param of the Apple Event filled with a DescType of cContext, the keyAEInsertHere Param filled with an object specifier of the index of the tablet (cWTDTablet) and the keyASPrepositionFor Param filled with a DescType of pContextTypeBlank.

To destroy a context, send to the Tablet Driver an Apple Event of class / Type {kAECore, kAEDelete} with the keyDirect Apple Event Parameter filled with an object specifier of the context’s (cContext) uniqueID (formUniqueID).

Most of this only makes sense in context of the documentation page where lots of C structs and helper functions are defined for both Carbon and Cocoa. (This particular part in the docs is pretty far down.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文