use full word "display" for variable in all places
[ozzloy@gmail.com/oble] / idle_x11.cpp
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
27 int reset_idle_time()
28 {
29 Display *display = NULL;
30 if (!display) {
31 if (!(display = XOpenDisplay(NULL))) {
32 fputs("Could not open X11 display.\n", stderr);
33 return -1;
34 }
35 }
36 int x_force_screen_saver;
37 int screen_saver_mode = ScreenSaverReset;
38 x_force_screen_saver = XForceScreenSaver(display, screen_saver_mode);
39 return x_force_screen_saver;
40 }