fe7646fd |
1 | #include <stdlib.h> |
2 | #include <stdio.h> |
3 | #include <string.h> |
4 | |
5 | #include <X11/Xlib.h> |
6 | #include <X11/extensions/sync.h> |
7 | #include <X11/extensions/scrnsaver.h> |
8 | |
9 | Display *get_current_display(void) |
10 | { |
11 | static Display *dpy = NULL; |
12 | if(!dpy) |
13 | { |
14 | if(!(dpy=XOpenDisplay(NULL))) |
15 | { |
16 | fputs("Could not open X11 display.\n", stderr); |
17 | return NULL; |
18 | } |
19 | } |
20 | return dpy; |
21 | } |
22 | |
23 | void print_screensaver_stats(void) |
24 | { |
25 | int timeout = 0; |
26 | int interval = 0; |
27 | int prefer_blanking = 0; |
28 | int allow_exposures = 0; |
29 | int x_get_screen_saver = 0; |
30 | |
31 | Display *dpy = get_current_display(); |
32 | if(!dpy) |
33 | { |
34 | fprintf(stderr, "badness!\n"); |
35 | } |
36 | |
37 | x_get_screen_saver = XGetScreenSaver(dpy, |
38 | &timeout, |
39 | &interval, |
40 | &prefer_blanking, |
41 | &allow_exposures); |
42 | printf("x_get_screen_saver = %d\n", x_get_screen_saver); |
43 | printf("timeout = %d\n", timeout); |
44 | printf("interval = %d\n", interval); |
45 | printf("prefer_blanking = %d\n", prefer_blanking); |
46 | printf("allow_exposures = %d\n", allow_exposures); |
47 | |
48 | return; |
49 | } |
50 | |
51 | void call_XForceScreenSaver_with_mode_ScreenSaverReset(void) |
52 | { |
53 | Display* dpy = get_current_display(); |
54 | if(!dpy) |
55 | { |
56 | fprintf(stderr, "badness!\n"); |
57 | } |
58 | int x_force_screen_saver = 0; |
59 | // maybe ScreenSaverReset's in the current namespace? |
60 | return; |
61 | } |
62 | |
63 | int main(int argc, char** argv) |
64 | { |
65 | Display *dpy = NULL; |
66 | dpy = get_current_display(); |
67 | if(!dpy) |
68 | { |
69 | fprintf(stderr, "badness!\n"); |
70 | } |
71 | call_XForceScreenSaver_with_mode_ScreenSaverReset(); |
72 | print_screensaver_stats(); |
73 | return 0; |
74 | } |