X-Git-Url: https://plomlompom.com/repos/index.html?a=blobdiff_plain;f=windows.c;h=659318deeea90a4343f95437eec3f9cc92804c4c;hb=c4dd7e96a38e28dbfd50104cfc8ab35eff5fbf77;hp=121c9faf369fdc0cd51f7dd9387c11a4b538835f;hpb=cfe04ddf916aaab0c64ce640e3ca39c7779799d8;p=plomrogue
diff --git a/windows.c b/windows.c
index 121c9fa..659318d 100644
--- a/windows.c
+++ b/windows.c
@@ -13,8 +13,16 @@ struct WinMeta init_win_meta (WINDOW * screen) {
win_meta.chain_end = 0;
win_meta.pad_offset = 0;
win_meta.pad = newpad(win_meta.height, 1);
+ win_meta.active = 0;
return win_meta; }
+void scroll_pad (struct WinMeta * win_meta, char dir) {
+// Scroll pad left (if possible) or right.
+ if ('+' == dir)
+ win_meta->pad_offset++;
+ else if ('-' == dir && win_meta->pad_offset > 0)
+ win_meta->pad_offset--; }
+
struct Win init_window (struct WinMeta * win_meta, char * title) {
// Create and populate Win struct with sane default values.
struct Win win;
@@ -186,15 +194,16 @@ void draw_all_windows (struct WinMeta * win_meta) {
void resize_window (struct WinMeta * win_meta, char change) {
// Grow or shrink currently active window. Correct its geometry and that of its followers.
- if (change == '-' && win_meta->active->height > 1)
+ if (0 != win_meta->active) {
+ if (change == '-' && win_meta->active->height > 1)
win_meta->active->height--;
- else if (change == '+' && win_meta->active->height < win_meta->height - 1)
- win_meta->active->height++;
- else if (change == '_' && win_meta->active->width > 1)
+ else if (change == '+' && win_meta->active->height < win_meta->height - 1)
+ win_meta->active->height++;
+ else if (change == '_' && win_meta->active->width > 1)
win_meta->active->width--;
- else if (change == '*')
- win_meta->active->width++;
- update_windows(win_meta, win_meta->chain_start); }
+ else if (change == '*')
+ win_meta->active->width++;
+ update_windows(win_meta, win_meta->chain_start); } }
void cycle_active_window (struct WinMeta * win_meta, char dir) {
// Cycle active window selection forwards (dir = 'n') or backwards.