2002-08-02 19:57:46 +00:00
|
|
|
/*
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
|
|
|
* Copyright (C) 2002 Chris Schoeneman
|
|
|
|
*
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* found in the file COPYING that should have accompanied this file.
|
|
|
|
*
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2002-07-01 12:58:52 +00:00
|
|
|
#ifndef CMSWINDOWSSCREENSAVER_H
|
|
|
|
#define CMSWINDOWSSCREENSAVER_H
|
|
|
|
|
|
|
|
#include "IScreenSaver.h"
|
2004-03-13 17:13:55 +00:00
|
|
|
#include "CString.h"
|
2002-07-01 12:58:52 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
class CThread;
|
|
|
|
|
2002-07-29 17:03:55 +00:00
|
|
|
//! Microsoft windows screen saver implementation
|
2002-07-01 12:58:52 +00:00
|
|
|
class CMSWindowsScreenSaver : public IScreenSaver {
|
|
|
|
public:
|
|
|
|
CMSWindowsScreenSaver();
|
|
|
|
virtual ~CMSWindowsScreenSaver();
|
|
|
|
|
2002-07-29 17:03:55 +00:00
|
|
|
//! @name manipulators
|
|
|
|
//@{
|
2002-07-01 12:58:52 +00:00
|
|
|
|
2002-07-29 17:03:55 +00:00
|
|
|
//! Check if screen saver started
|
|
|
|
/*!
|
|
|
|
Check if the screen saver really started. Returns false if it
|
|
|
|
hasn't, true otherwise. When the screen saver stops, \c msg will
|
|
|
|
be posted to the current thread's message queue with the given
|
|
|
|
parameters.
|
|
|
|
*/
|
2002-07-01 12:58:52 +00:00
|
|
|
bool checkStarted(UINT msg, WPARAM, LPARAM);
|
|
|
|
|
2002-07-29 17:03:55 +00:00
|
|
|
//@}
|
|
|
|
|
2002-07-01 12:58:52 +00:00
|
|
|
// IScreenSaver overrides
|
|
|
|
virtual void enable();
|
|
|
|
virtual void disable();
|
|
|
|
virtual void activate();
|
|
|
|
virtual void deactivate();
|
|
|
|
virtual bool isActive() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
class CFindScreenSaverInfo {
|
|
|
|
public:
|
|
|
|
HDESK m_desktop;
|
|
|
|
HWND m_window;
|
|
|
|
};
|
|
|
|
|
|
|
|
static BOOL CALLBACK findScreenSaverFunc(HWND hwnd, LPARAM lParam);
|
|
|
|
static BOOL CALLBACK killScreenSaverFunc(HWND hwnd, LPARAM lParam);
|
|
|
|
|
2003-03-16 17:40:57 +00:00
|
|
|
DWORD findScreenSaver();
|
|
|
|
void watchDesktop();
|
2002-07-01 12:58:52 +00:00
|
|
|
void watchProcess(HANDLE process);
|
|
|
|
void unwatchProcess();
|
2003-03-16 17:40:57 +00:00
|
|
|
void watchDesktopThread(void*);
|
2002-07-01 12:58:52 +00:00
|
|
|
void watchProcessThread(void*);
|
|
|
|
|
2004-03-13 17:13:55 +00:00
|
|
|
void setSecure(bool secure, bool saveSecureAsInt);
|
|
|
|
bool isSecure(bool* wasSecureAnInt) const;
|
|
|
|
|
2002-07-01 12:58:52 +00:00
|
|
|
private:
|
|
|
|
bool m_is95Family;
|
|
|
|
bool m_is95;
|
|
|
|
bool m_isNT;
|
|
|
|
BOOL m_wasEnabled;
|
2004-03-13 17:13:55 +00:00
|
|
|
bool m_wasSecure;
|
|
|
|
bool m_wasSecureAnInt;
|
2002-07-01 12:58:52 +00:00
|
|
|
|
|
|
|
HANDLE m_process;
|
|
|
|
CThread* m_watch;
|
|
|
|
DWORD m_threadID;
|
|
|
|
UINT m_msg;
|
|
|
|
WPARAM m_wParam;
|
|
|
|
LPARAM m_lParam;
|
2004-06-12 20:48:04 +00:00
|
|
|
|
|
|
|
// checkActive state. true if the screen saver is being watched
|
|
|
|
// for deactivation (and is therefore active).
|
|
|
|
bool m_active;
|
2002-07-01 12:58:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|