]> granicus.if.org Git - nethack/commitdiff
qt_key.cpp
authorPatR <rankin@nethack.org>
Wed, 26 Aug 2020 01:59:22 +0000 (18:59 -0700)
committerPatR <rankin@nethack.org>
Wed, 26 Aug 2020 01:59:22 +0000 (18:59 -0700)
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
win/Qt/qt_key.h

index 5aa807803348b6e80e84995a4d390e381eb9e4b3..480fe7f4f6aca5530b1861b3cb699139573d4bb7 100644 (file)
@@ -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)
index c2ef3a89b2253937a153223abc3d66bc9717ceb7..78a2c56c9045bdaeb7ffb618ec9463c0112b80d7 100644 (file)
@@ -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();