diff options
Diffstat (limited to 'src/tk')
-rw-r--r-- | src/tk/text.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tk/text.c b/src/tk/text.c index 644200b..9ba9faa 100644 --- a/src/tk/text.c +++ b/src/tk/text.c @@ -41,7 +41,6 @@ struct mftk_text { int ascent; SDL_Texture *texture; int editable; - int (*allowed)(void *, char); int (*action)(void *, const char *); int (*submit)(void *); void *user_data; @@ -150,9 +149,8 @@ _mftk_text_key_event(struct mftk_widget *w, SDL_Event *e) for (i = 0, j = 0; i < newlen && e->text.text[j] != '\0'; ++j) { - if (t->allowed != NULL && - t->allowed(t->user_data, - e->text.text[j]) <= 0) { + if (strchr(t->allowed_chars, e->text.text[j]) + == NULL) { continue; } t->val[t->cur + i] = e->text.text[j]; @@ -307,7 +305,7 @@ _mftk_text_destroy(struct mftk_widget *w) struct mftk_widget * mftk_text_new(const char *allowed_chars, int len, const char *val, - TTF_Font *font, int editable, int (*allowed)(void *, char), + TTF_Font *font, int editable, int (*action)(void *, const char *), int (*submit)(void *), void *user_data) { @@ -329,7 +327,6 @@ mftk_text_new(const char *allowed_chars, int len, const char *val, t->ascent = TTF_FontAscent (font); t->texture = NULL; t->editable = editable; - t->allowed = allowed; t->action = action; t->submit = submit; t->user_data = user_data; |