Código:
#include <X11/Xlib.h>
#include <iostream>
int main(){
Display* d=XOpenDisplay(NULL);
Window root=DefaultRootWindow(d);
int mousex, mousey;
bool loop=true;
while(loop)
{XQueryPointer(d, root, &root, &root, &mousex, &mousey, &mousex, &mousey, NULL);
std::cout << "(" << mousex << mousey << ")" << std::endl;
if(mousex==1 && mousey==1)loop=false;}
return 0;
}
Saludos y gracias de antemano