From: Christian Heller Date: Fri, 17 May 2013 00:14:28 +0000 (+0200) Subject: Moved check for existence of active window into shift_window(). X-Git-Tag: tce~1292 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/reset_cookie?a=commitdiff_plain;h=cfe04ddf916aaab0c64ce640e3ca39c7779799d8;p=plomrogue Moved check for existence of active window into shift_window(). --- 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;