Skip to content

Commit

Permalink
xrCore: hidden under define functions of clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed May 24, 2018
1 parent d7447ef commit 865d540
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/xrCore/os_clipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

void os_clipboard::copy_to_clipboard(LPCSTR buf)
{
#if defined(WINDOWS)
if (!OpenClipboard(0))
return;
u32 handle_size = (xr_strlen(buf) + 1) * sizeof(char);
Expand All @@ -28,13 +29,14 @@ void os_clipboard::copy_to_clipboard(LPCSTR buf)
EmptyClipboard();
SetClipboardData(CF_TEXT, handle);
CloseClipboard();
#endif
}

void os_clipboard::paste_from_clipboard(LPSTR buffer, u32 const& buffer_size)
{
VERIFY(buffer);
VERIFY(buffer_size > 0);

#if defined(WINDOWS)
if (!OpenClipboard(0))
return;

Expand All @@ -56,10 +58,12 @@ void os_clipboard::paste_from_clipboard(LPSTR buffer, u32 const& buffer_size)

GlobalUnlock(hmem);
CloseClipboard();
#endif
}

void os_clipboard::update_clipboard(LPCSTR string)
{
#if defined(WINDOWS)
if (!OpenClipboard(0))
return;

Expand Down Expand Up @@ -89,4 +93,5 @@ void os_clipboard::update_clipboard(LPCSTR string)
#ifdef _EDITOR
xr_free(buffer);
#endif // #ifdef _EDITOR
#endif
}

0 comments on commit 865d540

Please sign in to comment.