From 6b4342d2c5897771b15bfa0206709b9b00fdfa04 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 24 Jun 2020 11:22:41 +1000 Subject: [PATCH] Ignore key character text input on 64 bit mac backend while Cmd is pressed, fixes 'c' and 'v' appearing in chat when copy/pasting. (Thanks Ally) --- src/Bitmap.c | 2 +- src/Window.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Bitmap.c b/src/Bitmap.c index 460f7833e..ca042dc89 100644 --- a/src/Bitmap.c +++ b/src/Bitmap.c @@ -48,7 +48,7 @@ void Bitmap_Scale(Bitmap* dst, Bitmap* src, int srcX, int srcY, int srcWidth, in BitmapCol* srcRow; int x, y, width, height; - width = dst->Width; + width = dst->Width; height = dst->Height; for (y = 0; y < height; y++) { diff --git a/src/Window.c b/src/Window.c index 4b5186c60..631642c70 100644 --- a/src/Window.c +++ b/src/Window.c @@ -2829,7 +2829,13 @@ static void ProcessKeyChars(id ev) { const char* src; String str; id chars; - int i, len; + int i, len, flags; + + /* Ignore text input while cmd is held down */ + /* e.g. so Cmd + V to paste doesn't leave behind 'v' */ + flags = (int)objc_msgSend(ev, selModifiers); + if (flags & 0x000008) return; + if (flags & 0x000010) return; chars = objc_msgSend(ev, selCharacters); src = objc_msgSend(chars, selUtf8String);