From 6d2040b698c406332d72774cb89181dd95eef496 Mon Sep 17 00:00:00 2001 From: "Jerry (Xinyu Hou)" Date: Thu, 5 May 2016 14:22:31 +0100 Subject: [PATCH] Reorganised KeyResource #2765 --- src/lib/platform/CMakeLists.txt | 4 ++-- src/lib/platform/OSXKeyState.cpp | 4 ++-- ...KeyResource.cpp => OSXUchrKeyResource.cpp} | 24 +++++++++---------- ...UchrKeyResource.h => OSXUchrKeyResource.h} | 6 ++--- .../{platform => synergy}/IKeyResource.cpp | 2 +- src/lib/{platform => synergy}/IKeyResource.h | 0 6 files changed, 20 insertions(+), 20 deletions(-) rename src/lib/platform/{UchrKeyResource.cpp => OSXUchrKeyResource.cpp} (92%) rename src/lib/platform/{UchrKeyResource.h => OSXUchrKeyResource.h} (92%) rename src/lib/{platform => synergy}/IKeyResource.cpp (99%) rename src/lib/{platform => synergy}/IKeyResource.h (100%) diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt index e5497e8e..b5c747b7 100644 --- a/src/lib/platform/CMakeLists.txt +++ b/src/lib/platform/CMakeLists.txt @@ -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") diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index 8aa8163a..10491f5f 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -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); diff --git a/src/lib/platform/UchrKeyResource.cpp b/src/lib/platform/OSXUchrKeyResource.cpp similarity index 92% rename from src/lib/platform/UchrKeyResource.cpp rename to src/lib/platform/OSXUchrKeyResource.cpp index 21480988..7c362d70 100644 --- a/src/lib/platform/UchrKeyResource.cpp +++ b/src/lib/platform/OSXUchrKeyResource.cpp @@ -15,15 +15,15 @@ * along with this program. If not, see . */ -#include "platform/UchrKeyResource.h" +#include "platform/OSXUchrKeyResource.h" #include // -// 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(m_resource); @@ -272,7 +272,7 @@ UchrKeyResource::getKeyRecord( } bool -UchrKeyResource::addSequence( +OSXUchrKeyResource::addSequence( KeySequence& keys, UCKeyCharSeq c) const { if ((c & kUCKeyOutputTestForIndexMask) == kUCKeyOutputSequenceIndexMask) { diff --git a/src/lib/platform/UchrKeyResource.h b/src/lib/platform/OSXUchrKeyResource.h similarity index 92% rename from src/lib/platform/UchrKeyResource.h rename to src/lib/platform/OSXUchrKeyResource.h index 67107ee5..316bd574 100644 --- a/src/lib/platform/UchrKeyResource.h +++ b/src/lib/platform/OSXUchrKeyResource.h @@ -18,15 +18,15 @@ #pragma once #include "synergy/KeyState.h" -#include "platform/IKeyResource.h" +#include "synergy/IKeyResource.h" #include 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; diff --git a/src/lib/platform/IKeyResource.cpp b/src/lib/synergy/IKeyResource.cpp similarity index 99% rename from src/lib/platform/IKeyResource.cpp rename to src/lib/synergy/IKeyResource.cpp index 81e86a93..a692c776 100644 --- a/src/lib/platform/IKeyResource.cpp +++ b/src/lib/synergy/IKeyResource.cpp @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -#include "platform/IKeyResource.h" +#include "synergy/IKeyResource.h" #include diff --git a/src/lib/platform/IKeyResource.h b/src/lib/synergy/IKeyResource.h similarity index 100% rename from src/lib/platform/IKeyResource.h rename to src/lib/synergy/IKeyResource.h