From dafc977bbe759a06fd22fc49453ace92d5d36c8c Mon Sep 17 00:00:00 2001 From: Vasily Date: Sun, 21 Apr 2019 21:28:27 +0200 Subject: [PATCH] Add Linux sendKeyboardInput This implementation has several problems. 1) It only really deals with Latin1 characters. This is the same as the Windows implementatino. 2) It doesn't handle modifier keys at all. This is also a problem with the Win implementation. This is an interim solution until a unified strategy can be made for both Windows/Linux. --- .../keyboardinput/KeyboardInputX11.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputX11.cpp b/src/tabcontrollers/keyboardinput/KeyboardInputX11.cpp index 40f93da..18d3bce 100644 --- a/src/tabcontrollers/keyboardinput/KeyboardInputX11.cpp +++ b/src/tabcontrollers/keyboardinput/KeyboardInputX11.cpp @@ -3,10 +3,7 @@ #include #include #include - -// Used to get the compiler to shut up about C4100: unreferenced formal -// parameter. The cast is to get GCC to shut up about it. -#define UNREFERENCED_PARAMETER( P ) static_cast( ( P ) ) +#include namespace keyboardinput { @@ -44,8 +41,16 @@ void sendKeyPress( const KeySym keySymbol, const KeySym modifierSymbol ) void sendKeyboardInput( QString input ) { - // noop - UNREFERENCED_PARAMETER( input ); + std::vector characters = { 0 }; + for ( const auto& character : input ) + { + characters.push_back( character.toLatin1() ); + } + + for ( const auto character : characters ) + { + sendKeyPress( XStringToKeysym( &character ), noModifier ); + } } void sendKeyboardEnter()