From 1ce818b20909942eb90fa88d54856bd9d08d2719 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 16 Nov 2023 15:46:16 +0800 Subject: Clipboard implementation using SDL For now it's when there's no GTK, to minimise diff. They should all just use SDL. --- indra/llwindow/llwindowsdl.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/llwindow/llwindowsdl.cpp') diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 5626707e70..d6afd1853e 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1407,17 +1407,24 @@ BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text) BOOL LLWindowSDL::isClipboardTextAvailable() { - return FALSE; // unsupported + return SDL_HasClipboardText(); } BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { - return FALSE; // unsupported + auto data = SDL_GetClipboardText(); + if (data) + { + dst = LLWString(utf8str_to_wstring(data)); + SDL_free(data); + return TRUE; + } + return FALSE; } BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) { - return FALSE; // unsupported + return !SDL_SetClipboardText(wstring_to_utf8str(s).c_str()); } BOOL LLWindowSDL::isPrimaryTextAvailable() -- cgit v1.2.3