diff options
Diffstat (limited to 'SwifTools/Idle/XSSIdleQuerier.cpp')
-rw-r--r-- | SwifTools/Idle/XSSIdleQuerier.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/SwifTools/Idle/XSSIdleQuerier.cpp b/SwifTools/Idle/XSSIdleQuerier.cpp index 883f76f..03c5330 100644 --- a/SwifTools/Idle/XSSIdleQuerier.cpp +++ b/SwifTools/Idle/XSSIdleQuerier.cpp @@ -14,31 +14,31 @@ namespace Swift { XSSIdleQuerier::XSSIdleQuerier() : display(NULL), info(NULL) { - display = XOpenDisplay(NULL); - assert(display); - rootWindow = DefaultRootWindow(display); - int event, error; - available = XScreenSaverQueryExtension(display, &event, &error); - if (available) { - info = XScreenSaverAllocInfo(); - } - else { - std::cerr << "Warning: XScreenSaver extension not found. Idle time detection will not work." << std::endl; - } + display = XOpenDisplay(NULL); + assert(display); + rootWindow = DefaultRootWindow(display); + int event, error; + available = XScreenSaverQueryExtension(display, &event, &error); + if (available) { + info = XScreenSaverAllocInfo(); + } + else { + std::cerr << "Warning: XScreenSaver extension not found. Idle time detection will not work." << std::endl; + } } XSSIdleQuerier::~XSSIdleQuerier() { - XFree(info); + XFree(info); } int XSSIdleQuerier::getIdleTimeSeconds() { - if (available) { - XScreenSaverQueryInfo(display, rootWindow, info); - return info->idle / 1000; - } - else { - return 0; - } + if (available) { + XScreenSaverQueryInfo(display, rootWindow, info); + return info->idle / 1000; + } + else { + return 0; + } } } |