2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
#include "deskflow/IScreenSaver.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2014-02-28 12:36:45 +00:00
|
|
|
#include <Windows.h>
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
class Thread;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
//! Microsoft windows screen saver implementation
|
2024-10-17 18:04:35 +00:00
|
|
|
class MSWindowsScreenSaver : public IScreenSaver
|
|
|
|
|
{
|
2012-06-10 16:50:54 +00:00
|
|
|
public:
|
2024-07-02 19:07:06 +00:00
|
|
|
MSWindowsScreenSaver();
|
2025-05-02 12:29:56 +00:00
|
|
|
~MSWindowsScreenSaver() override;
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
//! @name manipulators
|
|
|
|
|
//@{
|
|
|
|
|
|
|
|
|
|
//! 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.
|
|
|
|
|
*/
|
|
|
|
|
bool checkStarted(UINT msg, WPARAM, LPARAM);
|
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
// IScreenSaver overrides
|
2025-05-02 12:29:56 +00:00
|
|
|
void enable() override;
|
|
|
|
|
void disable() override;
|
|
|
|
|
void activate() override;
|
|
|
|
|
void deactivate() override;
|
|
|
|
|
bool isActive() const override;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
private:
|
2024-10-17 18:04:35 +00:00
|
|
|
class FindScreenSaverInfo
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
public:
|
|
|
|
|
HDESK m_desktop;
|
|
|
|
|
HWND m_window;
|
|
|
|
|
};
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
static BOOL CALLBACK killScreenSaverFunc(HWND hwnd, LPARAM lParam);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void watchDesktop();
|
|
|
|
|
void watchProcess(HANDLE process);
|
|
|
|
|
void unwatchProcess();
|
|
|
|
|
void watchDesktopThread(void *);
|
|
|
|
|
void watchProcessThread(void *);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void setSecure(bool secure, bool saveSecureAsInt);
|
|
|
|
|
bool isSecure(bool *wasSecureAnInt) const;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
BOOL m_wasEnabled;
|
|
|
|
|
bool m_wasSecure;
|
|
|
|
|
bool m_wasSecureAnInt;
|
|
|
|
|
|
|
|
|
|
HANDLE m_process;
|
|
|
|
|
Thread *m_watch;
|
|
|
|
|
DWORD m_threadID;
|
|
|
|
|
UINT m_msg;
|
|
|
|
|
WPARAM m_wParam;
|
|
|
|
|
LPARAM m_lParam;
|
|
|
|
|
|
|
|
|
|
// checkActive state. true if the screen saver is being watched
|
|
|
|
|
// for deactivation (and is therefore active).
|
|
|
|
|
bool m_active;
|
2012-06-10 16:50:54 +00:00
|
|
|
};
|