]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
Redraw fixes.
authorsopwith <sopwith>
Tue, 22 Jul 1997 17:21:22 +0000 (17:21 +0000)
committersopwith <sopwith>
Tue, 22 Jul 1997 17:21:22 +0000 (17:21 +0000)
Tiny listbox nav update.

form.c
listbox.c
newt.c
newt_pr.h

diff --git a/form.c b/form.c
index 06b1ca2da21cca61328ce6fb195b62fad2f57789..bf7c4a330d8906fc6ce6b94d912f59218672d007 100644 (file)
--- a/form.c
+++ b/form.c
@@ -206,6 +206,8 @@ void newtDrawForm(newtComponent co) {
     struct element * el;
     int i;
 
+    newtDrawCurrentWindow();
+
     SLsmg_set_color(form->background);
     newtClearBox(co->left, co->top, co->width, co->height);
     for (i = 0, el = form->elements; i < form->numComps; i++, el++) {
index 23e8f1fe374c1635c4fd62275ffb88692016c9c6..39e6aceb696dad9802b4ff4622fc01964ac898b8 100644 (file)
--- a/listbox.c
+++ b/listbox.c
@@ -461,9 +461,6 @@ static struct eventResult listboxEvent(newtComponent co, struct event ev) {
 
          case NEWT_KEY_END:
            if(li->numItems <= 0) break;
-           li->currItem = li->numItems - 1;
-           li->startShowItem = li->numItems - co->height - 1;
-           newtListboxRealSetCurrent(co);
            newtListboxSetCurrent(co, li->numItems - 1);
            er.result = ER_SWALLOWED;
            break;
diff --git a/newt.c b/newt.c
index 147ca3a37a9715c8662b61cc7c266fd8b7ad6b70..1c23e9c6917bb8ce521b6995cb70af1527b90a23 100644 (file)
--- a/newt.c
+++ b/newt.c
@@ -14,6 +14,7 @@
 struct Window {
     int height, width, top, left;
     short * buffer;
+    char * title;
 };
 
 struct keymap {
@@ -318,6 +319,7 @@ int newtOpenWindow(int left, int top, int width, int height,
     currentWindow->top = top;
     currentWindow->width = width;
     currentWindow->height = height;
+    currentWindow->title = strdup(title);
 
     currentWindow->buffer = malloc(sizeof(short) * (width + 3) * (height + 3));
 
@@ -331,11 +333,28 @@ int newtOpenWindow(int left, int top, int width, int height,
        n += currentWindow->width + 3;
     }
 
+    newtDrawCurrentWindow();
+
+    return 0;
+}
+
+void newtDrawCurrentWindow(void)
+{
+    int i;
+    int top, left, height, width;
+
+    if(!currentWindow) return;
+
+    top = currentWindow->top;
+    left = currentWindow->left;
+    height = currentWindow->height;
+    width = currentWindow->width;
+
     SLsmg_set_color(NEWT_COLORSET_BORDER);
     SLsmg_draw_box(top - 1, left - 1, height + 2, width + 2);
 
-    if (title) {
-       i = strlen(title) + 4;
+    if (currentWindow->title) {
+       i = strlen(currentWindow->title) + 4;
        i = ((width - i) / 2) + left;
        SLsmg_gotorc(top - 1, i);
        SLsmg_set_char_set(1);
@@ -343,7 +362,7 @@ int newtOpenWindow(int left, int top, int width, int height,
        SLsmg_set_char_set(0);
        SLsmg_write_char(' ');
        SLsmg_set_color(NEWT_COLORSET_TITLE);
-       SLsmg_write_string(title);
+       SLsmg_write_string(currentWindow->title);
        SLsmg_set_color(NEWT_COLORSET_BORDER);
        SLsmg_write_char(' ');
        SLsmg_set_char_set(1);
@@ -362,8 +381,6 @@ int newtOpenWindow(int left, int top, int width, int height,
        SLsmg_gotorc(i, left + width + 1);
        SLsmg_write_string(" ");
     }
-
-    return 0;
 }
 
 void newtPopWindow(void) {
@@ -382,6 +399,7 @@ void newtPopWindow(void) {
     }
 
     free(currentWindow->buffer);
+    free(currentWindow->title);
 
     if (currentWindow == windowStack) 
        currentWindow = NULL;
index 7efa55b8ce6f112e4cb331715d5ee15e258eb0f7..19082c65528c939f0f5fedf209d86c7c5d118ac3 100644 (file)
--- a/newt_pr.h
+++ b/newt_pr.h
@@ -23,6 +23,7 @@ void newtGotorc(int row, int col);
 void newtGetrc(int * row, int * col);
 void newtDrawBox(int left, int top, int width, int height, int shadow);
 void newtClearBox(int left, int top, int width, int height);
+void newtDrawCurrentWindow(void);
 
 int newtGetKey(void);