]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
Make grid wrapped windows at least the size of their title bars.
authormsw <msw>
Mon, 8 Feb 1999 16:41:47 +0000 (16:41 +0000)
committermsw <msw>
Mon, 8 Feb 1999 16:41:47 +0000 (16:41 +0000)
grid.c

diff --git a/grid.c b/grid.c
index 66d88069febbaaedf3e01734595799677778e72e..4330113962f29b4f6f4dd58fd02b6a7564e02b51 100644 (file)
--- 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) {