From 33c342879683b33e81418146c01639bcb915c514 Mon Sep 17 00:00:00 2001 From: Simon Anciaux <14198779+mrmixer@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:31:37 +0200 Subject: [PATCH] Clipboard fix Fixed duplicated entries in 4coder internal clipboard (Fix from VDK on the 4coder discord). Removed the unnecessary loop that was there to try to fix the clipboard missing entries (which was fixed previously by removing the `next_clipboard_is_self` variable). --- code/platform_win32/win32_4ed.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/code/platform_win32/win32_4ed.cpp b/code/platform_win32/win32_4ed.cpp index 0f7ab82a..7b83401d 100644 --- a/code/platform_win32/win32_4ed.cpp +++ b/code/platform_win32/win32_4ed.cpp @@ -448,6 +448,7 @@ win32_post_clipboard(Arena *scratch, char *text, i32 len){ SetClipboardData(CF_TEXT, memory_handle); } CloseClipboard(); + win32vars.clipboard_sequence = GetClipboardSequenceNumber(); } } @@ -456,14 +457,10 @@ system_get_clipboard_sig(){ String_Const_u8 result = {}; DWORD new_number = GetClipboardSequenceNumber(); if (new_number != win32vars.clipboard_sequence){ - win32vars.clipboard_sequence = new_number; - - for (i32 R = 0; R < 8; ++R){ - result = win32_read_clipboard_contents(win32vars.tctx, arena); - if (result.str == 0){ - break; - } - } + result = win32_read_clipboard_contents(win32vars.tctx, arena); + if (result.str != 0){ + win32vars.clipboard_sequence = new_number; + } } return(result); }