diff --git a/.gitignore b/.gitignore index ec09f141d..d8d6a5c86 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ build/stamps/* *~ *.pyc utils/* -*.log \ No newline at end of file +*.log +build/ext_* \ No newline at end of file diff --git a/build/powder b/build/powder index 12b63b754..749c17d7a 100755 Binary files a/build/powder and b/build/powder differ diff --git a/src/interface.c b/src/interface.c index 6382ed00c..9d3fcc899 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3874,7 +3874,7 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) { currentcommand2->command = mystrdup(error); last_command2 = currentcommand2; - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); cc = 0; while(cc < 80){ fillrect(old_buf, -1, -1+cc, XRES+BARSIZE, 2, 0, 0, 0, 160-(cc*2)); @@ -3956,14 +3956,14 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) { currentcommand->command = mystrdup(ed.str); last_command = currentcommand; free(old_buf); - SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); + //SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); return currentcommand->command; } if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE) { console_mode = 0; free(old_buf); - SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); + //SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); return NULL; } if(sdl_key==SDLK_UP || sdl_key==SDLK_DOWN) @@ -4000,7 +4000,7 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) { } console_mode = 0; free(old_buf); - SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); + //SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); return NULL; } diff --git a/src/main.c b/src/main.c index fadf2aa4a..61da3bac0 100644 --- a/src/main.c +++ b/src/main.c @@ -1915,6 +1915,19 @@ emb_get_modifier(PyObject *self, PyObject *args) return Py_BuildValue("(iiiiii)",sdl_mod&KMOD_LCTRL,sdl_mod&KMOD_RCTRL,sdl_mod&KMOD_LALT,sdl_mod&KMOD_RALT,sdl_mod&KMOD_LSHIFT,sdl_mod&KMOD_RSHIFT); } +//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +static PyObject* +emb_set_keyrepeat(PyObject *self, PyObject *args) +{ + ////SDL_EnableKeyRepeat(delay,interval) + int keydelay,keyinterval; + keydelay=SDL_DEFAULT_REPEAT_DELAY; + keyinterval=SDL_DEFAULT_REPEAT_INTERVAL; + if(!PyArg_ParseTuple(args, "|ii:set_keyrepeat",&keydelay,&keyinterval)) + return NULL; + return Py_BuildValue("i",SDL_EnableKeyRepeat(keydelay,keyinterval)); +} + static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here! {"create", (PyCFunction)emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."}, {"log", (PyCFunction)emb_log, METH_VARARGS, "logs an error string to the console."}, @@ -1950,6 +1963,7 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun {"shortcuts_disable", (PyCFunction)emb_shortcuts_disable, METH_VARARGS, "disable keyboard shortcuts"}, {"shortcuts_enable", (PyCFunction)emb_shortcuts_enable, METH_VARARGS, "enable keyboard shortcuts"}, {"get_modifier", (PyCFunction)emb_get_modifier, METH_VARARGS, "get pressed modifier keys"}, + {"set_keyrepeat", (PyCFunction)emb_set_keyrepeat, METH_VARARGS, "set key repeat rate."}, {NULL, NULL, 0, NULL} }; #endif