[ncplayer] restore pause functionality with NCTYPE_RELEASE

pull/2280/head
nick black 3 years ago
parent 1e1d1bb631
commit ec67847806
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -47,7 +47,7 @@ struct marshal {
auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts, auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
const struct timespec* abstime, void* vmarshal) -> int { const struct timespec* abstime, void* vmarshal) -> int {
struct marshal* marsh = static_cast<struct marshal*>(vmarshal); struct marshal* marsh = static_cast<struct marshal*>(vmarshal);
NotCurses &nc = NotCurses::get_instance (); NotCurses &nc = NotCurses::get_instance();
auto start = static_cast<struct timespec*>(ncplane_userptr(vopts->n)); auto start = static_cast<struct timespec*>(ncplane_userptr(vopts->n));
if(!start){ if(!start){
start = static_cast<struct timespec*>(malloc(sizeof(struct timespec))); start = static_cast<struct timespec*>(malloc(sizeof(struct timespec)));
@ -112,17 +112,18 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
continue; continue;
} }
if(keyp == ' '){ if(keyp == ' '){
if((keyp = nc.get(true)) == (uint32_t)-1){ do{
ncplane_destroy(subp); if((keyp = nc.get(true, &ni)) == (uint32_t)-1){
return -1; ncplane_destroy(subp);
} return -1;
}
}while(ni.id != 'q' && (ni.evtype == EvType::Release || ni.id != ' '));
} }
// if we just hit a non-space character to unpause, ignore it // if we just hit a non-space character to unpause, ignore it
if(keyp == ' '){ // space for unpause
continue;
}
if(keyp == NCKey::Resize){ if(keyp == NCKey::Resize){
return 0; return 0;
}else if(keyp == ' '){ // space for unpause
continue;
}else if(keyp == 'L' && ni.ctrl && !ni.alt){ }else if(keyp == 'L' && ni.ctrl && !ni.alt){
nc.refresh(nullptr, nullptr); nc.refresh(nullptr, nullptr);
continue; continue;
@ -144,6 +145,8 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
}else if(keyp == NCKey::Left){ }else if(keyp == NCKey::Left){
// FIXME move backwards // FIXME move backwards
continue; continue;
}else if(keyp != 'q'){
continue;
} }
ncplane_destroy(subp); ncplane_destroy(subp);
return 1; return 1;

Loading…
Cancel
Save