-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): update core to handle reset context
- range check vk - split modifier test out to separate function
- Loading branch information
Showing
2 changed files
with
17 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
#pragma once | ||
|
||
#include <iterator> | ||
#include <keyman/keyman_core_api.h> | ||
#include "kmx_file.h" | ||
|
||
namespace km { | ||
namespace core { | ||
|
||
/** true for any vkeys which require a context reset (such as frame keys) */ | ||
extern bool vkey_to_contextreset[256]; | ||
|
||
/** @return true for any vkeys which require a context reset (such as frame keys) */ | ||
inline bool vkey_should_contextreset(km_core_virtual_key vk) { | ||
return ((vk < std::size(vkey_to_contextreset)) && vkey_to_contextreset[vk]); | ||
} | ||
|
||
/** @return true for modifier states that are involved with context reset */ | ||
inline bool modifier_should_contextreset(uint16_t modifier_state) { | ||
// ctrl or alt | ||
return (modifier_state & (K_CTRLFLAG | K_ALTFLAG | LCTRLFLAG | RCTRLFLAG | LALTFLAG | RALTFLAG)); | ||
} | ||
|
||
|
||
} | ||
} |