Added ignoreNumLock boolean per-screen option. When true, NumLock
is ignored on that client (it has no effect on the server). This is useful for keyboards that don't have separate number pads and the user often uses the client's keyboard directly, when turning on NumLock interferes with normal typing.
This commit is contained in:
parent
476faea8ab
commit
faff28de44
|
@ -445,6 +445,11 @@ CServerProxy::enter()
|
||||||
m_seqNum = seqNum;
|
m_seqNum = seqNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore num lock if so desired
|
||||||
|
if (m_ignoreNumLock) {
|
||||||
|
mask &= ~KeyModifierNumLock;
|
||||||
|
}
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
getClient()->enter(x, y, seqNum, static_cast<KeyModifierMask>(mask), false);
|
getClient()->enter(x, y, seqNum, static_cast<KeyModifierMask>(mask), false);
|
||||||
}
|
}
|
||||||
|
@ -520,6 +525,12 @@ CServerProxy::keyDown()
|
||||||
mask2 != static_cast<KeyModifierMask>(mask))
|
mask2 != static_cast<KeyModifierMask>(mask))
|
||||||
LOG((CLOG_DEBUG1 "key down translated to id=%d, mask=0x%04x", id2, mask2));
|
LOG((CLOG_DEBUG1 "key down translated to id=%d, mask=0x%04x", id2, mask2));
|
||||||
|
|
||||||
|
// ignore num lock if so desired
|
||||||
|
if (id2 == kKeyNumLock && m_ignoreNumLock) {
|
||||||
|
LOG((CLOG_DEBUG1 "ignoring num lock"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
getClient()->keyDown(id2, mask2, button);
|
getClient()->keyDown(id2, mask2, button);
|
||||||
}
|
}
|
||||||
|
@ -544,6 +555,12 @@ CServerProxy::keyRepeat()
|
||||||
mask2 != static_cast<KeyModifierMask>(mask))
|
mask2 != static_cast<KeyModifierMask>(mask))
|
||||||
LOG((CLOG_DEBUG1 "key repeat translated to id=%d, mask=0x%04x", id2, mask2));
|
LOG((CLOG_DEBUG1 "key repeat translated to id=%d, mask=0x%04x", id2, mask2));
|
||||||
|
|
||||||
|
// ignore num lock if so desired
|
||||||
|
if (id2 == kKeyNumLock && m_ignoreNumLock) {
|
||||||
|
LOG((CLOG_DEBUG1 "ignoring num lock"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
getClient()->keyRepeat(id2, mask2, count, button);
|
getClient()->keyRepeat(id2, mask2, count, button);
|
||||||
}
|
}
|
||||||
|
@ -567,6 +584,12 @@ CServerProxy::keyUp()
|
||||||
mask2 != static_cast<KeyModifierMask>(mask))
|
mask2 != static_cast<KeyModifierMask>(mask))
|
||||||
LOG((CLOG_DEBUG1 "key up translated to id=%d, mask=0x%04x", id2, mask2));
|
LOG((CLOG_DEBUG1 "key up translated to id=%d, mask=0x%04x", id2, mask2));
|
||||||
|
|
||||||
|
// ignore num lock if so desired
|
||||||
|
if (id2 == kKeyNumLock && m_ignoreNumLock) {
|
||||||
|
LOG((CLOG_DEBUG1 "ignoring num lock"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
getClient()->keyUp(id2, mask2, button);
|
getClient()->keyUp(id2, mask2, button);
|
||||||
}
|
}
|
||||||
|
@ -684,6 +707,9 @@ CServerProxy::resetOptions()
|
||||||
if (m_heartRate >= 0.0) {
|
if (m_heartRate >= 0.0) {
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCNoop);
|
CProtocolUtil::writef(getOutputStream(), kMsgCNoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't ignore num lock
|
||||||
|
m_ignoreNumLock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -726,6 +752,9 @@ CServerProxy::setOptions()
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCNoop);
|
CProtocolUtil::writef(getOutputStream(), kMsgCNoop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (options[i] == kOptionIgnoreNumLock) {
|
||||||
|
m_ignoreNumLock = true;
|
||||||
|
}
|
||||||
if (id != kKeyModifierIDNull) {
|
if (id != kKeyModifierIDNull) {
|
||||||
m_modifierTranslationTable[id] =
|
m_modifierTranslationTable[id] =
|
||||||
static_cast<KeyModifierID>(options[i + 1]);
|
static_cast<KeyModifierID>(options[i + 1]);
|
||||||
|
|
|
@ -128,6 +128,7 @@ private:
|
||||||
SInt32 m_xMouse, m_yMouse;
|
SInt32 m_xMouse, m_yMouse;
|
||||||
|
|
||||||
bool m_ignoreMouse;
|
bool m_ignoreMouse;
|
||||||
|
bool m_ignoreNumLock;
|
||||||
|
|
||||||
KeyModifierID m_modifierTranslationTable[kKeyModifierIDLast];
|
KeyModifierID m_modifierTranslationTable[kKeyModifierIDLast];
|
||||||
double m_heartRate;
|
double m_heartRate;
|
||||||
|
|
|
@ -646,6 +646,9 @@ CConfig::getOptionName(OptionID id)
|
||||||
if (id == kOptionXTestXineramaUnaware) {
|
if (id == kOptionXTestXineramaUnaware) {
|
||||||
return "xtestIsXineramaUnaware";
|
return "xtestIsXineramaUnaware";
|
||||||
}
|
}
|
||||||
|
if (id == kOptionIgnoreNumLock) {
|
||||||
|
return "ignoreNumLock";
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +658,8 @@ CConfig::getOptionValue(OptionID id, OptionValue value)
|
||||||
if (id == kOptionHalfDuplexCapsLock ||
|
if (id == kOptionHalfDuplexCapsLock ||
|
||||||
id == kOptionHalfDuplexNumLock ||
|
id == kOptionHalfDuplexNumLock ||
|
||||||
id == kOptionScreenSaverSync ||
|
id == kOptionScreenSaverSync ||
|
||||||
id == kOptionXTestXineramaUnaware) {
|
id == kOptionXTestXineramaUnaware ||
|
||||||
|
id == kOptionIgnoreNumLock) {
|
||||||
return (value != 0) ? "true" : "false";
|
return (value != 0) ? "true" : "false";
|
||||||
}
|
}
|
||||||
if (id == kOptionModifierMapForShift ||
|
if (id == kOptionModifierMapForShift ||
|
||||||
|
@ -891,6 +895,10 @@ CConfig::readSectionScreens(std::istream& s)
|
||||||
addOption(screen, kOptionXTestXineramaUnaware,
|
addOption(screen, kOptionXTestXineramaUnaware,
|
||||||
parseBoolean(value));
|
parseBoolean(value));
|
||||||
}
|
}
|
||||||
|
else if (name == "ignoreNumLock") {
|
||||||
|
addOption(screen, kOptionIgnoreNumLock,
|
||||||
|
parseBoolean(value));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// unknown argument
|
// unknown argument
|
||||||
throw XConfigRead("unknown argument");
|
throw XConfigRead("unknown argument");
|
||||||
|
|
|
@ -55,6 +55,7 @@ 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");
|
static const OptionID kOptionScreenSaverSync = OPTION_CODE("SSVR");
|
||||||
static const OptionID kOptionXTestXineramaUnaware = OPTION_CODE("XTXU");
|
static const OptionID kOptionXTestXineramaUnaware = OPTION_CODE("XTXU");
|
||||||
|
static const OptionID kOptionIgnoreNumLock = OPTION_CODE("IGNL");
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
#undef OPTION_CODE
|
#undef OPTION_CODE
|
||||||
|
|
Loading…
Reference in New Issue