4f219a9f |
1 | /* |
2 | * Copyright © 2009 Christopher Eby <kreed@kreed.org> |
3 | * |
4 | * This file is part of Inertia. |
5 | * |
6 | * Inertia is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU Library General Public License as |
8 | * published by the Free Software Foundation, either version 3 of |
9 | * the License, or (at your option) any later version. |
10 | * |
11 | * Inertia is distributed in the hope that it will be useful, but |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14 | * |
15 | * See <http://www.gnu.org/licenses/> for the full license text. |
16 | */ |
17 | |
18 | #include <stdlib.h> |
19 | #include <stdio.h> |
20 | #include <string.h> |
21 | |
22 | #include <X11/Xlib.h> |
23 | #include <X11/extensions/sync.h> |
24 | #include <X11/extensions/scrnsaver.h> |
25 | |
26 | static Display *dpy = NULL; |
27 | |
4f219a9f |
28 | void reset_idle_time() |
29 | { |
30 | if (!dpy) { |
31 | if (!(dpy = XOpenDisplay(NULL))) { |
32 | fputs("Could not open X11 display.\n", stderr); |
33 | return; |
34 | } |
35 | } |
36 | |
37 | XScreenSaverSuspend(dpy, True); |
38 | XSync(dpy, False); |
39 | XScreenSaverSuspend(dpy, False); |
40 | XSync(dpy, False); |
41 | } |