Add Linux impl of some keyboard inputs

This commit is contained in:
Vasily
2019-04-22 09:56:50 +02:00
committed by username223
parent 860eca1956
commit 86ec4975fc
3 changed files with 20 additions and 18 deletions
@@ -5,6 +5,17 @@
namespace keyboardinput
{
/*!
Represents the state of a keyboard button press. Can be either Up or Down.
Implemented because neither Qt nor Windows.h included a sensible key state enum.
*/
enum class KeyStatus
{
Up,
Down,
};
void sendKeyboardInput( QString input );
void sendKeyboardEnter();
void sendKeyboardBackspace( const int count );
@@ -4,17 +4,6 @@
namespace keyboardinput
{
/*!
Represents the state of a keyboard button press. Can be either Up or Down.
Implemented because neither Qt nor Windows.h included a sensible key state enum.
*/
enum class KeyStatus
{
Up,
Down,
};
/*!
Fills out an INPUT struct ip with scanCode and keyup status.
*/
@@ -10,8 +10,8 @@
namespace keyboardinput
{
static void sendKeyPressAndRelease( const KeySym keySymbol,
const KeySym modifierSymbol )
constexpr auto noModifier = 0;
void sendKeyPress( const KeySym keySymbol, const KeySym modifierSymbol )
{
Display* const display = XOpenDisplay( nullptr );
@@ -50,23 +50,25 @@ void sendKeyboardInput( QString input )
void sendKeyboardEnter()
{
// noop
sendKeyPress( XK_ISO_Enter, noModifier );
}
void sendKeyboardBackspace( const int count )
{
// noop
UNREFERENCED_PARAMETER( count );
for ( int i = 0; i < count; ++i )
{
sendKeyPress( XK_BackSpace, noModifier );
}
}
void sendKeyboardAltTab()
{
sendKeyPressAndRelease( XK_Tab, XK_Alt_L );
sendKeyPress( XK_Tab, XK_Alt_L );
}
void sendKeyboardAltEnter()
{
// noop
sendKeyPress( XK_ISO_Enter, XK_Alt_L );
}
void sendMediaNextSong()