Send UTF-8 clipboard text directly rather than emulating keystrokes

This commit is contained in:
Cameron Gutman 2021-12-03 11:32:58 +03:00
commit 97a09e0571
6 changed files with 20 additions and 242 deletions

View file

@ -33,8 +33,7 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
m_RightButtonReleaseTimer(0),
m_DragTimer(0),
m_DragButton(0),
m_NumFingersDown(0),
m_ClipboardData()
m_NumFingersDown(0)
{
// System keys are always captured when running without a DE
if (!WMUtils::isRunningDesktopEnvironment()) {
@ -198,13 +197,6 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
}
m_MouseMoveTimer = SDL_AddTimer(pollingInterval, SdlInputHandler::mouseMoveTimerCallback, this);
// Initialize state used by the clipboard thread before we start it
SDL_AtomicSet(&m_ShutdownClipboardThread, 0);
m_ClipboardHasData = SDL_CreateCond();
m_ClipboardLock = SDL_CreateMutex();
m_ClipboardThread = SDL_CreateThread(SdlInputHandler::clipboardThreadProc, "Clipboard Sender", this);
}
SdlInputHandler::~SdlInputHandler()
@ -230,17 +222,6 @@ SdlInputHandler::~SdlInputHandler()
SDL_RemoveTimer(m_RightButtonReleaseTimer);
SDL_RemoveTimer(m_DragTimer);
// Wake up the clipboard thread to terminate it
SDL_AtomicSet(&m_ShutdownClipboardThread, 1);
SDL_CondBroadcast(m_ClipboardHasData);
// Wait for it to terminate
SDL_WaitThread(m_ClipboardThread, nullptr);
// Now we can safely clean up its resources
SDL_DestroyCond(m_ClipboardHasData);
SDL_DestroyMutex(m_ClipboardLock);
#if !SDL_VERSION_ATLEAST(2, 0, 9)
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
SDL_assert(!SDL_WasInit(SDL_INIT_HAPTIC));