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

时间:2015-12-01 12:50:08

标签: 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

1 个答案:

答案 0 :(得分:0)

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