Window root = RootWindow(dpy,The_screen);
int buttons = 0;
/* Make the target cursor */
cursor = XCreateFontCursor(dpy, /*XC_crosshair*/XC_hand2);
/* Grab the pointer using target cursor, letting it room all over */
status = XGrabPointer(dpy, root, False,
ButtonPressMask|ButtonReleaseMask, GrabModeSync,
GrabModeAsync, root, cursor, CurrentTime);
if (status != GrabSuccess) {
return None;
}
/* allow one more event */
XAllowEvents(dpy, SyncPointer, CurrentTime);
XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event);
switch (event.type) {
case ButtonPress:
buttons++;
break;
case ButtonRelease:
if (buttons > 0) /* there may have been some down before we started */
buttons--;
break;
}
XUngrabPointer(dpy, CurrentTime); /* Done with pointer */
Window root = RootWindow(dpy,The_screen);
int buttons = 0;
/* Make the target cursor */
cursor = XCreateFontCursor(dpy, /*XC_crosshair*/XC_hand2);
/* Grab the pointer using target cursor, letting it room all over */
status = XGrabPointer(dpy, root, False,
ButtonPressMask|ButtonReleaseMask, GrabModeSync,
GrabModeAsync, root, cursor, CurrentTime);
if (status != GrabSuccess) {
return None;
}
/* allow one more event */
XAllowEvents(dpy, SyncPointer, CurrentTime);
XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event);
switch (event.type) {
case ButtonPress:
buttons++;
break;
case ButtonRelease:
if (buttons > 0) /* there may have been some down before we started */
buttons--;
break;
}
XUngrabPointer(dpy, CurrentTime); /* Done with pointer */
To copy to clipboard, switch view to plain text mode
Bookmarks