Added global configuration option to disable screen saver
synchronization.
This commit is contained in:
parent
65de05e3ec
commit
ed439ec33c
|
@ -300,13 +300,13 @@ CMSWindowsSecondaryScreen::mouseWheel(SInt32 delta)
|
||||||
void
|
void
|
||||||
CMSWindowsSecondaryScreen::resetOptions()
|
CMSWindowsSecondaryScreen::resetOptions()
|
||||||
{
|
{
|
||||||
// no options
|
CSecondaryScreen::resetOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMSWindowsSecondaryScreen::setOptions(const COptionsList& /*options*/)
|
CMSWindowsSecondaryScreen::setOptions(const COptionsList& options)
|
||||||
{
|
{
|
||||||
// no options
|
CSecondaryScreen::setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
IScreen*
|
IScreen*
|
||||||
|
|
|
@ -287,6 +287,7 @@ CXWindowsSecondaryScreen::resetOptions()
|
||||||
{
|
{
|
||||||
m_numLockHalfDuplex = false;
|
m_numLockHalfDuplex = false;
|
||||||
m_capsLockHalfDuplex = false;
|
m_capsLockHalfDuplex = false;
|
||||||
|
CSecondaryScreen::resetOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -302,6 +303,7 @@ CXWindowsSecondaryScreen::setOptions(const COptionsList& options)
|
||||||
LOG((CLOG_DEBUG1 "half-duplex num-lock %s", m_numLockHalfDuplex ? "on" : "off"));
|
LOG((CLOG_DEBUG1 "half-duplex num-lock %s", m_numLockHalfDuplex ? "on" : "off"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CSecondaryScreen::setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
IScreen*
|
IScreen*
|
||||||
|
|
|
@ -640,6 +640,9 @@ CConfig::getOptionName(OptionID id)
|
||||||
if (id == kOptionScreenSwitchTwoTap) {
|
if (id == kOptionScreenSwitchTwoTap) {
|
||||||
return "switchDoubleTap";
|
return "switchDoubleTap";
|
||||||
}
|
}
|
||||||
|
if (id == kOptionScreenSaverSync) {
|
||||||
|
return "screenSaverSync";
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +650,8 @@ CString
|
||||||
CConfig::getOptionValue(OptionID id, OptionValue value)
|
CConfig::getOptionValue(OptionID id, OptionValue value)
|
||||||
{
|
{
|
||||||
if (id == kOptionHalfDuplexCapsLock ||
|
if (id == kOptionHalfDuplexCapsLock ||
|
||||||
id == kOptionHalfDuplexNumLock) {
|
id == kOptionHalfDuplexNumLock ||
|
||||||
|
id == kOptionScreenSaverSync) {
|
||||||
return (value != 0) ? "true" : "false";
|
return (value != 0) ? "true" : "false";
|
||||||
}
|
}
|
||||||
if (id == kOptionModifierMapForShift ||
|
if (id == kOptionModifierMapForShift ||
|
||||||
|
@ -791,6 +795,9 @@ CConfig::readSectionOptions(std::istream& s)
|
||||||
else if (name == "switchDoubleTap") {
|
else if (name == "switchDoubleTap") {
|
||||||
addOption("", kOptionScreenSwitchTwoTap, parseInt(value));
|
addOption("", kOptionScreenSwitchTwoTap, parseInt(value));
|
||||||
}
|
}
|
||||||
|
else if (name == "screenSaverSync") {
|
||||||
|
addOption("", kOptionScreenSaverSync, parseBoolean(value));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw XConfigRead("unknown argument");
|
throw XConfigRead("unknown argument");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,10 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
CSecondaryScreen::CSecondaryScreen() :
|
CSecondaryScreen::CSecondaryScreen() :
|
||||||
|
m_remoteReady(false),
|
||||||
m_active(false),
|
m_active(false),
|
||||||
m_toggleKeys(0)
|
m_toggleKeys(0),
|
||||||
|
m_screenSaverSync(true)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -106,14 +108,23 @@ CSecondaryScreen::remoteControl()
|
||||||
// update keyboard state
|
// update keyboard state
|
||||||
updateKeys();
|
updateKeys();
|
||||||
|
|
||||||
// disable the screen saver
|
// now remote ready. fake being active for call to leave().
|
||||||
getScreen()->openScreensaver(false);
|
bool screenSaverSync;
|
||||||
|
|
||||||
// hide the cursor
|
|
||||||
{
|
{
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
|
m_remoteReady = true;
|
||||||
m_active = true;
|
m_active = true;
|
||||||
|
|
||||||
|
// copy screen saver synchronization state
|
||||||
|
screenSaverSync = m_screenSaverSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disable the screen saver if synchronization is enabled
|
||||||
|
if (screenSaverSync) {
|
||||||
|
getScreen()->openScreensaver(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// hide the cursor
|
||||||
leave();
|
leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +132,10 @@ void
|
||||||
CSecondaryScreen::localControl()
|
CSecondaryScreen::localControl()
|
||||||
{
|
{
|
||||||
getScreen()->closeScreensaver();
|
getScreen()->closeScreensaver();
|
||||||
|
|
||||||
|
// not remote ready anymore
|
||||||
|
CLock lock(&m_mutex);
|
||||||
|
m_remoteReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -204,8 +219,72 @@ CSecondaryScreen::grabClipboard(ClipboardID id)
|
||||||
void
|
void
|
||||||
CSecondaryScreen::screensaver(bool activate)
|
CSecondaryScreen::screensaver(bool activate)
|
||||||
{
|
{
|
||||||
|
// get screen saver synchronization flag
|
||||||
|
bool screenSaverSync;
|
||||||
|
{
|
||||||
|
CLock lock(&m_mutex);
|
||||||
|
screenSaverSync = m_screenSaverSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
// activate/deactivation screen saver iff synchronization enabled
|
||||||
|
if (screenSaverSync) {
|
||||||
|
LOG((CLOG_INFO "screensaver(%s)", activate ? "on" : "off"));
|
||||||
getScreen()->screensaver(activate);
|
getScreen()->screensaver(activate);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_INFO "screensaver(%s) ignored", activate ? "on" : "off"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CSecondaryScreen::resetOptions()
|
||||||
|
{
|
||||||
|
// set screen saver synchronization flag and see if we need to
|
||||||
|
// update the screen saver synchronization.
|
||||||
|
bool screenSaverSyncOn;
|
||||||
|
{
|
||||||
|
CLock lock(&m_mutex);
|
||||||
|
screenSaverSyncOn = (!m_screenSaverSync && m_remoteReady);
|
||||||
|
m_screenSaverSync = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update screen saver synchronization
|
||||||
|
if (screenSaverSyncOn) {
|
||||||
|
getScreen()->openScreensaver(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CSecondaryScreen::setOptions(const COptionsList& options)
|
||||||
|
{
|
||||||
|
// update options
|
||||||
|
bool updateScreenSaverSync = false;
|
||||||
|
bool oldScreenSaverSync;
|
||||||
|
{
|
||||||
|
CLock lock(&m_mutex);
|
||||||
|
oldScreenSaverSync = m_screenSaverSync;
|
||||||
|
for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
|
||||||
|
if (options[i] == kOptionScreenSaverSync) {
|
||||||
|
updateScreenSaverSync = true;
|
||||||
|
m_screenSaverSync = (options[i + 1] != 0);
|
||||||
|
LOG((CLOG_DEBUG1 "screen saver synchronization %s", m_screenSaverSync ? "on" : "off"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!m_remoteReady || oldScreenSaverSync == m_screenSaverSync) {
|
||||||
|
updateScreenSaverSync = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update screen saver synchronization
|
||||||
|
if (updateScreenSaverSync) {
|
||||||
|
if (oldScreenSaverSync) {
|
||||||
|
getScreen()->closeScreensaver();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getScreen()->openScreensaver(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CSecondaryScreen::isActive() const
|
CSecondaryScreen::isActive() const
|
||||||
|
|
|
@ -177,16 +177,18 @@ public:
|
||||||
|
|
||||||
//! Notify of options changes
|
//! Notify of options changes
|
||||||
/*!
|
/*!
|
||||||
Reset all options to their default values.
|
Reset all options to their default values. Overrides should call
|
||||||
|
the superclass's method.
|
||||||
*/
|
*/
|
||||||
virtual void resetOptions() = 0;
|
virtual void resetOptions();
|
||||||
|
|
||||||
//! Notify of options changes
|
//! Notify of options changes
|
||||||
/*!
|
/*!
|
||||||
Set options to given values. Ignore unknown options and don't
|
Set options to given values. Ignore unknown options and don't
|
||||||
modify our options that aren't given in \c options.
|
modify our options that aren't given in \c options. Overrides
|
||||||
|
should call the superclass's method.
|
||||||
*/
|
*/
|
||||||
virtual void setOptions(const COptionsList& options) = 0;
|
virtual void setOptions(const COptionsList& options);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
|
@ -372,11 +374,17 @@ protected:
|
||||||
private:
|
private:
|
||||||
CMutex m_mutex;
|
CMutex m_mutex;
|
||||||
|
|
||||||
|
// true if ready for remote control
|
||||||
|
bool m_remoteReady;
|
||||||
|
|
||||||
// m_active is true if this screen has been entered
|
// m_active is true if this screen has been entered
|
||||||
bool m_active;
|
bool m_active;
|
||||||
|
|
||||||
// the toggle key state when this screen was last entered
|
// the toggle key state when this screen was last entered
|
||||||
KeyModifierMask m_toggleKeys;
|
KeyModifierMask m_toggleKeys;
|
||||||
|
|
||||||
|
// true if screen saver should be synchronized to server
|
||||||
|
bool m_screenSaverSync;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,6 +53,7 @@ static const OptionID kOptionModifierMapForSuper = OPTION_CODE("MMFR");
|
||||||
static const OptionID kOptionHeartbeat = OPTION_CODE("HART");
|
static const OptionID kOptionHeartbeat = OPTION_CODE("HART");
|
||||||
static const OptionID kOptionScreenSwitchDelay = OPTION_CODE("SSWT");
|
static const OptionID kOptionScreenSwitchDelay = OPTION_CODE("SSWT");
|
||||||
static const OptionID kOptionScreenSwitchTwoTap = OPTION_CODE("SSTT");
|
static const OptionID kOptionScreenSwitchTwoTap = OPTION_CODE("SSTT");
|
||||||
|
static const OptionID kOptionScreenSaverSync = OPTION_CODE("SSVR");
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
#undef OPTION_CODE
|
#undef OPTION_CODE
|
||||||
|
|
Loading…
Reference in New Issue