From 88232d9d06c2b53dce4566250334ee6c6cb861e8 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Sat, 30 Sep 2023 17:43:10 -0400 Subject: [PATCH] Switch to using glfw clipboard functions --- Nuake/src/Core/OS.cpp | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/Nuake/src/Core/OS.cpp b/Nuake/src/Core/OS.cpp index 07fbb624..20693768 100644 --- a/Nuake/src/Core/OS.cpp +++ b/Nuake/src/Core/OS.cpp @@ -4,13 +4,11 @@ #include "Engine.h" #ifdef NK_WIN - #define GLFW_EXPOSE_NATIVE_WIN32 #include #include #include #include - #endif #ifdef NK_LINUX @@ -23,7 +21,6 @@ #include "GLFW/glfw3.h" #include "GLFW/glfw3native.h" - #include #include @@ -31,44 +28,12 @@ namespace Nuake { void OS::CopyToClipboard(const std::string& value) { -#ifdef NK_WIN - auto glob = GlobalAlloc(GMEM_FIXED, 512); - memcpy(glob, value.data(), value.size()); - OpenClipboard(glfwGetWin32Window(Window::Get()->GetHandle())); - EmptyClipboard(); - SetClipboardData(CF_TEXT, glob); - CloseClipboard(); -#endif - -#ifdef NK_LINUX - glfwSetClipboardString(NULL, value.c_str()); - - -#endif - } std::string OS::GetFromClipboard() { -#ifdef NK_WIN - OpenClipboard(nullptr); - HANDLE hData = GetClipboardData(CF_TEXT); - - char* pszText = static_cast(GlobalLock(hData)); - std::string text(pszText); - - GlobalUnlock(hData); - CloseClipboard(); - - return text; -#endif - -#ifdef NK_LINUX - glfwSetClipboardString(NULL, "A string with words in it"); -#endif - - return ""; + return std::string(glfwGetClipboardString(NULL)); } int OS::GetTime()