From cfe04ddf916aaab0c64ce640e3ca39c7779799d8 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 17 May 2013 02:14:28 +0200 Subject: [PATCH] Moved check for existence of active window into shift_window(). --- roguelike.c | 4 ++-- windows.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roguelike.c b/roguelike.c index 4bd6c7e..f4dd621 100644 --- a/roguelike.c +++ b/roguelike.c @@ -478,9 +478,9 @@ int main () { cycle_active_window(&win_meta, 'n'); 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) + else if (key == get_action_key(world.keybindings, "shift forwards")) shift_window(&win_meta, 'f'); - else if (key == get_action_key(world.keybindings, "shift backwards") && win_meta.active != 0) + else if (key == get_action_key(world.keybindings, "shift backwards")) shift_window(&win_meta, 'b'); else if (key == get_action_key(world.keybindings, "grow horizontally") && win_meta.active != 0) resize_window(&win_meta, '*'); diff --git a/windows.c b/windows.c index 77a35b2..121c9fa 100644 --- a/windows.c +++ b/windows.c @@ -212,7 +212,7 @@ void cycle_active_window (struct WinMeta * win_meta, char dir) { 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. - if (win_meta->chain_start != win_meta->chain_end && (dir == 'f' || dir == 'b')) { + if (0 != win_meta->active && win_meta->chain_start != win_meta->chain_end && (dir == 'f' || dir == 'b')) { int i, i_max; struct Win * win_shift = win_meta->active; char wrap = 0; -- 2.30.2