diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command/commands.c | 6 | ||||
-rw-r--r-- | src/ui/core.c | 11 | ||||
-rw-r--r-- | src/ui/ui.h | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 15676184..0ed51795 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -530,12 +530,10 @@ gboolean cmd_win(gchar **args, struct cmd_help_t help) { int num = atoi(args[0]); - if (ui_win_exists(num)) { - ui_switch_win(num); - } else { + gboolean switched = ui_switch_win(num); + if (switched == FALSE) { cons_show("Window %d does not exist.", num); } - return TRUE; } diff --git a/src/ui/core.c b/src/ui/core.c index d069ba53..7b1e4d1e 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -531,12 +531,12 @@ _get_recipient_string(ProfWin *window) return result; } -static void +static gboolean _ui_switch_win(const int i) { - ui_current_page_off(); - ProfWin *new_current = wins_get_by_num(i); - if (new_current != NULL) { + if (ui_win_exists(i)) { + ui_current_page_off(); + ProfWin *new_current = wins_get_by_num(i); wins_set_current_by_num(i); ui_current_page_off(); @@ -554,6 +554,9 @@ _ui_switch_win(const int i) status_bar_active(i); } wins_update_virtual_current(); + return TRUE; + } else { + return FALSE; } } diff --git a/src/ui/ui.h b/src/ui/ui.h index ddc1ca17..874ccee2 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -58,7 +58,7 @@ void (*ui_resize)(const int ch, const char * const input, GSList* (*ui_get_recipients)(void); void (*ui_handle_special_keys)(const wint_t * const ch, const char * const inp, const int size); -void (*ui_switch_win)(const int i); +gboolean (*ui_switch_win)(const int i); void (*ui_next_win)(void); void (*ui_previous_win)(void); void (*ui_gone_secure)(const char * const recipient, gboolean trusted); |