diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-09 09:41:06 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-09 09:41:06 +0300 |
commit | 4c277ce0e6efe5d372b399bd37eaef07d6ea8c1a (patch) | |
tree | 954e2e5f4b5c9840e90999178b972cc6b50d5f36 /src/app.c | |
parent | ec4a55a53c2ee358e0b6f6220a7fad6c83cb4101 (diff) |
Closing tabs/window
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -406,6 +406,23 @@ iBool handleCommand_App(const char *cmd) { | |||
406 | refresh_Widget(tabs); | 406 | refresh_Widget(tabs); |
407 | return iTrue; | 407 | return iTrue; |
408 | } | 408 | } |
409 | else if (equal_Command(cmd, "tabs.close")) { | ||
410 | iWidget *tabs = findWidget_App("doctabs"); | ||
411 | if (tabCount_Widget(tabs) > 1) { | ||
412 | size_t index = tabPageIndex_Widget(tabs, document_App()); | ||
413 | iWidget *closed = removeTabPage_Widget(tabs, index); | ||
414 | destroy_Widget(closed); /* released later */ | ||
415 | if (index == tabCount_Widget(tabs)) { | ||
416 | index--; | ||
417 | } | ||
418 | arrange_Widget(tabs); | ||
419 | postCommandf_App("tabs.switch page:%p", tabPage_Widget(tabs, index)); | ||
420 | } | ||
421 | else { | ||
422 | postCommand_App("quit"); | ||
423 | } | ||
424 | return iTrue; | ||
425 | } | ||
409 | else if (equal_Command(cmd, "quit")) { | 426 | else if (equal_Command(cmd, "quit")) { |
410 | SDL_Event ev; | 427 | SDL_Event ev; |
411 | ev.type = SDL_QUIT; | 428 | ev.type = SDL_QUIT; |