-
Notifications
You must be signed in to change notification settings - Fork 0
/
xhp.c
32 lines (32 loc) · 775 Bytes
/
xhp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*xhp-x hide pointer.*/
#include<X11/Xlib.h>
#include<time.h>
Display* dpl;
Window w;
XEvent ev;
Pixmap pxmap;
Cursor cur;
XColor col;
struct timespec dly;
int main(){
dpl=XOpenDisplay(0);
if(!dpl)return 1;
w=DefaultRootWindow(dpl);
dly.tv_sec=0;dly.tv_nsec=810000000L;
col=(XColor){0};
pxmap=XCreatePixmap(dpl,w,1,1,1);
cur=XCreatePixmapCursor(dpl,pxmap,pxmap,&col,&col,0,0);
XFreePixmap(dpl,pxmap);
while(1){
if(XGrabPointer(dpl,w,0,PointerMotionMask|ButtonPressMask,GrabModeSync,
GrabModeAsync,w,cur,CurrentTime)==GrabSuccess){
XAllowEvents(dpl,SyncPointer,CurrentTime);
do{
XMaskEvent(dpl,PointerMotionMask|ButtonPressMask,&ev);
XAllowEvents(dpl,ReplayPointer,CurrentTime);
XUngrabPointer(dpl,CurrentTime);
}while(XPending(dpl));
nanosleep(&dly,0);
}
}
return 0;}