Skip to content

Commit

Permalink
Not copying key names
Browse files Browse the repository at this point in the history
  • Loading branch information
houmain committed Jan 21, 2021
1 parent 3168d85 commit d66bdd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/config/Key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ std::string_view get_key_name(const Key& key) {
case Key::Virtual8: return "Virtual8";

case Key::None:
case Key::Count:
break;
}
return { };
Expand All @@ -181,12 +180,11 @@ Key get_key_by_name(std::string_view name) {
// generate vector of all key name/key pairs, sorted by name
static const auto s_key_map =
[]() {
const auto count = static_cast<int>(Key::Count);
auto map = std::vector<std::pair<std::string, Key>>();
map.reserve(count);
auto map = std::vector<std::pair<std::string_view, Key>>();
map.reserve(200);

for (auto k = 1; k < count; k++) {
const auto key = static_cast<Key>(k);
for (auto key_code = 1; key_code < 0xFFFF; ++key_code) {
const auto key = static_cast<Key>(key_code);
auto name = get_key_name(key);
if (!name.empty())
map.emplace_back(name, key);
Expand Down
2 changes: 0 additions & 2 deletions src/config/Key.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ enum class Key : KeyCode {
Virtual6,
Virtual7,
Virtual8,

Count,
};

std::string_view get_key_name(const Key& key);
Expand Down

0 comments on commit d66bdd7

Please sign in to comment.