Fixed Unicode__ clipboard issue

This commit is contained in:
Mirek Fidler 2022-04-11 13:05:51 +02:00
parent 01119b24bd
commit 2db6c3dfd9
4 changed files with 4 additions and 26 deletions

View file

@ -113,16 +113,6 @@ const void *GetInternalDropPtr__()
return sInternalPtr;
}
String Unicode__(const WString& w)
{
return String((const char *)~w, 2 * w.GetLength());
}
WString Unicode__(const String& s)
{
return WString((const wchar *)~s, s.GetLength() / 2);
}
void GuiPlatformAdjustDragImage(ImageBuffer& b);
Image MakeDragImage(const Image& arrow, Image sample)

View file

@ -305,9 +305,6 @@ public:
PasteClip();
};
String Unicode__(const WString& w);
WString Unicode__(const String& s);
void GuiPlatformAdjustDragImage(ImageBuffer& b);
Image MakeDragImage(const Image& arrow, Image sample);

View file

@ -278,7 +278,8 @@ static String sText(const Value& data)
static String sWText(const Value& data)
{
return Unicode__(WString(data));
Vector<char16> h = ToUtf16(WString(data));
return String(h.begin(), sizeof(char16) * h.GetCount());
}
void Append(VectorMap<String, ClipData>& data, const String& text)
@ -298,7 +299,7 @@ String GetTextClip(const WString& text, const String& fmt)
if(fmt == "text")
return text.ToString();
if(fmt == "wtext")
return Unicode__(text);
return sWText(text);
return Null;
}
@ -307,7 +308,7 @@ String GetTextClip(const String& text, const String& fmt)
if(fmt == "text")
return text;
if(fmt == "wtext")
return Unicode__(text.ToWString());
return sWText(text.ToWString());
return Null;
}

View file

@ -260,8 +260,6 @@ String GetString(PasteClip& clip)
return ~clip;
if(clip.Accept("UTF8_STRING"))
return ToUtf32(~clip).ToString();
if(clip.Accept("text/unicode"))
return Unicode__(~clip).ToString();
return Null;
}
@ -270,8 +268,6 @@ WString GetWString(PasteClip& clip)
GuiLock __;
if(clip.Accept("UTF8_STRING"))
return ToUtf32(~clip);
if(clip.Accept("text/unicode"))
return Unicode__(~clip);
if(clip.Accept("STRING") || clip.Accept("text/plain"))
return ToUnicode(~clip, CHARSET_ISO8859_1);
return Null;
@ -284,8 +280,6 @@ String GetTextClip(const WString& text, const String& fmt)
return text.ToString();
if(fmt == "UTF8_STRING")
return ToUtf8(text);
if(fmt == "text/unicode")
return Unicode__(text);
return Null;
}
@ -296,8 +290,6 @@ String GetTextClip(const String& text, const String& fmt)
return text;
if(fmt == "UTF8_STRING")
return ToUtf8(text.ToWString());
if(fmt == "text/unicode")
return Unicode__(text.ToWString());
return Null;
}
@ -313,7 +305,6 @@ void Append(VectorMap<String, ClipData>& data, const String& text) // optimize
data.GetAdd("STRING", text);
data.GetAdd("text/plain", text);
data.GetAdd("UTF8_STRING", ToUtf8(text.ToWString()));
data.GetAdd("text/unicode", Unicode__(text.ToWString()));
}
void Append(VectorMap<String, ClipData>& data, const WString& text) // optimize
@ -322,7 +313,6 @@ void Append(VectorMap<String, ClipData>& data, const WString& text) // optimize
data.GetAdd("STRING", text.ToString());
data.GetAdd("text/plain", text.ToString());
data.GetAdd("UTF8_STRING", ToUtf8(text));
data.GetAdd("text/unicode", Unicode__(text));
}
bool IsClipboardAvailable(const char *fmt)