X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fwindows.c;h=33b9b3145acfdd51717e0f0e8fb3faa80afb6383;hb=5dfbb430e0aed478ced7cdc32c1777745a435532;hp=98c8cf8b46da0bbdd73c4b9659a4c27dbfe48c3a;hpb=e9d8b1aca776341c9cdaa2ea6406336661d82a76;p=plomrogue diff --git a/src/windows.c b/src/windows.c index 98c8cf8..33b9b31 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1,8 +1,8 @@ -#include +#include "windows.h" #include #include +#include #include -#include "windows.h" struct Corners { struct yx_uint16 tl; @@ -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) { @@ -296,5 +295,6 @@ extern void shift_active_win (struct WinMeta * wmeta, char dir) { extern void reset_pad_offset(struct WinMeta * wmeta, uint16_t new_offset) { // Apply new_offset to windows pad, if it proves to be sane. - if (new_offset >= 0 && new_offset + wmeta->pad.size.x < getmaxx(wmeta->pad.curses_win)) + if (new_offset >= 0 + && (new_offset < wmeta->pad_offset || new_offset + wmeta->pad.size.x < getmaxx(wmeta->pad.curses_win))) wmeta->pad_offset = new_offset; }