Use events instead of isKeyPressed for the interrupt key
Also related to #291
This commit is contained in:
@@ -3128,12 +3128,16 @@ bool is_sign(ter_num_t ter) {
|
||||
bool check_for_interrupt(){
|
||||
using kb = sf::Keyboard;
|
||||
bool interrupt = false;
|
||||
sf::Event evt;
|
||||
if(mainPtr.pollEvent(evt) && evt.type == sf::Event::KeyPressed) {
|
||||
// TODO: I wonder if there are other events we should handle here? Resize maybe?
|
||||
#ifdef __APPLE__
|
||||
if((kb::isKeyPressed(kb::LSystem) || kb::isKeyPressed(kb::RSystem)) && kb::isKeyPressed(kb::Period))
|
||||
interrupt = true;
|
||||
if(evt.key.code == kb::Period && evt.key.system)
|
||||
interrupt = true;
|
||||
#endif
|
||||
if((kb::isKeyPressed(kb::LControl) || kb::isKeyPressed(kb::RControl)) && kb::isKeyPressed(kb::C))
|
||||
interrupt = true;
|
||||
if(evt.key.code == kb::C && evt.key.control)
|
||||
interrupt = true;
|
||||
}
|
||||
if(interrupt) {
|
||||
cChoiceDlog confirm("confirm-interrupt", {"quit","cancel"});
|
||||
if(confirm.show() == "quit") return true;
|
||||
|
Reference in New Issue
Block a user