13 int delta_x = 500, delta_y = 160;
14 Display *display = XOpenDisplay(0);
15 Window root = DefaultRootWindow(display);
16 XWarpPointer(display, None, root, 0, 0, 0, 0, delta_x, delta_y);
17 XCloseDisplay(display);
21 void mouseClick(int button
)
23 Display
*display
= XOpenDisplay(NULL
);
28 fprintf(stderr
, "Cannot open display!!!\n");
32 memset(&event
, 0x00, sizeof(event
));
34 event
.type
= ButtonPress
;
35 event
.xbutton
.button
= button
;
36 event
.xbutton
.same_screen
= True
;
38 XQueryPointer(display
, RootWindow(display
, DefaultScreen(display
)), &event
.xbutton
.root
, &event
.xbutton
.window
, &event
.xbutton
.x_root
, &event
.xbutton
.y_root
, &event
.xbutton
.x
, &event
.xbutton
.y
, &event
.xbutton
.state
);
40 event
.xbutton
.subwindow
= event
.xbutton
.window
;
42 while(event
.xbutton
.subwindow
)
44 event
.xbutton
.window
= event
.xbutton
.subwindow
;
46 XQueryPointer(display
, event
.xbutton
.window
, &event
.xbutton
.root
, &event
.xbutton
.subwindow
, &event
.xbutton
.x_root
, &event
.xbutton
.y_root
, &event
.xbutton
.x
, &event
.xbutton
.y
, &event
.xbutton
.state
);
49 if(XSendEvent(display
, PointerWindow
, True
, 0xfff, &event
) == 0) fprintf(stderr
, "Errore nell'invio dell'evento !!!\n");
55 event
.type
= ButtonRelease
;
56 event
.xbutton
.state
= 0x100;
58 if(XSendEvent(display
, PointerWindow
, True
, 0xfff, &event
) == 0) fprintf(stderr
, "Errore nell'invio dell'evento !!!\n");
62 XCloseDisplay(display
);
This page took 0.299872 seconds and 4 git commands to generate.