From c89899a428d03f8f24d2ebd636b383b866641ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 24 Mar 2022 14:51:24 +0100 Subject: [PATCH] Wayland: Return our clipboard without roundtrips (cherry picked from commit 89d3ea8d691016306ca23f26d1dc11e9f51baea2) --- src/wl_window.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 497b00dd..997baa18 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1860,6 +1860,9 @@ const char* _glfwPlatformGetClipboardString(void) return NULL; } + if (_glfw.wl.dataSource) + return _glfw.wl.clipboardSendString; + ret = pipe2(fds, O_CLOEXEC); if (ret < 0) { @@ -1870,10 +1873,9 @@ const char* _glfwPlatformGetClipboardString(void) } wl_data_offer_receive(_glfw.wl.dataOffer, "text/plain;charset=utf-8", fds[1]); - close(fds[1]); - // XXX: this is a huge hack, this function shouldn’t be synchronous! - handleEvents(NULL); + flushDisplay(); + close(fds[1]); for (;;) {