Reputation: 113
I want to detect right mouse button press in c++. I am programing in Linux OS.
I try to use XGrabPointer(display, root_win, False,ButtonPressMask, GrabModeSync, GrabModeSync, root_win, None, CurrentTime)
and XWindowEvent(display, root_win, ButtonPressMask , &report)
function for my project, but there is no answer.
My code is:
Display* display = NULL;
display = XOpenDisplay(NULL);
Screen *screen; Window root_win;
XEvent report;
int screen_num;
int check;
screen_num = DefaultScreen(display);
screen = XScreenOfDisplay(display, screen_num);
root_win = RootWindow(display, XScreenNumberOfScreen(screen));
check = XGrabPointer(display, root_win, False,ButtonPressMask, GrabModeSync, GrabModeSync, root_win, None, CurrentTime);
XAllowEvents(display, SyncPointer, CurrentTime); XWindowEvent(display, root_win, ButtonPressMask , &report);
Upvotes: 1
Views: 552
Reputation: 79
you most use x11 library.it is very simple (http://www.wikihow.com/Configure-X11-in-Linux)
Upvotes: 1