From 2d70d86deda7f7c39fcf2eca5fab6b621d3ac235 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 25 Aug 2020 18:59:22 -0700 Subject: [PATCH] qt_key.cpp I've been trying to figure out how to make ^[ be treated as ESC but so far have failed. That key combination just acts like a dead key. But one bit of cp_key.cpp can be implemented instead of ignored. No change in behavior because the keyboard-state value isn't being used anywhere. --- win/Qt/qt_key.cpp | 13 +++++++------ win/Qt/qt_key.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/win/Qt/qt_key.cpp b/win/Qt/qt_key.cpp index 5aa807803..480fe7f4f 100644 --- a/win/Qt/qt_key.cpp +++ b/win/Qt/qt_key.cpp @@ -23,18 +23,19 @@ NetHackQtKeyBuffer::NetHackQtKeyBuffer() : bool NetHackQtKeyBuffer::Empty() const { return in==out; } bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; } -void NetHackQtKeyBuffer::Put(int k, int a, int kbstate) +void NetHackQtKeyBuffer::Put(int k, int a, uint kbstate) { + //raw_fprintf("k:%3d a:%3d s:0x%08x\n", k, a, kbstate); if ( Full() ) return; // Safety - nhUse(kbstate); - key[in]=k; - ascii[in]=a; - in=(in+1)%maxkey; + key[in] = k; + ascii[in] = a; + state[in] = (Qt::KeyboardModifiers) kbstate; + in = (in + 1) % maxkey; } void NetHackQtKeyBuffer::Put(char a) { - Put(0,a,0); + Put(0, a, 0U); } void NetHackQtKeyBuffer::Put(const char* str) diff --git a/win/Qt/qt_key.h b/win/Qt/qt_key.h index c2ef3a89b..78a2c56c9 100644 --- a/win/Qt/qt_key.h +++ b/win/Qt/qt_key.h @@ -16,7 +16,7 @@ public: bool Empty() const; bool Full() const; - void Put(int k, int ascii, int state); + void Put(int k, int ascii, uint state); void Put(char a); void Put(const char* str); int GetKey();