diff options
| author | Manolo Gouy <Manolo> | 2010-12-11 16:25:59 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-12-11 16:25:59 +0000 |
| commit | fa2aea107f3855433d3f1391c75decaee6bf62c6 (patch) | |
| tree | 25aafbede9be8ce94cef4f6d7b73f2dccf897f3e /src | |
| parent | 97149d19a5b8a2a36684b55d85b854bdc7588f7c (diff) | |
Fixed DnD of text to non FLTK applications expecting CP1252 data.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8010 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_dnd_win32.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/fl_dnd_win32.cxx b/src/fl_dnd_win32.cxx index ffe2f7ccc..2deadd37d 100644 --- a/src/fl_dnd_win32.cxx +++ b/src/fl_dnd_win32.cxx @@ -416,16 +416,17 @@ public: delete this; return nTemp; } - // GetData currently allows ASCII text through Global Memory only + // GetData currently allows UNICODE text through Global Memory only HRESULT STDMETHODCALLTYPE GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium ) { if ((pformatetcIn->dwAspect & DVASPECT_CONTENT) && (pformatetcIn->tymed & TYMED_HGLOBAL) && - (pformatetcIn->cfFormat == CF_TEXT)) + (pformatetcIn->cfFormat == CF_UNICODETEXT)) { - HGLOBAL gh = GlobalAlloc( GHND, fl_selection_length[0]+1 ); + int utf16_len = fl_utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], 0, 0); + HGLOBAL gh = GlobalAlloc( GHND, utf16_len * 2 + 2 ); char *pMem = (char*)GlobalLock( gh ); - memmove( pMem, fl_selection_buffer[0], fl_selection_length[0] ); - pMem[ fl_selection_length[0] ] = 0; + fl_utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], (unsigned short*)pMem, utf16_len * 2); + pMem[ 2*utf16_len ] = 0; // HGLOBAL gh = GlobalAlloc( GHND| GMEM_SHARE, // (fl_selection_length[0]+4) * sizeof(short) // + sizeof(DROPFILES)); @@ -467,7 +468,7 @@ public: { if ((pformatetc->dwAspect & DVASPECT_CONTENT) && (pformatetc->tymed & TYMED_HGLOBAL) && - (pformatetc->cfFormat == CF_TEXT)) + (pformatetc->cfFormat == CF_UNICODETEXT)) return S_OK; return DV_E_FORMATETC; } |
