mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-16 21:30:06 +00:00
Add support for pasting clipboard text
This commit is contained in:
@@ -87,6 +87,30 @@ void SdlInputHandler::performPendingSpecialKeyCombo()
|
||||
|
||||
SDL_MinimizeWindow(m_Window);
|
||||
break;
|
||||
|
||||
case KeyComboPasteText:
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Detected paste text combo");
|
||||
const char* text = SDL_GetClipboardText();
|
||||
if (text != nullptr) {
|
||||
// Reset pending key combo before pasting,
|
||||
// otherwise it will ignore our keypresses.
|
||||
m_PendingKeyCombo = KeyComboMax;
|
||||
|
||||
// Send the text and free it as required by SDL
|
||||
sendText(text);
|
||||
SDL_free((void*)text);
|
||||
}
|
||||
else {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"No text in clipboard to paste!");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
// Reset pending key combo
|
||||
|
||||
Reference in New Issue
Block a user