summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2023-11-16 15:46:16 +0800
committerErik Kundiman <erik@megapahit.org>2023-11-16 15:46:16 +0800
commit1ce818b20909942eb90fa88d54856bd9d08d2719 (patch)
tree1c2692fe80c77514a0c8fddd976121cfa504cce6 /indra/llwindow
parent33691f2fa52e3b9c2146391413234472769b13ed (diff)
Clipboard implementation using SDL
For now it's when there's no GTK, to minimise diff. They should all just use SDL.
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindowsdl.cpp13
1 files changed, 10 insertions, 3 deletions
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()