diff options
author | Jeinzi <Jeinzi@gmx.de> | 2018-09-27 00:53:17 +0200 |
---|---|---|
committer | Jeinzi <Jeinzi@gmx.de> | 2018-09-27 00:53:17 +0200 |
commit | 51837d93572fe229275d239c7a8d4113ef81ea38 (patch) | |
tree | 4c1e2390842c370aea555231d7914df5cc7b2d97 /src/imv.c | |
parent | a8fc50025e2c3470b0ad9e63d6e9f1bc32ff5e8a (diff) | |
download | imv-51837d93572fe229275d239c7a8d4113ef81ea38.tar.gz |
Implemented imv_command_exec_list().
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); } } } |