1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/qt/nsIdleServiceQt.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim:expandtab:shiftwidth=4:tabstop=4: 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#ifndef nsIdleServiceQt_h__ 1.12 +#define nsIdleServiceQt_h__ 1.13 + 1.14 +#include "nsIdleService.h" 1.15 + 1.16 +#if defined(MOZ_X11) 1.17 +#include <X11/Xlib.h> 1.18 +#include <X11/Xutil.h> 1.19 + 1.20 +typedef struct { 1.21 + Window window; // Screen saver window 1.22 + int state; // ScreenSaver(Off,On,Disabled) 1.23 + int kind; // ScreenSaver(Blanked,Internal,External) 1.24 + unsigned long til_or_since; // milliseconds since/til screensaver kicks in 1.25 + unsigned long idle; // milliseconds idle 1.26 + unsigned long event_mask; // event stuff 1.27 +} XScreenSaverInfo; 1.28 +#endif 1.29 + 1.30 +class nsIdleServiceQt : public nsIdleService 1.31 +{ 1.32 +public: 1.33 + NS_DECL_ISUPPORTS_INHERITED 1.34 + 1.35 + bool PollIdleTime(uint32_t* aIdleTime); 1.36 + 1.37 + static already_AddRefed<nsIdleServiceQt> GetInstance() 1.38 + { 1.39 + nsRefPtr<nsIdleServiceQt> idleService = 1.40 + nsIdleService::GetInstance().downcast<nsIdleServiceQt>(); 1.41 + if (!idleService) { 1.42 + idleService = new nsIdleServiceQt(); 1.43 + } 1.44 + 1.45 + return idleService.forget(); 1.46 + } 1.47 + 1.48 +private: 1.49 +#if defined(MOZ_X11) 1.50 + XScreenSaverInfo* mXssInfo; 1.51 +#endif 1.52 + 1.53 +protected: 1.54 + nsIdleServiceQt(); 1.55 + virtual ~nsIdleServiceQt(); 1.56 + bool UsePollMode(); 1.57 +}; 1.58 + 1.59 +#endif // nsIdleServiceQt_h__