mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-10 21:03:31 +00:00
BACKENDS: CLIPBOARD: Improve usage for SDL & Android.
- Fix possible issue for setting text inside clipboard for SDL. - Always return a decoded string when from UTF-8 in Android when fetch clipboard.
This commit is contained in:
parent
d41d0e9b22
commit
29b6274e67
@ -300,11 +300,7 @@ Common::U32String JNI::getTextFromClipboard() {
|
||||
Common::String text = convertFromJString(env, javaText, "UTF-8");
|
||||
env->DeleteLocalRef(javaText);
|
||||
|
||||
if (getCurrentCharset() == "UTF-32") {
|
||||
return text.decode();
|
||||
}
|
||||
|
||||
return Common::U32String(text);
|
||||
return text.decode();
|
||||
}
|
||||
|
||||
bool JNI::setTextInClipboard(const Common::U32String &text) {
|
||||
|
@ -508,14 +508,15 @@ Common::U32String OSystem_SDL::getTextFromClipboard() {
|
||||
}
|
||||
|
||||
bool OSystem_SDL::setTextInClipboard(const Common::U32String &text) {
|
||||
// The encoding we need to use is UTF-8. Assume we currently have the
|
||||
// current TranslationManager encoding or ISO-8859-1.
|
||||
char *utf8_text = (char *)text.encode().c_str();
|
||||
// The encoding we need to use is UTF-8.
|
||||
Common::String textStr = text.encode();
|
||||
char *utf8_text = (char *)textStr.c_str();
|
||||
|
||||
if (utf8_text) {
|
||||
int status = SDL_SetClipboardText(utf8_text);
|
||||
return status == 0;
|
||||
}
|
||||
return SDL_SetClipboardText(text.encode().c_str()) == 0;
|
||||
return SDL_SetClipboardText(textStr.c_str()) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user