From: msw Date: Mon, 8 Feb 1999 16:41:47 +0000 (+0000) Subject: Make grid wrapped windows at least the size of their title bars. X-Git-Tag: r0-40~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7fb09b2c41c3d4041dd8d58e28ac908a0a834a0a;p=thirdparty%2Fnewt.git Make grid wrapped windows at least the size of their title bars. --- diff --git a/grid.c b/grid.c index 66d8806..4330113 100644 --- a/grid.c +++ b/grid.c @@ -241,11 +241,15 @@ void newtGridGetSize(newtGrid grid, int * width, int * height) { } void newtGridWrappedWindow(newtGrid grid, char * title) { - int width, height; + int width, height, offset = 0; newtGridGetSize(grid, &width, &height); + if (width < strlen(title) + 2) { + offset = ((strlen(title) + 2) - width) / 2; + width = strlen(title) + 2; + } newtCenteredWindow(width + 2, height + 2, title); - newtGridPlace(grid, 1, 1); + newtGridPlace(grid, 1 + offset, 1); } void newtGridWrappedWindowAt(newtGrid grid, char * title, int left, int top) {