如何跟踪在 Linux 上生成的 X 窗口事件?

Wil*_*mKF 1 centos logging x-windows debug event-viewer

我记得过去有一个工具可以在 Solaris 上运行,它可以让我看到键盘和鼠标正在生成哪些 X 事件。在 Linux Centos4 上执行此操作的应用程序是什么?

Mat*_*Mat 5

xev 可能是您正在寻找的工具。

Xev 创建一个窗口,然后要求 X 服务器在窗口发生任何事情时向它发送事件(例如它被移动、调整大小、输入、点击等)。您还可以将其附加到现有窗口。它有助于查看导致事件发生的原因并显示它们包含的信息;它本质上是一个调试和开发工具,在正常使用中不需要。

它打印完整的事件内容,例如:

MotionNotify event, serial 38, synthetic NO, window 0x1a00001,
    root 0x1ff, subw 0x0, time 11360240, (108,129), root:(1078,148),
    state 0x0, is_hint 0, same_screen YES
Run Code Online (Sandbox Code Playgroud)

或按键:

KeyPress event, serial 38, synthetic NO, window 0x1a00001,
    root 0x1ff, subw 0x0, time 11362278, (111,107), root:(1081,126),
    state 0x0, keycode 24 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XmbLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False
Run Code Online (Sandbox Code Playgroud)