From 4ffb33f0aeb4efb27617139b33dc493d230ef4dd Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 23 Apr 2014 10:18:03 +0400 Subject: [PATCH] win32 clipboard support working in editors --- src/dlangui/platforms/windows/winapp.d | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index 36d43646..cdd79ca8 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -537,12 +537,12 @@ class Win32Platform : Platform { dstring res = null; if (mouseBuffer) return res; // not supporetd under win32 - if (!IsClipboardFormatAvailable(CF_TEXT)) + if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) return res; if (!OpenClipboard(NULL)) return res; - HGLOBAL hglb = GetClipboardData(CF_TEXT); + HGLOBAL hglb = GetClipboardData(CF_UNICODETEXT); if (hglb != NULL) { LPTSTR lptstr = cast(LPTSTR)GlobalLock(hglb); @@ -556,11 +556,13 @@ class Win32Platform : Platform { } CloseClipboard(); + //Log.d("getClipboardText(", res, ")"); return res; } /// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux) override void setClipboardText(dstring text, bool mouseBuffer = false) { + //Log.d("setClipboardText(", text, ")"); if (text.length < 1 || mouseBuffer) return; if (!OpenClipboard(NULL)) @@ -577,9 +579,9 @@ class Win32Platform : Platform { for (int i = 0; i < w.length; i++) { lptstrCopy[i] = w[i]; } - lptstrCopy[w.length - 1] = 0; + lptstrCopy[w.length] = 0; GlobalUnlock(hglbCopy); - SetClipboardData(CF_TEXT, hglbCopy); + SetClipboardData(CF_UNICODETEXT, hglbCopy); CloseClipboard(); }