veto ESC and cmd+q

it would be great if you could veto the closing of an app. a simple solution would be to have an option to disable the default ESC functionality.

best
joerg

hmm… I’ve actually hacked this into my copy of OF…

Into your ofBaseApp.h

  
  
// line 11 (ofBaseApp())  
escapeEnabled = true;  
  
// line 21 (ofBaseApp public methods)  
void disableEscapeQuit(){ this->enableEscapeQuit(false); }  
void enableEscapeQuit(bool escapeEnabled=true){ this->escapeEnabled = escapeEnabled; }  
  
// line 39 (ofBaseApp public fields)  
bool escapeEnabled  
  

Into your ofAppGlutWindow.cpp

  
  
// line 514 (void ofAppGlutWindow::keyboard_cb)  
if(key == OF_KEY_ESC){				// "escape"  
	if(ofAppPtr?ofAppPtr->escapeEnabled:true)  
		exitApp();  
}  
  

and then to disable the escape button in your testApp::setup() (or wherever)

  
  
this->disableEscapeQuit();  
  

Works pretty good :slight_smile: Still haven’t figured out how to kill the OSX cmd+Q functionality though.