Skip to content

Commit

Permalink
Empty clipboard just before we set the new data
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemony committed Jun 8, 2024
1 parent d4c5edd commit cd8794e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utility/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2528,15 +2528,14 @@ SKIF_Util_SetClipboardData (const std::wstring_view& data)

if (hGlobal)
{
EmptyClipboard ( );

wchar_t *pszDestination = static_cast<wchar_t*> (GlobalLock (hGlobal));

if (pszDestination != nullptr)
{
memcpy (pszDestination, data.data(), (data.length() + 1) * sizeof (wchar_t));
GlobalUnlock (hGlobal);


EmptyClipboard ( );
result = SetClipboardData (CF_UNICODETEXT, hGlobal);
}

Expand Down

0 comments on commit cd8794e

Please sign in to comment.