From 1a041028c108f32e807bce7ea3a65db1b46d0e1b Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Fri, 6 Jan 2023 12:19:20 +0300 Subject: [PATCH 1/3] Set shift bit also if right or left shift key press detected --- 0.76_My_PuTTY/windows/window.c | 4 ++-- 0.76b_My_PuTTY/windows/window.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/0.76_My_PuTTY/windows/window.c b/0.76_My_PuTTY/windows/window.c index 76a0397..80b06b6 100644 --- a/0.76_My_PuTTY/windows/window.c +++ b/0.76_My_PuTTY/windows/window.c @@ -5702,8 +5702,8 @@ if( (GetKeyState(VK_MENU)&0x8000) && (wParam==VK_SPACE) ) { // Using bits not used by any other status for backward compatibility. #define RIGHT_SHIFT_PRESSED 0x0400 #define LEFT_SHIFT_PRESSED 0x0200 - if (GetAsyncKeyState(VK_LSHIFT)) { ctrl |= RIGHT_SHIFT_PRESSED; } - if (GetAsyncKeyState(VK_RSHIFT)) { ctrl |= LEFT_SHIFT_PRESSED; } + if (GetAsyncKeyState(VK_LSHIFT)) { ctrl |= SHIFT_PRESSED; ctrl |= RIGHT_SHIFT_PRESSED; } + if (GetAsyncKeyState(VK_RSHIFT)) { ctrl |= SHIFT_PRESSED; ctrl |= LEFT_SHIFT_PRESSED; } // end if ((lParam & ( 1 << 24 )) >> 24) { ctrl |= ENHANCED_KEY; } if ((((u_short)GetKeyState(VK_NUMLOCK)) & 0xffff) != 0) { ctrl |= NUMLOCK_ON; } diff --git a/0.76b_My_PuTTY/windows/window.c b/0.76b_My_PuTTY/windows/window.c index 9822751..5825485 100644 --- a/0.76b_My_PuTTY/windows/window.c +++ b/0.76b_My_PuTTY/windows/window.c @@ -5702,8 +5702,8 @@ if( (GetKeyState(VK_MENU)&0x8000) && (wParam==VK_SPACE) ) { // Using bits not used by any other status for backward compatibility. #define RIGHT_SHIFT_PRESSED 0x0400 #define LEFT_SHIFT_PRESSED 0x0200 - if (GetAsyncKeyState(VK_LSHIFT)) { ctrl |= RIGHT_SHIFT_PRESSED; } - if (GetAsyncKeyState(VK_RSHIFT)) { ctrl |= LEFT_SHIFT_PRESSED; } + if (GetAsyncKeyState(VK_LSHIFT)) { ctrl |= SHIFT_PRESSED; ctrl |= RIGHT_SHIFT_PRESSED; } + if (GetAsyncKeyState(VK_RSHIFT)) { ctrl |= SHIFT_PRESSED; ctrl |= LEFT_SHIFT_PRESSED; } // end if ((lParam & ( 1 << 24 )) >> 24) { ctrl |= ENHANCED_KEY; } if ((((u_short)GetKeyState(VK_NUMLOCK)) & 0xffff) != 0) { ctrl |= NUMLOCK_ON; } From d8706714beafaf9cd2383cc39a6a8374bc6ea48e Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Fri, 6 Jan 2023 15:09:04 +0300 Subject: [PATCH 2/3] workaround for clients that do not flush clipboard before setting it --- 0.76b_My_PuTTY/terminal/terminal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/0.76b_My_PuTTY/terminal/terminal.c b/0.76b_My_PuTTY/terminal/terminal.c index f33e77c..3b9ee7b 100644 --- a/0.76b_My_PuTTY/terminal/terminal.c +++ b/0.76b_My_PuTTY/terminal/terminal.c @@ -3559,6 +3559,10 @@ static void do_osc(Terminal *term) if (OpenClipboard(NULL)) { + // some clients don't flush the buffer before setting data, + // so we'll do that here just in case + EmptyClipboard(); + if (!SetClipboardData(fmt, (HANDLE)hData)) { GlobalFree(hData); } else { From b99479f92ee28074841514db765e50004e06f8bf Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Fri, 6 Jan 2023 15:10:54 +0300 Subject: [PATCH 3/3] workaround for clients that do not flush clipboard before setting it 2/2 --- 0.76_My_PuTTY/terminal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/0.76_My_PuTTY/terminal.c b/0.76_My_PuTTY/terminal.c index 30bc319..f8100c7 100644 --- a/0.76_My_PuTTY/terminal.c +++ b/0.76_My_PuTTY/terminal.c @@ -3560,6 +3560,10 @@ static void do_osc(Terminal *term) if (OpenClipboard(NULL)) { + // some clients don't flush the buffer before setting data, + // so we'll do that here just in case + EmptyClipboard(); + if (!SetClipboardData(fmt, (HANDLE)hData)) { GlobalFree(hData); } else {