From e3cbab907b83d9189f5e0e06b912ad09c424b8c0 Mon Sep 17 00:00:00 2001 From: Jack Punter Date: Wed, 1 Nov 2023 21:24:36 +0000 Subject: [PATCH] Remove win32 clipboard flag which ocasionally results in mis-paste from the system clipboard --- code/platform_win32/win32_4ed.cpp | 34 +++++-------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/code/platform_win32/win32_4ed.cpp b/code/platform_win32/win32_4ed.cpp index dd9d1209..ca80a8bb 100644 --- a/code/platform_win32/win32_4ed.cpp +++ b/code/platform_win32/win32_4ed.cpp @@ -172,7 +172,6 @@ struct Win32_Vars{ String_Const_u8 binary_path; b8 clip_catch_all; - b8 next_clipboard_is_self; DWORD clipboard_sequence; Plat_Handle clip_wakeup_timer; @@ -446,7 +445,6 @@ win32_post_clipboard(Arena *scratch, char *text, i32 len){ dest[len] = 0; GlobalUnlock(memory_handle); SetClipboardData(CF_TEXT, memory_handle); - win32vars.next_clipboard_is_self = true; } CloseClipboard(); } @@ -458,15 +456,11 @@ system_get_clipboard_sig(){ DWORD new_number = GetClipboardSequenceNumber(); if (new_number != win32vars.clipboard_sequence){ win32vars.clipboard_sequence = new_number; - if (win32vars.next_clipboard_is_self){ - win32vars.next_clipboard_is_self = false; - } - else{ - for (i32 R = 0; R < 8; ++R){ - result = win32_read_clipboard_contents(win32vars.tctx, arena); - if (result.str == 0){ - break; - } + + for (i32 R = 0; R < 8; ++R){ + result = win32_read_clipboard_contents(win32vars.tctx, arena); + if (result.str == 0){ + break; } } } @@ -1952,24 +1946,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS } win32vars.clip_wakeup_timer = system_wake_up_timer_create(); win32vars.clipboard_sequence = 0; - win32vars.next_clipboard_is_self = 0; -#if 0 - if (win32vars.clipboard_sequence == 0){ - Scratch_Block scratch(win32vars.tctx); - win32_post_clipboard(scratch, "", 0); - win32vars.clipboard_sequence = GetClipboardSequenceNumber(); - win32vars.next_clipboard_is_self = 0; - if (win32vars.clipboard_sequence == 0){ - log_os(" failure\n"); - } - else{ - log_os(" got first sequence number\n"); - } - } - else{ - log_os(" no initial sequence number\n"); - } -#endif log_os("Setting up keyboard layout...\n"); win32vars.kl_universal = LoadKeyboardLayoutW(L"00000409", 0);