custom keybinds multiple keypress fix. [add backslash to Parser] (#513)

* fixed input sending bug not properly releasing keys

* updated to ovr 1.12.5

* added disable oculus api button experimental

* small refactor and fix float and bool bugs

* added nokeyup events to modifier keys when read in, and adjusted  token send to have proper logic

* fixed literal held issue

* added backslash

* fixed sender token parser

* updated version string to dev whoops

* added backslash to documentation for keyboard input
This commit is contained in:
ykeara
2020-09-03 11:08:37 -05:00
committed by GitHub
parent 7d0823f83c
commit 4fb026958e
7 changed files with 23 additions and 32 deletions
+1
View File
@@ -78,6 +78,7 @@
| Keypad Minus | `KPMINUS` |
| Keypad Plus | `KPPLUS` |
| Enter | `ENTER` |
| Backslash | `BACKSLASH` |
### Misc symbols
@@ -70,6 +70,7 @@ A token is either a modifier symbol, literal symbol, symbol sequence or space ch
| Keypad Minus | `KPMINUS` |
| Keypad Plus | `KPPLUS` |
| Enter | `ENTER` |
| Backslash | `BACKSLASH` |
### Misc symbols
+7
View File
@@ -164,6 +164,10 @@ std::optional<Token> checkIfLegalCapitalLiteral( std::string input ) noexcept
{
return Token::KEY_ENTER;
}
if ( input == "BACKSLASH" )
{
return Token::KEY_BACKSLASH;
}
return std::nullopt;
}
@@ -182,6 +186,7 @@ std::vector<Token>
}
if ( const auto c = getModifier( *ch ); c.has_value() )
{
tokens.push_back( Token::TOKEN_NO_KEYUP_NEXT );
tokens.push_back( *c );
continue;
}
@@ -517,6 +522,8 @@ bool isLiteral( const Token token ) noexcept
return true;
case Token::KEY_ENTER:
return true;
case Token::KEY_BACKSLASH:
return true;
default:
return false;
+1
View File
@@ -43,6 +43,7 @@ enum class Token
KEY_KPMINUS,
KEY_KPPLUS,
KEY_ENTER,
KEY_BACKSLASH,
// Misc tokens
TOKEN_NEW_SEQUENCE,
+9 -32
View File
@@ -18,29 +18,26 @@ inline void sendTokensAsInput( const std::vector<Token> tokens )
initOsSystems();
std::vector<Token> heldInputs = {};
bool noKeyUp = false;
for ( const auto& token : tokens )
{
// maintained for support w/o altering other binds/parsers
if ( token == Token::TOKEN_NO_KEYUP_NEXT )
{
noKeyUp = true;
continue;
}
// Modifiers always push to held
if ( isModifier( token ) )
{
sendKeyPress( token, KeyStatus::Down );
if ( noKeyUp )
{
heldInputs.push_back( token );
}
else
{
sendKeyPress( token, KeyStatus::Up );
}
heldInputs.push_back( token );
continue;
}
if ( isLiteral( token ) )
{
sendKeyPress( token, KeyStatus::Down );
sendKeyPress( token, KeyStatus::Up );
continue;
}
if ( token == Token::TOKEN_NEW_SEQUENCE )
{
for ( const auto& h : heldInputs )
@@ -50,26 +47,6 @@ inline void sendTokensAsInput( const std::vector<Token> tokens )
heldInputs.clear();
continue;
}
if ( isLiteral( token ) )
{
sendKeyPress( token, KeyStatus::Down );
if ( noKeyUp )
{
heldInputs.push_back( token );
}
else
{
sendKeyPress( token, KeyStatus::Up );
}
continue;
}
if ( token != Token::TOKEN_NO_KEYUP_NEXT )
{
noKeyUp = false;
continue;
}
}
if ( !heldInputs.empty() )
+2
View File
@@ -150,6 +150,8 @@ unsigned int tokenToKeySym( const Token token )
return XK_KP_Add;
case Token::KEY_ENTER:
return XK_Return;
case Token::KEY_BACKSLASH:
return XK_backslash;
case Token::MODIFIER_CTRL:
return XK_Control_L;
+2
View File
@@ -94,6 +94,8 @@ WORD convertToVirtualKeycode( const Token token )
return VK_LWIN;
case Token::MODIFIER_TILDE:
return VK_OEM_3;
case Token::KEY_BACKSLASH:
return VK_OEM_5;
default:
return 0;