From 66d6913b69f76f547b0b8db73c209ad2b954d308 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 7 Oct 2021 04:03:52 -0400 Subject: [PATCH] [ncpp] express EvType enums --- include/ncpp/Input.hh | 16 ++++++++++++++++ src/player/play.cpp | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 include/ncpp/Input.hh diff --git a/include/ncpp/Input.hh b/include/ncpp/Input.hh new file mode 100644 index 000000000..0ad5991a9 --- /dev/null +++ b/include/ncpp/Input.hh @@ -0,0 +1,16 @@ +#ifndef __NCPP_INPUT_HH +#define __NCPP_INPUT_HH + +#include + +namespace ncpp +{ + struct EvType + { + static constexpr unsigned Silent = ncinput::NCTYPE_UNKNOWN; + static constexpr unsigned Press = ncinput::NCTYPE_PRESS; + static constexpr unsigned Repeat = ncinput::NCTYPE_REPEAT; + static constexpr unsigned Release = ncinput::NCTYPE_RELEASE; + }; +} +#endif diff --git a/src/player/play.cpp b/src/player/play.cpp index 87a5194bf..26b788b36 100644 --- a/src/player/play.cpp +++ b/src/player/play.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,11 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts, if(keyp == ' '){ // space for unpause continue; } + // we don't care about key release events, especially the enter + // release that starts so many interactive programs under Kitty + if(ni.evtype == EvType::Release){ + continue; + } if(keyp == NCKey::Resize){ return 0; }else if(keyp == 'L' && ni.ctrl && !ni.alt){