向应用程序发送按键

发布于 2024-12-03 13:47:30 字数 176 浏览 0 评论 0原文

有没有一种简单的方法可以让应用程序认为用户已经按下了某个键?

这就是我尝试这样做的原因:

我试图追踪 Wine 应用程序中的回归。该错误似乎仅在用户按下特定键(在本例中为转义键)时才会出现。所以我想给 git bisect 一个脚本来启动应用程序,模拟按转义键,并告诉 git 如果程序崩溃,版本是错误的。

Is there an easy way to make an application think the user has pressed a key?

Here's why I am trying to do this:

I am trying to track down a regression in a Wine application. The bug only seems to show itself when the user presses a specific key (in this case, escape). So I wanted to give git bisect a script that launches the application, simulates pressing escape, and tells git that that the revision is bad if the program crashes.

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

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

发布评论

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

评论(2

新雨望断虹 2024-12-10 13:47:30

有一些示例代码:http://www. doctort.org/adam/nerd-notes/x11-fake-keypress-event.html

这可能大致就是您所需要的。另请阅读评论(有一个以不同方式选择窗口的示例)。

There is some sample code at: http://www.doctort.org/adam/nerd-notes/x11-fake-keypress-event.html

It might be roughly what you need. Also read the comments (there is a sample for selecting a window in a different way).

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