From 3c3c31008e4e56b18303ce3ac13eeaa5923387d9 Mon Sep 17 00:00:00 2001
From: crs
Date: Tue, 28 Sep 2004 22:19:11 +0000
Subject: [PATCH] Added half-duplex option for scroll lock key.
---
cmd/launcher/launcher.cpp | 12 +++++++++++-
cmd/launcher/launcher.rc | 14 ++++++++------
cmd/launcher/resource.h | 1 +
doc/configuration.html | 8 ++++++++
doc/faq.html | 25 +++++++++++++------------
lib/server/CConfig.cpp | 8 ++++++++
lib/synergy/CScreen.cpp | 10 ++++++++++
7 files changed, 59 insertions(+), 19 deletions(-)
diff --git a/cmd/launcher/launcher.cpp b/cmd/launcher/launcher.cpp
index 1b89e9fb..66019f01 100644
--- a/cmd/launcher/launcher.cpp
+++ b/cmd/launcher/launcher.cpp
@@ -829,6 +829,10 @@ addDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
index->second != 0));
child = getItem(hwnd, IDC_ADD_HD_NUM_CHECK);
index = info->m_options.find(kOptionHalfDuplexNumLock);
+ setItemChecked(child, (index != info->m_options.end() &&
+ index->second != 0));
+ child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
+ index = info->m_options.find(kOptionHalfDuplexScrollLock);
setItemChecked(child, (index != info->m_options.end() &&
index->second != 0));
@@ -940,9 +944,15 @@ addDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
else {
info->m_options.erase(kOptionHalfDuplexNumLock);
}
+ child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
+ if (isItemChecked(child)) {
+ info->m_options[kOptionHalfDuplexScrollLock] = 1;
+ }
+ else {
+ info->m_options.erase(kOptionHalfDuplexScrollLock);
+ }
// save modifier options
- child = getItem(hwnd, IDC_ADD_HD_CAPS_CHECK);
for (UInt32 i = 0; i < sizeof(s_modifiers) /
sizeof(s_modifiers[0]); ++i) {
child = getItem(hwnd, s_modifiers[i].m_ctrlID);
diff --git a/cmd/launcher/launcher.rc b/cmd/launcher/launcher.rc
index d14e60f5..71742019 100644
--- a/cmd/launcher/launcher.rc
+++ b/cmd/launcher/launcher.rc
@@ -116,13 +116,15 @@ BEGIN
LTEXT "&Aliases:",IDC_STATIC,7,25,25,8
EDITTEXT IDC_ADD_ALIASES_EDIT,79,26,106,40,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
- GROUPBOX "Options",IDC_STATIC,7,72,178,64
- LTEXT "If your Caps Lock or Num Lock keys behave strangely on this client screen then try turning the half-duplex options on and reconnect the client.",
+ GROUPBOX "Half-Duplex",IDC_STATIC,7,72,178,64
+ LTEXT "If your Caps, Num, or Scroll Lock keys behave strangely on this screen then turn on the half-duplex options and restart the server.",
IDC_STATIC,13,82,165,25
- CONTROL "Half-duplex &Caps Lock",IDC_ADD_HD_CAPS_CHECK,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,110,165,10
- CONTROL "Half-duplex &Num Lock",IDC_ADD_HD_NUM_CHECK,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,122,165,10
+ CONTROL "&Caps Lock",IDC_ADD_HD_CAPS_CHECK,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,110,81,10
+ CONTROL "&Num Lock",IDC_ADD_HD_NUM_CHECK,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,122,81,10
+ CONTROL "Sc&roll Lock",IDC_ADD_HD_SCROLL_CHECK,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,98,110,81,10
GROUPBOX "Modifiers",IDC_STATIC,7,139,178,65
LTEXT "Shift",IDC_STATIC,13,155,15,8
COMBOBOX IDC_ADD_MOD_SHIFT,37,152,48,60,CBS_DROPDOWNLIST |
diff --git a/cmd/launcher/resource.h b/cmd/launcher/resource.h
index e6d90dac..b8c746ff 100644
--- a/cmd/launcher/resource.h
+++ b/cmd/launcher/resource.h
@@ -87,6 +87,7 @@
#define IDC_ADD_HD_NUM_CHECK 1038
#define IDC_ADVANCED_NAME_EDIT 1038
#define IDC_ADVANCED_PORT_EDIT 1039
+#define IDC_ADD_HD_SCROLL_CHECK 1039
#define IDC_MAIN_DEBUG 1040
#define IDC_GLOBAL_DELAY_CHECK 1041
#define IDC_GLOBAL_DELAY_TIME 1042
diff --git a/doc/configuration.html b/doc/configuration.html
index 494b8718..2cee328a 100644
--- a/doc/configuration.html
+++ b/doc/configuration.html
@@ -99,6 +99,14 @@ A screen can have the following options:
This is identical to halfDuplexCapsLock
except it applies to the Num Lock key.
+halfDuplexScrollLock = {true|false}
+
+ This is identical to halfDuplexCapsLock
+ except it applies to the Scroll Lock key. Note that synergy uses
+ Scroll Lock to keep the cursor on the current screen. That is,
+ when Scroll Lock is toggled on, the cursor is locked to the screen
+ that it's currently on. Use it to prevent accidental switching.
+
xtestIsXineramaUnaware = {true|false}
This option works around a bug in the XTest extension
diff --git a/doc/faq.html b/doc/faq.html
index 86f2d539..1b355594 100644
--- a/doc/faq.html
+++ b/doc/faq.html
@@ -15,7 +15,7 @@
What does "Cannot initialize hook library" mean?
What security/encryption does synergy provide?
What should I call my screens in the configuration?
-Why do my Caps-Lock and Num-Lock keys act funny?
+Why do my Caps-Lock, Num-Lock, Scroll-Lock keys act funny?
Can synergy share the display in addition to the mouse and keyboard?
Can synergy do drag and drop between computers?
Do AltGr or Mode-Switch or ISO_Level3_Shift work?
@@ -125,28 +125,29 @@
then use xyz.local as the screen name.
-Why do my Caps-Lock and Num-Lock keys act funny?
+Why do my Caps-Lock, Num-Lock, Scroll-Lock keys act funny?
- Some systems treat the Caps-Lock and Num-Lock keys differently
- than all the others. Whereas most keys report going down when
- physically pressed and going up when physically released, on
- these systems the Caps-Lock and Num-Lock keys report going down
- when being activated and going up when being deactivated. That
- is, when you press and release, say, Caps-Lock to activate it, it
- only reports going down, and when you press and release to
- deactivate it, it only reports going up. This confuses synergy.
+ Some systems treat the Caps-Lock, Num-Lock, and Scroll-Lock keys
+ differently than all the others. Whereas most keys report going down
+ when physically pressed and going up when physically released, on
+ these systems the keys report going down when being activated and
+ going up when being deactivated. That is, when you press and release,
+ say, Caps-Lock to activate it, it only reports going down, and when
+ you press and release to deactivate it, it only reports going up.
+ This confuses synergy.
You can solve the problem by changing your configuration file.
In the screens section, following each screen that has the
- problem, add either or both of these lines as appropriate:
+ problem, add any or all of these lines as appropriate:
halfDuplexCapsLock = true
halfDuplexNumLock = true
+ halfDuplexScrollLock = true
- Then restart synergy on the server.
+ Then restart synergy on the server or reload the configuration.
Can synergy share the display in addition to the mouse and keyboard?
diff --git a/lib/server/CConfig.cpp b/lib/server/CConfig.cpp
index 03e0eb2d..1598854f 100644
--- a/lib/server/CConfig.cpp
+++ b/lib/server/CConfig.cpp
@@ -599,6 +599,9 @@ CConfig::getOptionName(OptionID id)
if (id == kOptionHalfDuplexNumLock) {
return "halfDuplexNumLock";
}
+ if (id == kOptionHalfDuplexScrollLock) {
+ return "halfDuplexScrollLock";
+ }
if (id == kOptionModifierMapForShift) {
return "shift";
}
@@ -640,6 +643,7 @@ CConfig::getOptionValue(OptionID id, OptionValue value)
{
if (id == kOptionHalfDuplexCapsLock ||
id == kOptionHalfDuplexNumLock ||
+ id == kOptionHalfDuplexScrollLock ||
id == kOptionScreenSaverSync ||
id == kOptionXTestXineramaUnaware ||
id == kOptionRelativeMouseMoves) {
@@ -850,6 +854,10 @@ CConfig::readSectionScreens(std::istream& s)
addOption(screen, kOptionHalfDuplexNumLock,
parseBoolean(value));
}
+ else if (name == "halfDuplexScrollLock") {
+ addOption(screen, kOptionHalfDuplexScrollLock,
+ parseBoolean(value));
+ }
else if (name == "shift") {
addOption(screen, kOptionModifierMapForShift,
parseModifierKey(value));
diff --git a/lib/synergy/CScreen.cpp b/lib/synergy/CScreen.cpp
index 67140498..0323d8a8 100644
--- a/lib/synergy/CScreen.cpp
+++ b/lib/synergy/CScreen.cpp
@@ -285,6 +285,16 @@ CScreen::setOptions(const COptionsList& options)
m_screen->setHalfDuplexMask(m_halfDuplex);
LOG((CLOG_DEBUG1 "half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off"));
}
+ else if (options[i] == kOptionHalfDuplexScrollLock) {
+ if (options[i + 1] != 0) {
+ m_halfDuplex |= KeyModifierScrollLock;
+ }
+ else {
+ m_halfDuplex &= ~KeyModifierScrollLock;
+ }
+ m_screen->setHalfDuplexMask(m_halfDuplex);
+ LOG((CLOG_DEBUG1 "half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off"));
+ }
}
// update screen saver synchronization