[ncpp] express EvType enums

This commit is contained in:
nick black 2021-10-07 04:03:52 -04:00
parent 8fc2a4b59b
commit 66d6913b69
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 22 additions and 0 deletions

16
include/ncpp/Input.hh Normal file
View File

@ -0,0 +1,16 @@
#ifndef __NCPP_INPUT_HH
#define __NCPP_INPUT_HH
#include <notcurses/notcurses.h>
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

View File

@ -9,6 +9,7 @@
#include <unistd.h>
#include <iostream>
#include <inttypes.h>
#include <ncpp/Input.hh>
#include <ncpp/Direct.hh>
#include <ncpp/Visual.hh>
#include <ncpp/NotCurses.hh>
@ -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){