diff options
| -rw-r--r-- | include/m_utils.h | 10 | ||||
| -rw-r--r-- | libs/win32/mir_core.lib | bin | 498950 -> 499650 bytes | |||
| -rw-r--r-- | libs/win64/mir_core.lib | bin | 504250 -> 504964 bytes | |||
| -rw-r--r-- | src/mir_core/src/Windows/clipboard.cpp | 64 | ||||
| -rw-r--r-- | src/mir_core/src/mir_core.def | 3 | ||||
| -rw-r--r-- | src/mir_core/src/mir_core64.def | 3 |
6 files changed, 47 insertions, 33 deletions
diff --git a/include/m_utils.h b/include/m_utils.h index 553522bdcf..9ba9485c8c 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -80,11 +80,13 @@ struct MIR_CORE_EXPORT MClipUnicode : public MClipData void Copy() const override;
};
-struct MClipUtf8 : public MClipUnicode
+struct MIR_CORE_EXPORT MClipUtf8 : public MClipData
{
- explicit MClipUtf8(const char *pszString) :
- MClipUnicode(Utf2T(pszString))
- {}
+ const char *m_szString;
+
+ explicit MClipUtf8(const char *pszString);
+
+ void Copy() const override;
};
struct MIR_CORE_EXPORT MClipRtf : public MClipData
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex 49307cbad9..850b1a9be0 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex b5a51004fe..513f95da7a 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/src/mir_core/src/Windows/clipboard.cpp b/src/mir_core/src/Windows/clipboard.cpp index 13c52a5c44..61ddef6875 100644 --- a/src/mir_core/src/Windows/clipboard.cpp +++ b/src/mir_core/src/Windows/clipboard.cpp @@ -26,22 +26,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static UINT g_iRtf = 0; +static void sttCopyAnsi(const char *pszString) +{ + if (size_t cbLen = mir_strlen(pszString)) + if (HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, cbLen + 1)) { + mir_strcpy((char *)GlobalLock(hData), pszString); + GlobalUnlock(hData); + SetClipboardData(CF_TEXT, hData); + } +} + +static void sttCopyUnicode(const wchar_t *pwszString) +{ + if (size_t cbLen = mir_wstrlen(pwszString)) + if (HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (cbLen + 1) * sizeof(wchar_t))) { + mir_wstrcpy((wchar_t *)GlobalLock(hData), pwszString); + GlobalUnlock(hData); + SetClipboardData(CF_UNICODETEXT, hData); + } +} + +///////////////////////////////////////////////////////////////////////////////////////// + MClipAnsi::MClipAnsi(const char *pszString) : m_szString(pszString) {} void MClipAnsi::Copy() const { - size_t cbLen = mir_strlen(m_szString); - if (!cbLen) - return; - - HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, cbLen + 1); - if (hData) { - mir_strcpy((char *)GlobalLock(hData), m_szString); - GlobalUnlock(hData); - SetClipboardData(CF_TEXT, hData); - } + sttCopyAnsi(m_szString); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -52,19 +65,10 @@ MClipRtf::MClipRtf(const char *pszString) : void MClipRtf::Copy() const { - size_t cbLen = mir_strlen(m_szString); - if (!cbLen) - return; - if (g_iRtf == 0) g_iRtf = RegisterClipboardFormatW(CF_RTF); - HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, cbLen + 1); - if (hData) { - mir_strcpy((char *)GlobalLock(hData), m_szString); - GlobalUnlock(hData); - SetClipboardData(g_iRtf, hData); - } + sttCopyAnsi(m_szString); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -75,16 +79,18 @@ MClipUnicode::MClipUnicode(const wchar_t *pwszString) : void MClipUnicode::Copy() const { - size_t cbLen = mir_wstrlen(m_wszString); - if (!cbLen) - return; + sttCopyUnicode(m_wszString); +} + +///////////////////////////////////////////////////////////////////////////////////////// - HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (cbLen + 1) * sizeof(wchar_t)); - if (hData) { - mir_wstrcpy((wchar_t *)GlobalLock(hData), m_wszString); - GlobalUnlock(hData); - SetClipboardData(CF_UNICODETEXT, hData); - } +MClipUtf8::MClipUtf8(const char *pszString) : + m_szString(pszString) +{} + +void MClipUtf8::Copy() const +{ + sttCopyUnicode(Utf2T(m_szString)); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 5c192dbef0..ab3a5ec23d 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1580,3 +1580,6 @@ _newStrW@4 @1789 NONAME ?SetTooltip@CCtrlMButton@@QAEXPBD@Z @1805 NONAME
_db_event_delivered@8 @1806 NONAME
?Utils_GenerateUUID@@YG?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@XZ @1807 NONAME
+??0MClipUtf8@@QAE@PBD@Z @1808 NONAME
+??_7MClipUtf8@@6B@ @1809 NONAME
+?Copy@MClipUtf8@@UBEXXZ @1810 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index ee09358441..8cb06c15f1 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1580,3 +1580,6 @@ newStrW @1789 NONAME ?SetTooltip@CCtrlMButton@@QEAAXPEBD@Z @1805 NONAME
db_event_delivered @1806 NONAME
?Utils_GenerateUUID@@YA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@XZ @1807 NONAME
+??0MClipUtf8@@QEAA@PEBD@Z @1808 NONAME
+??_7MClipUtf8@@6B@ @1809 NONAME
+?Copy@MClipUtf8@@UEBAXXZ @1810 NONAME
|
