Add Linux impl of some keyboard inputs
This commit is contained in:
@@ -5,6 +5,17 @@
|
|||||||
|
|
||||||
namespace keyboardinput
|
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 sendKeyboardInput( QString input );
|
||||||
void sendKeyboardEnter();
|
void sendKeyboardEnter();
|
||||||
void sendKeyboardBackspace( const int count );
|
void sendKeyboardBackspace( const int count );
|
||||||
|
|||||||
@@ -4,17 +4,6 @@
|
|||||||
|
|
||||||
namespace keyboardinput
|
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.
|
Fills out an INPUT struct ip with scanCode and keyup status.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
namespace keyboardinput
|
namespace keyboardinput
|
||||||
{
|
{
|
||||||
static void sendKeyPressAndRelease( const KeySym keySymbol,
|
constexpr auto noModifier = 0;
|
||||||
const KeySym modifierSymbol )
|
void sendKeyPress( const KeySym keySymbol, const KeySym modifierSymbol )
|
||||||
{
|
{
|
||||||
Display* const display = XOpenDisplay( nullptr );
|
Display* const display = XOpenDisplay( nullptr );
|
||||||
|
|
||||||
@@ -50,23 +50,25 @@ void sendKeyboardInput( QString input )
|
|||||||
|
|
||||||
void sendKeyboardEnter()
|
void sendKeyboardEnter()
|
||||||
{
|
{
|
||||||
// noop
|
sendKeyPress( XK_ISO_Enter, noModifier );
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendKeyboardBackspace( const int count )
|
void sendKeyboardBackspace( const int count )
|
||||||
{
|
{
|
||||||
// noop
|
for ( int i = 0; i < count; ++i )
|
||||||
UNREFERENCED_PARAMETER( count );
|
{
|
||||||
|
sendKeyPress( XK_BackSpace, noModifier );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendKeyboardAltTab()
|
void sendKeyboardAltTab()
|
||||||
{
|
{
|
||||||
sendKeyPressAndRelease( XK_Tab, XK_Alt_L );
|
sendKeyPress( XK_Tab, XK_Alt_L );
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendKeyboardAltEnter()
|
void sendKeyboardAltEnter()
|
||||||
{
|
{
|
||||||
// noop
|
sendKeyPress( XK_ISO_Enter, XK_Alt_L );
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendMediaNextSong()
|
void sendMediaNextSong()
|
||||||
|
|||||||
Reference in New Issue
Block a user