Added support for per-screen options in the configuration file

and sending those options to the appropriate client screens.
Currently, two options are supported:  halfDuplexCapsLock and
halfDuplexNumLock mark the caps lock and num lock keys,
respectively, as being half-duplex.
This commit is contained in:
crs
2002-12-23 13:55:21 +00:00
parent 72578b8061
commit 3fc1ddf6ce
29 changed files with 557 additions and 19 deletions

View File

@@ -356,6 +356,18 @@ CClient::screensaver(bool activate)
m_screen->screensaver(activate);
}
void
CClient::resetOptions()
{
m_screen->resetOptions();
}
void
CClient::setOptions(const COptionsList& options)
{
m_screen->setOptions(options);
}
CString
CClient::getName() const
{

View File

@@ -130,6 +130,8 @@ public:
virtual void mouseMove(SInt32 xAbs, SInt32 yAbs);
virtual void mouseWheel(SInt32 delta);
virtual void screensaver(bool activate);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual CString getName() const;
virtual SInt32 getJumpZoneSize() const;
virtual void getShape(SInt32& x, SInt32& y,

View File

@@ -214,6 +214,18 @@ CMSWindowsSecondaryScreen::mouseWheel(SInt32 delta)
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, delta, 0);
}
void
CMSWindowsSecondaryScreen::resetOptions()
{
// no options
}
void
CMSWindowsSecondaryScreen::setOptions(const COptionsList& /*options*/)
{
// no options
}
IScreen*
CMSWindowsSecondaryScreen::getScreen() const
{

View File

@@ -45,6 +45,8 @@ public:
virtual void mouseUp(ButtonID);
virtual void mouseMove(SInt32 xAbsolute, SInt32 yAbsolute);
virtual void mouseWheel(SInt32 delta);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual IScreen* getScreen() const;
// IMSWindowsScreenEventHandler overrides

View File

@@ -87,6 +87,9 @@ CSecondaryScreen::open()
// subclass hook
onPostOpen();
// reset options
resetOptions();
}
catch (...) {
close();

View File

@@ -18,6 +18,7 @@
#include "ClipboardTypes.h"
#include "KeyTypes.h"
#include "MouseTypes.h"
#include "OptionTypes.h"
#include "CMutex.h"
class IClipboard;
@@ -156,6 +157,19 @@ public:
*/
virtual void mouseWheel(SInt32 delta) = 0;
//! Notify of options changes
/*!
Reset all options to their default values.
*/
virtual void resetOptions() = 0;
//! Notify of options changes
/*!
Set options to given values. Ignore unknown options and don't
modify our options that aren't given in \c options.
*/
virtual void setOptions(const COptionsList& options) = 0;
//@}
//! @name accessors
//@{

View File

@@ -203,6 +203,28 @@ CXWindowsSecondaryScreen::mouseWheel(SInt32 delta)
XSync(display, False);
}
void
CXWindowsSecondaryScreen::resetOptions()
{
m_numLockHalfDuplex = false;
m_capsLockHalfDuplex = false;
}
void
CXWindowsSecondaryScreen::setOptions(const COptionsList& options)
{
for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
if (options[i] == kOptionHalfDuplexCapsLock) {
m_capsLockHalfDuplex = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "half-duplex caps-lock %s", m_capsLockHalfDuplex ? "on" : "off"));
}
else if (options[i] == kOptionHalfDuplexNumLock) {
m_numLockHalfDuplex = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "half-duplex num-lock %s", m_numLockHalfDuplex ? "on" : "off"));
}
}
}
IScreen*
CXWindowsSecondaryScreen::getScreen() const
{
@@ -262,12 +284,7 @@ CXWindowsSecondaryScreen::onPreOpen()
void
CXWindowsSecondaryScreen::onPostOpen()
{
// check for peculiarities
// FIXME -- may have to get these from some database
m_numLockHalfDuplex = false;
m_capsLockHalfDuplex = false;
// m_numLockHalfDuplex = true;
// m_capsLockHalfDuplex = true;
assert(m_window != None);
}
void

View File

@@ -43,6 +43,8 @@ public:
virtual void mouseUp(ButtonID);
virtual void mouseMove(SInt32 x, SInt32 y);
virtual void mouseWheel(SInt32 delta);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual IScreen* getScreen() const;
// IScreenEventHandler overrides