Reorganised KeyResource #2765

This commit is contained in:
Jerry (Xinyu Hou) 2016-05-05 14:22:31 +01:00
parent 6d93a28c2e
commit 6d2040b698
6 changed files with 20 additions and 20 deletions

View File

@ -18,8 +18,8 @@ if (WIN32)
file(GLOB headers "MSWindows*.h")
file(GLOB sources "MSWindows*.cpp")
elseif (APPLE)
file(GLOB headers "OSX*.h" "*KeyResource.h")
file(GLOB sources "OSX*.cpp" "OSX*.m" "*KeyResource.cpp")
file(GLOB headers "OSX*.h")
file(GLOB sources "OSX*.cpp" "OSX*.m")
elseif (UNIX)
file(GLOB headers "XWindows*.h")
file(GLOB sources "XWindows*.cpp")

View File

@ -17,7 +17,7 @@
*/
#include "platform/OSXKeyState.h"
#include "platform/UchrKeyResource.h"
#include "platform/OSXUchrKeyResource.h"
#include "arch/Arch.h"
#include "base/Log.h"
@ -440,7 +440,7 @@ OSXKeyState::getKeyMap(synergy::KeyMap& keyMap)
resource = CFDataGetBytePtr(resourceRef);
if (layoutValid) {
UchrKeyResource uchr(resource, keyboardType);
OSXUchrKeyResource uchr(resource, keyboardType);
if (uchr.isValid()) {
LOG((CLOG_DEBUG1 "using uchr resource for group %d", g));
getKeyMap(keyMap, g, uchr);

View File

@ -15,15 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "platform/UchrKeyResource.h"
#include "platform/OSXUchrKeyResource.h"
#include <Carbon/Carbon.h>
//
// OSXKeyState::UchrKeyResource
// OSXUchrKeyResource
//
UchrKeyResource::UchrKeyResource(const void* resource,
OSXUchrKeyResource::OSXUchrKeyResource(const void* resource,
UInt32 keyboardType) :
m_m(NULL),
m_cti(NULL),
@ -93,32 +93,32 @@ UchrKeyResource::UchrKeyResource(const void* resource,
}
bool
UchrKeyResource::isValid() const
OSXUchrKeyResource::isValid() const
{
return (m_m != NULL);
}
UInt32
UchrKeyResource::getNumModifierCombinations() const
OSXUchrKeyResource::getNumModifierCombinations() const
{
// only 32 (not 256) because the righthanded modifier bits are ignored
return 32;
}
UInt32
UchrKeyResource::getNumTables() const
OSXUchrKeyResource::getNumTables() const
{
return m_cti->keyToCharTableCount;
}
UInt32
UchrKeyResource::getNumButtons() const
OSXUchrKeyResource::getNumButtons() const
{
return m_cti->keyToCharTableSize;
}
UInt32
UchrKeyResource::getTableForModifier(UInt32 mask) const
OSXUchrKeyResource::getTableForModifier(UInt32 mask) const
{
if (mask >= m_m->modifiersCount) {
return m_m->defaultTableNum;
@ -129,7 +129,7 @@ UchrKeyResource::getTableForModifier(UInt32 mask) const
}
KeyID
UchrKeyResource::getKey(UInt32 table, UInt32 button) const
OSXUchrKeyResource::getKey(UInt32 table, UInt32 button) const
{
assert(table < getNumTables());
assert(button < getNumButtons());
@ -165,7 +165,7 @@ UchrKeyResource::getKey(UInt32 table, UInt32 button) const
}
bool
UchrKeyResource::getDeadKey(
OSXUchrKeyResource::getDeadKey(
KeySequence& keys, UInt16 index) const
{
if (m_sri == NULL || index >= m_sri->keyStateRecordCount) {
@ -208,7 +208,7 @@ UchrKeyResource::getDeadKey(
}
bool
UchrKeyResource::getKeyRecord(
OSXUchrKeyResource::getKeyRecord(
KeySequence& keys, UInt16 index, UInt16& state) const
{
const UInt8* base = reinterpret_cast<const UInt8*>(m_resource);
@ -272,7 +272,7 @@ UchrKeyResource::getKeyRecord(
}
bool
UchrKeyResource::addSequence(
OSXUchrKeyResource::addSequence(
KeySequence& keys, UCKeyCharSeq c) const
{
if ((c & kUCKeyOutputTestForIndexMask) == kUCKeyOutputSequenceIndexMask) {

View File

@ -18,15 +18,15 @@
#pragma once
#include "synergy/KeyState.h"
#include "platform/IKeyResource.h"
#include "synergy/IKeyResource.h"
#include <Carbon/Carbon.h>
typedef TISInputSourceRef KeyLayout;
class UchrKeyResource : public IKeyResource {
class OSXUchrKeyResource : public IKeyResource {
public:
UchrKeyResource(const void*, UInt32 keyboardType);
OSXUchrKeyResource(const void*, UInt32 keyboardType);
// KeyResource overrides
virtual bool isValid() const;

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "platform/IKeyResource.h"
#include "synergy/IKeyResource.h"
#include <Carbon/Carbon.h>