|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* vim:expandtab:shiftwidth=4:tabstop=4: |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #ifndef nsIdleServiceQt_h__ |
|
9 #define nsIdleServiceQt_h__ |
|
10 |
|
11 #include "nsIdleService.h" |
|
12 |
|
13 #if defined(MOZ_X11) |
|
14 #include <X11/Xlib.h> |
|
15 #include <X11/Xutil.h> |
|
16 |
|
17 typedef struct { |
|
18 Window window; // Screen saver window |
|
19 int state; // ScreenSaver(Off,On,Disabled) |
|
20 int kind; // ScreenSaver(Blanked,Internal,External) |
|
21 unsigned long til_or_since; // milliseconds since/til screensaver kicks in |
|
22 unsigned long idle; // milliseconds idle |
|
23 unsigned long event_mask; // event stuff |
|
24 } XScreenSaverInfo; |
|
25 #endif |
|
26 |
|
27 class nsIdleServiceQt : public nsIdleService |
|
28 { |
|
29 public: |
|
30 NS_DECL_ISUPPORTS_INHERITED |
|
31 |
|
32 bool PollIdleTime(uint32_t* aIdleTime); |
|
33 |
|
34 static already_AddRefed<nsIdleServiceQt> GetInstance() |
|
35 { |
|
36 nsRefPtr<nsIdleServiceQt> idleService = |
|
37 nsIdleService::GetInstance().downcast<nsIdleServiceQt>(); |
|
38 if (!idleService) { |
|
39 idleService = new nsIdleServiceQt(); |
|
40 } |
|
41 |
|
42 return idleService.forget(); |
|
43 } |
|
44 |
|
45 private: |
|
46 #if defined(MOZ_X11) |
|
47 XScreenSaverInfo* mXssInfo; |
|
48 #endif |
|
49 |
|
50 protected: |
|
51 nsIdleServiceQt(); |
|
52 virtual ~nsIdleServiceQt(); |
|
53 bool UsePollMode(); |
|
54 }; |
|
55 |
|
56 #endif // nsIdleServiceQt_h__ |