c - 尝试获取鼠标点击坐标时出错

标签 c linux mouseevent xlib

我正在尝试运行此主题(第一个答案)中的代码:getting mouseclick coordinates with Xlib它给了我一些错误。

输出:

$ ./a.out
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Serial number of failed request:  8
  Current serial number in output stream:  8

最佳答案

应该使用:gcc c.cc -lX11
并将一个字符串更改为:XSelectInput(display, root, ButtonReleaseMask);

关于c - 尝试获取鼠标点击坐标时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34020875/

相关文章:

c - malloc 后释放内存

c++ - 为什么 View 和表的 sqlite 列有不同的名称?

c++ - 带有 cmake 的独立静态库 (.a)

c++ - 如何在 Microsoft visual C++ ( MFC ) 中处理特定控件的鼠标悬停事件?

android - 如何在 ChromeOS/Android 上使用触摸板进行缩放?

c - pcap_if_t : how to pick an element from this structure

c - 在c中使用socket选择阻塞

linux - 如何在本地安装包?

c - 在 Linux 内核模块(驱动程序)临界区等待用户空间输入

javascript - 在 $(document) 上绑定(bind)事件时绑定(bind)上下文