diff options
Diffstat (limited to 'src/imv.c')
-rw-r--r-- | src/imv.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -765,14 +765,9 @@ static void handle_event(struct imv *imv, SDL_Event *event) } switch(event->type) { - case SDL_QUIT: { - /* new scope needed in order to declare variables in a switch statement */ - struct list *commands = list_create(); - list_append(commands, "quit"); - imv_command_exec(imv->commands, commands, imv); - list_free(commands); + case SDL_QUIT: + imv_command_exec(imv->commands, "quit", imv); break; - } case SDL_TEXTINPUT: strncat(imv->input_buffer, event->text.text, command_buffer_len - 1); imv->need_redraw = true; @@ -791,7 +786,7 @@ static void handle_event(struct imv *imv, SDL_Event *event) } else if(event->key.keysym.sym == SDLK_RETURN) { struct list *commands = list_create(); list_append(commands, imv->input_buffer); - imv_command_exec(imv->commands, commands, imv); + imv_command_exec_list(imv->commands, commands, imv); SDL_StopTextInput(); list_free(commands); free(imv->input_buffer); @@ -820,7 +815,7 @@ static void handle_event(struct imv *imv, SDL_Event *event) default: { /* braces to allow const char *cmd definition */ struct list *cmds = imv_bind_handle_event(imv->binds, event); if(cmds) { - imv_command_exec(imv->commands, cmds, imv); + imv_command_exec_list(imv->commands, cmds, imv); } } } |