toggle_window(&win_meta, &win_info);
else if (key == get_action_key(world.keybindings, "toggle log window"))
toggle_window(&win_meta, &win_log);
- else if (key == get_action_key(world.keybindings, "cycle forwards") && win_meta.active != 0)
+ else if (key == get_action_key(world.keybindings, "cycle forwards"))
cycle_active_window(&win_meta, 'n');
- else if (key == get_action_key(world.keybindings, "cycle backwards") && win_meta.active != 0)
+ else if (key == get_action_key(world.keybindings, "cycle backwards"))
cycle_active_window(&win_meta, 'p');
else if (key == get_action_key(world.keybindings, "shift forwards") && win_meta.active != 0)
shift_window(&win_meta, 'f');
void cycle_active_window (struct WinMeta * win_meta, char dir) {
// Cycle active window selection forwards (dir = 'n') or backwards.
- if ('n' == dir) {
- if (win_meta->active->next != 0)
- win_meta->active = win_meta->active->next;
- else
- win_meta->active = win_meta->chain_start; }
- else {
- if (win_meta->active->prev != 0)
- win_meta->active = win_meta->active->prev;
- else
- win_meta->active = win_meta->chain_end; } }
+ if (0 != win_meta->active) {
+ if ('n' == dir) {
+ if (win_meta->active->next != 0)
+ win_meta->active = win_meta->active->next;
+ else
+ win_meta->active = win_meta->chain_start; }
+ else {
+ if (win_meta->active->prev != 0)
+ win_meta->active = win_meta->active->prev;
+ else
+ win_meta->active = win_meta->chain_end; } } }
void shift_window (struct WinMeta * win_meta, char dir) {
// Move active window forward/backward in window chain. If jumping beyond start/end, move to other chain end.