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