From d7c46fb1de25edd8782fbc7642be71e5e54deab2 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 28 Jun 2013 01:01:19 +0200
Subject: [PATCH] Make resize_active_win use yx_uint16 for coordinates instead
 of two separate ints.

---
 src/roguelike.c | 17 ++++++-----------
 src/windows.c   |  7 +++----
 src/windows.h   |  2 +-
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/roguelike.c b/src/roguelike.c
index 7bcaf92..0d1e96b 100644
--- a/src/roguelike.c
+++ b/src/roguelike.c
@@ -110,17 +110,12 @@ void scroll_pad (struct WinMeta * win_meta, char dir) {
 void growshrink_active_window (struct WinMeta * win_meta, char change) {
 // Grow or shrink active window horizontally or vertically by one cell size.
   if (0 != win_meta->active) {
-    uint16_t height = win_meta->active->frame.size.y;
-    uint16_t width = win_meta->active->frame.size.x;
-    if      (change == '-')
-      height--;
-    else if (change == '+')
-      height++;
-    else if (change == '_')
-      width--;
-    else if (change == '*')
-      width++;
-    resize_active_win (win_meta, height, width); } }
+    struct yx_uint16 size = win_meta->active->frame.size;
+    if      (change == '-') size.y--;
+    else if (change == '+') size.y++;
+    else if (change == '_') size.x--;
+    else if (change == '*') size.x++;
+    resize_active_win (win_meta, size); } }
 
 unsigned char meta_keys(int key, struct World * world, struct WinMeta * win_meta, struct Win * win_keys,
                         struct Win * win_map, struct Win * win_info, struct Win * win_log) {
diff --git a/src/windows.c b/src/windows.c
index 6089781..181247c 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -237,11 +237,10 @@ extern void draw_all_wins (struct WinMeta * wmeta) {
     pnoutrefresh(wmeta->pad.curses_win, 0, wmeta->pad_offset, 0, 0, wmeta->pad.size.y, wmeta->pad.size.x-1); }
   doupdate(); }
 
-extern void resize_active_win (struct WinMeta * wmeta, uint16_t height, uint16_t width) {
+extern void resize_active_win (struct WinMeta * wmeta, struct yx_uint16 size) {
 // Grow or shrink currently active window. Correct its geometry and that of its followers.
-  if (0 != wmeta->active && width > 0 && height > 0 && height < wmeta->pad.size.y) {
-    wmeta->active->frame.size.y = height;
-    wmeta->active->frame.size.x = width;
+  if (0 != wmeta->active && size.x > 0 && size.y > 0 && size.y < wmeta->pad.size.y) {
+    wmeta->active->frame.size = size;
     update_wins(wmeta, wmeta->chain_start); } }
 
 extern void cycle_active_win (struct WinMeta * wmeta, char dir) {
diff --git a/src/windows.h b/src/windows.h
index 9391233..7714c6c 100644
--- a/src/windows.h
+++ b/src/windows.h
@@ -32,7 +32,7 @@ extern void append_win (struct WinMeta *, struct Win *);
 extern void suspend_win (struct WinMeta *, struct Win *);
 extern void draw_scroll_hint (struct Frame *, uint16_t, uint32_t, char);
 extern void draw_all_wins (struct WinMeta *);
-extern void resize_active_win (struct WinMeta *, uint16_t, uint16_t);
+extern void resize_active_win (struct WinMeta *, struct yx_uint16);
 extern void cycle_active_win (struct WinMeta *, char);
 extern void shift_active_win (struct WinMeta *, char);
 extern void reset_pad_offset (struct WinMeta *, uint16_t);
-- 
2.30.2