mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
Fix bug getting ANSI clipboard text on Windows
Sometimes the clipboard content is in CF_TEXT format and there is no implicit CF_UNICODETEXT conversion.
This commit is contained in:
parent
bea61fab88
commit
dab8c96fa8
@ -42,9 +42,9 @@ std::string ClipboardWin32::getText(DisplayHandle hwnd)
|
||||
if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
|
||||
if (open_clipboard((HWND)hwnd)) {
|
||||
HGLOBAL hglobal = GetClipboardData(CF_UNICODETEXT);
|
||||
if (hglobal != NULL) {
|
||||
if (hglobal) {
|
||||
LPWSTR lpstr = static_cast<LPWSTR>(GlobalLock(hglobal));
|
||||
if (lpstr != NULL) {
|
||||
if (lpstr) {
|
||||
text = base::to_utf8(lpstr).c_str();
|
||||
GlobalUnlock(hglobal);
|
||||
}
|
||||
@ -52,6 +52,19 @@ std::string ClipboardWin32::getText(DisplayHandle hwnd)
|
||||
CloseClipboard();
|
||||
}
|
||||
}
|
||||
else if (IsClipboardFormatAvailable(CF_TEXT)) {
|
||||
if (open_clipboard((HWND)hwnd)) {
|
||||
HGLOBAL hglobal = GetClipboardData(CF_TEXT);
|
||||
if (hglobal) {
|
||||
LPSTR lpstr = static_cast<LPSTR>(GlobalLock(hglobal));
|
||||
if (lpstr) {
|
||||
text = lpstr;
|
||||
GlobalUnlock(hglobal);
|
||||
}
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user