Skip to content

Commit 25a9ea9

Browse files
committed
clipboard fix for linux
1 parent 3879a84 commit 25a9ea9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/render/opengl/gl_engine_glfw.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,16 @@ bool GLEngineGLFW::isKeyPressed(char c) {
237237
return false;
238238
}
239239

240+
241+
// For some reason the ImGui::SetClipboardText() didn't work here, on linux
242+
// it would not actually write to system clipboard. Calling glfw directly seems to work.
243+
240244
std::string GLEngineGLFW::getClipboardText() {
241-
std::string clipboardData = ImGui::GetClipboardText();
245+
std::string clipboardData = glfwGetClipboardString(nullptr);
242246
return clipboardData;
243247
}
244248

245-
void GLEngineGLFW::setClipboardText(std::string text) { ImGui::SetClipboardText(text.c_str()); }
249+
void GLEngineGLFW::setClipboardText(std::string text) { glfwSetClipboardString(nullptr, text.c_str()); }
246250

247251
} // namespace backend_openGL3
248252
} // namespace render

0 commit comments

Comments
 (0)