Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: src/platform/power_manager/xidle.h

Issue 652147: Add xidle library to power_manager for testing how long the user has been idle (Closed)
Patch Set: Fix issues pointed out by rtc Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform/power_manager/testrunner.cc ('k') | src/platform/power_manager/xidle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SRC_PLATFORM_POWER_MANAGER_XIDLE_H_
6 #define SRC_PLATFORM_POWER_MANAGER_XIDLE_H_
7
8 #include <X11/extensions/scrnsaver.h>
9 #include <X11/Xlib.h>
10 #include "base/basictypes.h"
11
12 namespace chromeos {
13
14 // \brief Connect to the local X Server and determine how long the user has
15 // been idle, in milliseconds.
16 //
17 // Creating a new XIdle object connects to the local X Server. When the object
18 // is destroyed, the connection is also destroyed.
19 //
20 // \example
21 // chromeos::XIdle idle;
22 // uint64 idleTime;
23 // if (idle.getIdleTime(&idleTime))
24 // std::cout << "User has been idle for " << idleTime << " milliseconds\n";
25 // \end_example
26
27 class XIdle {
28 public:
29 XIdle();
30 ~XIdle();
31
32 // Return how long the X Server has been idle, in milliseconds.
33 // If success, return true; otherwise return false.
34 bool getIdleTime(uint64 *idle);
35 private:
36 Display *display_;
37 XScreenSaverInfo *info_;
38 int event_base_, error_base_;
39 bool valid_;
40 DISALLOW_COPY_AND_ASSIGN(XIdle);
41 };
42
43 } // namespace chromeos
44
45 #endif // SRC_PLATFORM_POWER_MANAGER_XIDLE_H_
OLDNEW
« no previous file with comments | « src/platform/power_manager/testrunner.cc ('k') | src/platform/power_manager/xidle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698