Turning off auto key repeat?

Is there any way to turn off ‘auto key repeat’ in OF (not in System Preferences on Mac OS X)?

Thanks in advance.

Hi jaeho,

Welcome to openFrameworks! I hope it’s working out for you so far.

You can make a map<int,bool> myMap. In keyPressed check myMap[key], if it’s false then handle the key input and set myMap[key]=true, otherwise ignore the key input. In keyReleased set myMap[key]=false .

Hope this helps

1 Like

Thanks Damian.
That is a simple yet effective way!

I just thought I saw a utility function that switch off the auto-key-repeat before, but I am probably confused.


there is a function you can add to the file ofAppGlutWindow.cpp

at line 297 there are some initialization methods

just add glutIgnoreKeyRepeat(1); at line 312 and you should be good to go !

shakashin, thanks a lot!

Instead of modifying ‘ofAppGlutWindow.cpp’,
I added some lines of code to ‘testApp.cpp’ and it works like a charm!

#include "testApp.h"  
#ifdef TARGET_WIN32  
	#include "glut.h"  
#ifdef TARGET_OSX  
	#include "../../../libs/glut/lib/osx/GLUT.framework/Versions/A/Headers/glut.h"  
	#include <Carbon/Carbon.h>  
	#include <GL/glut.h>  
void testApp::setup(){