diff --git a/client/eventsSDL/InputSourceKeyboard.cpp b/client/eventsSDL/InputSourceKeyboard.cpp index 7c953063c..6fd1c5bb3 100644 --- a/client/eventsSDL/InputSourceKeyboard.cpp +++ b/client/eventsSDL/InputSourceKeyboard.cpp @@ -17,6 +17,7 @@ #include "../gui/EventDispatcher.h" #include "../gui/ShortcutHandler.h" +#include #include #include @@ -30,13 +31,21 @@ InputSourceKeyboard::InputSourceKeyboard() void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key) { - if(key.repeat != 0) - return; // ignore periodic event resends - if (SDL_IsTextInputActive() == SDL_TRUE) { + if(key.keysym.sym == SDLK_v) { + std::string clipboardContent = SDL_GetClipboardText(); + boost::erase_all(clipboardContent, "\r"); + boost::erase_all(clipboardContent, "\n"); + GH.events().dispatchTextInput(clipboardContent); + return; + } + if (key.keysym.sym >= ' ' && key.keysym.sym < 0x80) return; // printable character - will be handled as text input + } else { + if(key.repeat != 0) + return; // ignore periodic event resends } assert(key.state == SDL_PRESSED);