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(){
|
bool check_for_interrupt(){
|
||||||
using kb = sf::Keyboard;
|
using kb = sf::Keyboard;
|
||||||
bool interrupt = false;
|
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__
|
#ifdef __APPLE__
|
||||||
if((kb::isKeyPressed(kb::LSystem) || kb::isKeyPressed(kb::RSystem)) && kb::isKeyPressed(kb::Period))
|
if(evt.key.code == kb::Period && evt.key.system)
|
||||||
interrupt = true;
|
interrupt = true;
|
||||||
#endif
|
#endif
|
||||||
if((kb::isKeyPressed(kb::LControl) || kb::isKeyPressed(kb::RControl)) && kb::isKeyPressed(kb::C))
|
if(evt.key.code == kb::C && evt.key.control)
|
||||||
interrupt = true;
|
interrupt = true;
|
||||||
|
}
|
||||||
if(interrupt) {
|
if(interrupt) {
|
||||||
cChoiceDlog confirm("confirm-interrupt", {"quit","cancel"});
|
cChoiceDlog confirm("confirm-interrupt", {"quit","cancel"});
|
||||||
if(confirm.show() == "quit") return true;
|
if(confirm.show() == "quit") return true;
|
||||||
|
Reference in New Issue
Block a user