summaryrefslogtreecommitdiffstats
path: root/newt
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2008-01-26 22:32:00 +0000
committer Eric Hameleers <alien@slackware.com>2008-01-26 22:32:00 +0000
commitacdb783b3208b13047cb12c26e8c44c37e4701eb (patch)
tree7200526c4342fc4af8385d9a3f2f3d9da8c8ec56 /newt
parent255b272a8b2c7f9e3cbd1c31fc325aa08f699fef (diff)
downloadasb-acdb783b3208b13047cb12c26e8c44c37e4701eb.tar.gz
asb-acdb783b3208b13047cb12c26e8c44c37e4701eb.tar.xz
Initial revision
Diffstat (limited to 'newt')
-rw-r--r--newt/build/newt-0.52.2-cbtpos.patch11
-rw-r--r--newt/build/newt-0.52.2-colors.patch31
-rw-r--r--newt/build/newt-0.52.2-cursor.patch10
-rw-r--r--newt/build/newt-0.52.2-dwchar.patch128
-rw-r--r--newt/build/newt-0.52.2-focus.patch236
-rw-r--r--newt/build/newt-0.52.2-nostatic.patch11
-rw-r--r--newt/build/newt-0.52.2-notcl.patch45
-rw-r--r--newt/build/newt-0.52.2-pgupdown-crash.patch37
-rw-r--r--newt/build/newt-0.52.2-pyexample.patch10
-rw-r--r--newt/build/newt-0.52.2-screensize.patch40
-rw-r--r--newt/build/newt-0.52.2-scrollbars.patch21
11 files changed, 580 insertions, 0 deletions
diff --git a/newt/build/newt-0.52.2-cbtpos.patch b/newt/build/newt-0.52.2-cbtpos.patch
new file mode 100644
index 00000000..e35b597d
--- /dev/null
+++ b/newt/build/newt-0.52.2-cbtpos.patch
@@ -0,0 +1,11 @@
+--- newt-0.52.2/checkboxtree.c.cbtpos 2006-06-07 16:04:35.000000000 +0200
++++ newt-0.52.2/checkboxtree.c 2006-06-08 13:28:31.000000000 +0200
+@@ -334,6 +334,8 @@
+ ct = malloc(sizeof(struct CheckboxTree));
+ co->callback = NULL;
+ co->data = ct;
++ co->left = left;
++ co->top = top;
+ co->ops = &ctOps;
+ co->takesFocus = 1;
+ co->height = height;
diff --git a/newt/build/newt-0.52.2-colors.patch b/newt/build/newt-0.52.2-colors.patch
new file mode 100644
index 00000000..052b4ed1
--- /dev/null
+++ b/newt/build/newt-0.52.2-colors.patch
@@ -0,0 +1,31 @@
+--- newt-0.52.2/newt.c.colors 2006-06-08 17:05:42.000000000 +0200
++++ newt-0.52.2/newt.c 2006-06-08 17:27:51.000000000 +0200
+@@ -53,21 +53,21 @@
+ "red", "lightgray", /* title fg, bg */
+ "lightgray", "red", /* button fg, bg */
+ "red", "lightgray", /* active button fg, bg */
+- "yellow", "blue", /* checkbox fg, bg */
+- "blue", "brown", /* active checkbox fg, bg */
+- "yellow", "blue", /* entry box fg, bg */
++ "lightgray", "blue", /* checkbox fg, bg */
++ "lightgray", "red", /* active checkbox fg, bg */
++ "lightgray", "blue", /* entry box fg, bg */
+ "blue", "lightgray", /* label fg, bg */
+ "black", "lightgray", /* listbox fg, bg */
+- "yellow", "blue", /* active listbox fg, bg */
++ "lightgray", "blue", /* active listbox fg, bg */
+ "black", "lightgray", /* textbox fg, bg */
+- "lightgray", "black", /* active textbox fg, bg */
++ "lightgray", "red", /* active textbox fg, bg */
+ "white", "blue", /* help line */
+- "yellow", "blue", /* root text */
++ "lightgray", "blue", /* root text */
+ "blue", /* scale full */
+ "red", /* scale empty */
+ "blue", "lightgray", /* disabled entry fg, bg */
+ "black", "lightgray", /* compact button fg, bg */
+- "yellow", "red", /* active & sel listbox */
++ "lightgray", "red", /* active & sel listbox */
+ "black", "brown" /* selected listbox */
+ };
+
diff --git a/newt/build/newt-0.52.2-cursor.patch b/newt/build/newt-0.52.2-cursor.patch
new file mode 100644
index 00000000..ec6641df
--- /dev/null
+++ b/newt/build/newt-0.52.2-cursor.patch
@@ -0,0 +1,10 @@
+--- newt-0.52.2/entry.c.cursor 2005-09-30 16:05:55.000000000 +0200
++++ newt-0.52.2/entry.c 2006-06-07 13:39:47.000000000 +0200
+@@ -322,6 +322,7 @@
+ switch (key) {
+ case '\r': /* Return */
+ if (en->flags & NEWT_FLAG_RETURNEXIT) {
++ newtCursorOff();
+ er.result = ER_EXITFORM;
+ } else {
+ er.result = ER_NEXTCOMP;
diff --git a/newt/build/newt-0.52.2-dwchar.patch b/newt/build/newt-0.52.2-dwchar.patch
new file mode 100644
index 00000000..48c4625f
--- /dev/null
+++ b/newt/build/newt-0.52.2-dwchar.patch
@@ -0,0 +1,128 @@
+--- newt-0.52.2/checkboxtree.c.dwchar 2006-08-04 13:41:28.000000000 +0200
++++ newt-0.52.2/checkboxtree.c 2006-08-04 13:41:28.000000000 +0200
+@@ -490,8 +490,17 @@
+ currRow = co->top + i;
+ }
+
+- SLsmg_write_nstring((*item)->text, co->width - 4 -
+- (3 * (*item)->depth));
++ j = 4 + (3 * (*item)->depth);
++ SLsmg_write_nstring(NULL, co->width - j);
++ newtGotorc(co->top + i, co->left + j);
++ if (wstrlen((*item)->text, -1) > co->width - j) {
++ char *tmp;
++ tmp = strdup((*item)->text);
++ trim_string(tmp, co->width - j);
++ SLsmg_write_string(tmp);
++ free(tmp);
++ } else
++ SLsmg_write_string((*item)->text);
+
+ item++;
+ i++;
+--- newt-0.52.2/newt_pr.h.dwchar 2005-09-30 16:05:55.000000000 +0200
++++ newt-0.52.2/newt_pr.h 2006-08-04 13:41:28.000000000 +0200
+@@ -82,5 +82,6 @@
+
+ int _newt_wstrlen(const char *str, int len);
+ #define wstrlen(str,len) _newt_wstrlen((str),(len))
++void trim_string(char *title, int chrs);
+
+ #endif /* H_NEWT_PR */
+--- newt-0.52.2/listbox.c.dwchar 2006-08-04 13:41:28.000000000 +0200
++++ newt-0.52.2/listbox.c 2006-08-04 13:41:28.000000000 +0200
+@@ -527,7 +527,16 @@
+ else
+ SLsmg_set_color(NEWT_COLORSET_LISTBOX);
+
+- SLsmg_write_nstring(item->text, li->curWidth);
++ SLsmg_write_nstring(NULL, li->curWidth);
++ newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust);
++ if (wstrlen(item->text, -1) > li->curWidth) {
++ char *tmp;
++ tmp = strdup(item->text);
++ trim_string(tmp, li->curWidth);
++ SLsmg_write_string(tmp);
++ free(tmp);
++ } else
++ SLsmg_write_string(item->text);
+
+ if (li->flags & NEWT_FLAG_MULTIPLE) {
+ newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust);
+--- newt-0.52.2/newt.c.dwchar 2006-08-04 13:41:28.000000000 +0200
++++ newt-0.52.2/newt.c 2006-08-04 13:41:28.000000000 +0200
+@@ -184,12 +184,13 @@
+ void trim_string(char *title, int chrs)
+ {
+ char *p = title;
+- int ln = chrs;
++ int ln;
+ int x = 0,y = 0;
+ wchar_t tmp;
+ mbstate_t ps;
+
+ memset(&ps, 0, sizeof(ps));
++ ln = strlen(title);
+
+ while (*p) {
+ x = mbrtowc(&tmp, p, ln, &ps);
+@@ -198,12 +199,13 @@
+ return;
+ }
+ y = wcwidth(tmp);
+- if (y > ln) {
++ if (y > chrs) {
+ *p = '\0';
+ return;
+ } else {
+ p += x;
+- ln -= y;
++ ln -= x;
++ chrs -= y;
+ }
+ }
+ }
+@@ -638,10 +640,10 @@
+ currentWindow->height = height;
+ currentWindow->title = title ? strdup(title) : NULL;
+
+- currentWindow->buffer = malloc(sizeof(SLsmg_Char_Type) * (width + 3) * (height + 3));
++ currentWindow->buffer = malloc(sizeof(SLsmg_Char_Type) * (width + 5) * (height + 3));
+
+ row = top - 1;
+- col = left - 1;
++ col = left - 2;
+ /* clip to the current screen bounds - msw */
+ if (row < 0)
+ row = 0;
+@@ -655,8 +657,8 @@
+ for (j = 0; j < height + 3; j++, row++) {
+ SLsmg_gotorc(row, col);
+ SLsmg_read_raw(currentWindow->buffer + n,
+- currentWindow->width + 3);
+- n += currentWindow->width + 3;
++ currentWindow->width + 5);
++ n += currentWindow->width + 5;
+ }
+
+ newtTrashScreen();
+@@ -732,7 +734,7 @@
+ row = col = 0;
+
+ row = currentWindow->top - 1;
+- col = currentWindow->left - 1;
++ col = currentWindow->left - 2;
+ if (row < 0)
+ row = 0;
+ if (col < 0)
+@@ -740,8 +742,8 @@
+ for (j = 0; j < currentWindow->height + 3; j++, row++) {
+ SLsmg_gotorc(row, col);
+ SLsmg_write_raw(currentWindow->buffer + n,
+- currentWindow->width + 3);
+- n += currentWindow->width + 3;
++ currentWindow->width + 5);
++ n += currentWindow->width + 5;
+ }
+
+ free(currentWindow->buffer);
diff --git a/newt/build/newt-0.52.2-focus.patch b/newt/build/newt-0.52.2-focus.patch
new file mode 100644
index 00000000..01af66c1
--- /dev/null
+++ b/newt/build/newt-0.52.2-focus.patch
@@ -0,0 +1,236 @@
+--- newt-0.52.2/checkboxtree.c.focus 2006-06-08 17:05:42.000000000 +0200
++++ newt-0.52.2/checkboxtree.c 2006-06-08 17:05:42.000000000 +0200
+@@ -25,6 +25,7 @@
+ int sbAdjust;
+ int curWidth;
+ int userHasSetWidth;
++ int isActive;
+ char * seq;
+ char * result;
+ };
+@@ -341,6 +342,7 @@
+ co->width = 0;
+ co->isMapped = 0;
+ ct->curWidth = 0;
++ ct->isActive = 0;
+ ct->userHasSetWidth = 0;
+ ct->itemlist = NULL;
+ ct->firstItem = NULL;
+@@ -462,12 +464,7 @@
+
+ while (*item && i < co->height) {
+ newtGotorc(co->top + i, co->left);
+- if (*item == *ct->currItem) {
+- SLsmg_set_color(NEWT_COLORSET_ACTLISTBOX);
+- currRow = co->top + i;
+- } else
+- SLsmg_set_color(NEWT_COLORSET_LISTBOX);
+-
++ SLsmg_set_color(NEWT_COLORSET_LISTBOX);
+ for (j = 0; j < (*item)->depth; j++)
+ SLsmg_write_string(" ");
+
+@@ -479,7 +476,7 @@
+ } else {
+ if (ct->flags & NEWT_CHECKBOXTREE_HIDE_BOX) {
+ if ((*item)->selected)
+- SLsmg_set_color(NEWT_COLORSET_ACTLISTBOX);
++ SLsmg_set_color(NEWT_COLORSET_SELLISTBOX);
+ SLsmg_write_string(" ");
+ } else {
+ char tmp[5];
+@@ -487,12 +484,15 @@
+ SLsmg_write_string(tmp);
+ }
+ }
++ if (*item == *ct->currItem) {
++ SLsmg_set_color(ct->isActive ?
++ NEWT_COLORSET_ACTSELLISTBOX : NEWT_COLORSET_ACTLISTBOX);
++ currRow = co->top + i;
++ }
+
+ SLsmg_write_nstring((*item)->text, co->width - 4 -
+ (3 * (*item)->depth));
+
+- SLsmg_set_color(NEWT_COLORSET_LISTBOX);
+-
+ item++;
+ i++;
+ }
+@@ -688,11 +688,13 @@
+ break;
+
+ case EV_FOCUS:
++ ct->isActive = 1;
+ ctDraw(co);
+ er.result = ER_SWALLOWED;
+ break;
+
+ case EV_UNFOCUS:
++ ct->isActive = 0;
+ ctDraw(co);
+ er.result = ER_SWALLOWED;
+ break;
+--- newt-0.52.2/textbox.c.focus 2005-09-30 16:05:55.000000000 +0200
++++ newt-0.52.2/textbox.c 2006-06-08 17:50:19.000000000 +0200
+@@ -15,9 +15,10 @@
+ char *blankline;
+ int linesAlloced;
+ int doWrap;
+- newtComponent sb;
++ newtComponent sb_act, sb;
+ int topLine;
+ int textWidth;
++ int isActive;
+ };
+
+ static char * expandTabs(const char * text);
+@@ -43,8 +44,10 @@
+ struct textbox * tb = co->data;
+
+ co->isMapped = isMapped;
+- if (tb->sb)
++ if (tb->sb) {
+ tb->sb->ops->mapped(tb->sb, isMapped);
++ tb->sb_act->ops->mapped(tb->sb_act, isMapped);
++ }
+ }
+
+ static void textboxPlace(newtComponent co, int newLeft, int newTop) {
+@@ -53,8 +56,10 @@
+ co->top = newTop;
+ co->left = newLeft;
+
+- if (tb->sb)
++ if (tb->sb) {
+ tb->sb->ops->place(tb->sb, co->left + co->width - 1, co->top);
++ tb->sb_act->ops->place(tb->sb_act, co->left + co->width - 1, co->top);
++ }
+ }
+
+ void newtTextboxSetHeight(newtComponent co, int height) {
+@@ -107,16 +112,20 @@
+ tb->lines = NULL;
+ tb->topLine = 0;
+ tb->textWidth = width;
++ tb->isActive = 0;
+ tb->blankline = malloc(width+1);
+ memset(tb->blankline,' ',width);
+ tb->blankline[width] = '\0';
+
+ if (flags & NEWT_FLAG_SCROLL) {
+ co->width += 2;
++ tb->sb_act = newtVerticalScrollbar(co->left + co->width - 1, co->top,
++ co->height, COLORSET_ACTTEXTBOX, COLORSET_TEXTBOX);
+ tb->sb = newtVerticalScrollbar(co->left + co->width - 1, co->top,
+ co->height, COLORSET_TEXTBOX, COLORSET_TEXTBOX);
++ co->takesFocus = 1;
+ } else {
+- tb->sb = NULL;
++ tb->sb_act = tb->sb = NULL;
+ }
+
+ return co;
+@@ -342,8 +351,13 @@
+
+ if (tb->sb) {
+ size = tb->numLines - c->height;
+- newtScrollbarSet(tb->sb, tb->topLine, size ? size : 0);
+- tb->sb->ops->draw(tb->sb);
++ if (tb->isActive) {
++ newtScrollbarSet(tb->sb_act, tb->topLine, size ? size : 0);
++ tb->sb_act->ops->draw(tb->sb_act);
++ } else {
++ newtScrollbarSet(tb->sb, tb->topLine, size ? size : 0);
++ tb->sb->ops->draw(tb->sb);
++ }
+ }
+
+ SLsmg_set_color(NEWT_COLORSET_TEXTBOX);
+@@ -363,7 +377,11 @@
+
+ er.result = ER_IGNORED;
+
+- if (ev.when == EV_EARLY && ev.event == EV_KEYPRESS && tb->sb) {
++ if (!tb->sb || ev.when == EV_EARLY || ev.when == EV_LATE)
++ return er;
++
++ switch(ev.event) {
++ case EV_KEYPRESS:
+ newtTrashScreen();
+ switch (ev.u.key) {
+ case NEWT_KEY_UP:
+@@ -395,8 +413,8 @@
+ er.result = ER_SWALLOWED;
+ break;
+ }
+- }
+- if (ev.when == EV_EARLY && ev.event == EV_MOUSE && tb->sb) {
++ break;
++ case EV_MOUSE:
+ /* Top scroll arrow */
+ if (ev.u.mouse.x == co->width && ev.u.mouse.y == co->top) {
+ if (tb->topLine) tb->topLine--;
+@@ -412,6 +430,17 @@
+
+ er.result = ER_SWALLOWED;
+ }
++ break;
++ case EV_FOCUS:
++ tb->isActive = 1;
++ textboxDraw(co);
++ er.result = ER_SWALLOWED;
++ break;
++ case EV_UNFOCUS:
++ tb->isActive = 0;
++ textboxDraw(co);
++ er.result = ER_SWALLOWED;
++ break;
+ }
+ return er;
+ }
+--- newt-0.52.2/listbox.c.focus 2005-09-30 16:05:55.000000000 +0200
++++ newt-0.52.2/listbox.c 2006-06-08 17:05:42.000000000 +0200
+@@ -518,7 +518,7 @@
+
+ newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust);
+ if(j + i == li->currItem) {
+- if(item->isSelected)
++ if(li->isActive)
+ SLsmg_set_color(NEWT_COLORSET_ACTSELLISTBOX);
+ else
+ SLsmg_set_color(NEWT_COLORSET_ACTLISTBOX);
+@@ -529,6 +529,12 @@
+
+ SLsmg_write_nstring(item->text, li->curWidth);
+
++ if (li->flags & NEWT_FLAG_MULTIPLE) {
++ newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust);
++ SLsmg_set_color(item->isSelected ?
++ NEWT_COLORSET_SELLISTBOX : NEWT_COLORSET_LISTBOX);
++ SLsmg_write_nstring(item->text, 1);
++ }
+ }
+ newtGotorc(co->top + (li->currItem - li->startShowItem) + li->bdyAdjust,
+ co->left + li->bdxAdjust);
+--- newt-0.52.2/form.c.focus 2005-09-21 11:32:01.000000000 +0200
++++ newt-0.52.2/form.c 2006-06-27 14:40:19.000000000 +0200
+@@ -1027,8 +1027,17 @@
+ }
+ }
+
+- if (key == NEWT_KEY_F1 && form->helpTag && form->helpCb)
++ if (key == NEWT_KEY_F1 && form->helpTag && form->helpCb) {
++ if (form->currComp != -1) {
++ ev.event = EV_UNFOCUS;
++ sendEvent(form->elements[form->currComp].co, ev);
++ }
+ form->helpCb(co, form->helpTag);
++ if (form->currComp != -1) {
++ ev.event = EV_FOCUS;
++ sendEvent(form->elements[form->currComp].co, ev);
++ }
++ }
+
+ if (!done) {
+ ev.event = EV_KEYPRESS;
diff --git a/newt/build/newt-0.52.2-nostatic.patch b/newt/build/newt-0.52.2-nostatic.patch
new file mode 100644
index 00000000..1081e705
--- /dev/null
+++ b/newt/build/newt-0.52.2-nostatic.patch
@@ -0,0 +1,11 @@
+--- newt-0.52.2/Makefile.in 2006-10-31 21:57:01.000000000 +0200
++++ newt-0.52.2/Makefile.in.new 2006-10-31 22:08:26.000000000 +0200
+@@ -52,7 +52,7 @@
+ $(MAKE) -C po stamp-po
+
+ test: $(TESTOBJS) $(LIBNEWT)
+- $(CC) -g -o test $(TESTOBJS) $(LIBNEWT) $(LIBS) -static
++ $(CC) -g -o test $(TESTOBJS) $(LIBNEWT) $(LIBS)
+
+ testgrid: testgrid.o $(LIBNEWT)
+ $(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
diff --git a/newt/build/newt-0.52.2-notcl.patch b/newt/build/newt-0.52.2-notcl.patch
new file mode 100644
index 00000000..46f581b6
--- /dev/null
+++ b/newt/build/newt-0.52.2-notcl.patch
@@ -0,0 +1,45 @@
+--- newt-0.52.2/Makefile.in.notcl 2005-11-22 09:39:14.000000000 +0100
++++ newt-0.52.2/Makefile.in 2006-01-17 02:50:07.000000000 +0100
+@@ -14,7 +14,7 @@
+
+ WHIPTCLSO=whiptcl.so
+
+-PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
++PROGS = test whiptail testgrid testtree showchars showkey
+ TESTOBJS = test.o
+ NDIALOGOBJS = whiptail.o dialogboxes.o
+ WHIPTCLOBJS = whiptcl.o dialogboxes.o
+@@ -78,15 +78,15 @@
+ whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
+ $(CC) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt
+
+-whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
+- $(CC) -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . -lnewt $(LIBTCL) -lslang -lpopt -lm
++#whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
++# $(CC) -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . -lnewt $(LIBTCL) -lslang -lpopt -lm
+
+ # Ensure dialogboxes is compiled -fPIC
+ dialogboxes.o: dialogboxes.c
+ $(CC) $(CFLAGS) $(SHCFLAGS) -c dialogboxes.c
+
+-whiptcl.o: whiptcl.c
+- $(CC) -I/usr/include/tcl8.4 $(SHCFLAGS) $(CFLAGS) -c whiptcl.c
++#whiptcl.o: whiptcl.c
++# $(CC) -I/usr/include/tcl8.4 $(SHCFLAGS) $(CFLAGS) -c whiptcl.c
+
+
+ $(LIBNEWT): $(LIBOBJS)
+@@ -129,11 +129,11 @@
+ install -m 644 $(LIBNEWT) $(instroot)/$(libdir)
+ install -m 755 whiptail $(instroot)/$(bindir)
+
+-install-sh: sharedlib $(WHIPTCLSO) _snackmodule.so
++install-sh: sharedlib _snackmodule.so
+ [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
+ install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
+ ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/libnewt.so
+- [ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.so $(instroot)/$(libdir) || :
++# [ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.so $(instroot)/$(libdir) || :
+ for ver in $(PYTHONVERS) ; do \
+ [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
+ install -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\
diff --git a/newt/build/newt-0.52.2-pgupdown-crash.patch b/newt/build/newt-0.52.2-pgupdown-crash.patch
new file mode 100644
index 00000000..f0fc646c
--- /dev/null
+++ b/newt/build/newt-0.52.2-pgupdown-crash.patch
@@ -0,0 +1,37 @@
+--- newt-0.52.2/checkboxtree.c.pgupdown-crash 2005-09-30 16:05:55.000000000 +0200
++++ newt-0.52.2/checkboxtree.c 2006-01-17 23:40:19.000000000 +0100
+@@ -536,6 +536,18 @@
+ free(co);
+ }
+
++static void ctEnsureLimits( struct CheckboxTree *ct ) {
++ struct items **listEnd = ct->flatList + ct->flatCount - 1;
++ if (ct->firstItem < ct->flatList)
++ ct->firstItem = ct->flatList;
++ if (ct->currItem < ct->flatList)
++ ct->currItem = ct->flatList;
++ if (ct->firstItem > listEnd) {
++ ct->firstItem = listEnd;
++ ct->currItem = listEnd;
++ }
++}
++
+ struct eventResult ctEvent(newtComponent co, struct event ev) {
+ struct CheckboxTree * ct = co->data;
+ struct eventResult er;
+@@ -647,6 +659,7 @@
+ ct->currItem -= co->height;
+ ct->firstItem -= co->height;
+ }
++ ctEnsureLimits( ct );
+
+ ctDraw(co);
+ if(co->callback) co->callback(co, co->callbackData);
+@@ -663,6 +676,7 @@
+ ct->currItem += co->height;
+ ct->firstItem += co->height;
+ }
++ ctEnsureLimits( ct );
+
+ ctDraw(co);
+ if(co->callback) co->callback(co, co->callbackData);
diff --git a/newt/build/newt-0.52.2-pyexample.patch b/newt/build/newt-0.52.2-pyexample.patch
new file mode 100644
index 00000000..65d115bd
--- /dev/null
+++ b/newt/build/newt-0.52.2-pyexample.patch
@@ -0,0 +1,10 @@
+--- newt-0.52.2/popcorn.py.pyexample 2000-05-16 18:54:02.000000000 +0200
++++ newt-0.52.2/popcorn.py 2006-06-27 15:34:44.000000000 +0200
+@@ -4,7 +4,6 @@
+ import sys
+
+ def help(screen, text):
+- raise ValueError, "foo"
+ ButtonChoiceWindow(screen, "Help", text, help = "Help on help")
+
+ t = TextboxReflowed(25, "Some text which needs to be wrapped at a good place.")
diff --git a/newt/build/newt-0.52.2-screensize.patch b/newt/build/newt-0.52.2-screensize.patch
new file mode 100644
index 00000000..ebfedab9
--- /dev/null
+++ b/newt/build/newt-0.52.2-screensize.patch
@@ -0,0 +1,40 @@
+--- newt-0.52.2/newt.c.wincoord 2005-09-30 16:13:16.000000000 +0200
++++ newt-0.52.2/newt.c 2006-03-28 22:39:40.000000000 +0200
+@@ -617,7 +617,7 @@
+ * @param title - title string
+ * @return zero on success (currently no errors reported)
+ */
+-int newtOpenWindow(unsigned int left, unsigned int top,
++int newtOpenWindow(int left, int top,
+ unsigned int width, unsigned int height,
+ const char * title) {
+ int j, row, col;
+@@ -708,14 +708,14 @@
+ */
+ int newtCenteredWindow(unsigned int width,unsigned int height,
+ const char * title) {
+- unsigned int top, left;
++ int top, left;
+
+- top = (SLtt_Screen_Rows - height) / 2;
++ top = ((int)(SLtt_Screen_Rows - height)) / 2;
+
+ /* I don't know why, but this seems to look better */
+ if ((SLtt_Screen_Rows % 2) && (top % 2)) top--;
+
+- left = (SLtt_Screen_Cols - width) / 2;
++ left = ((int)(SLtt_Screen_Cols - width)) / 2;
+
+ newtOpenWindow(left, top, width, height, title);
+
+--- newt-0.52.2/newt.h.wincoord 2005-09-21 11:32:01.000000000 +0200
++++ newt-0.52.2/newt.h 2006-03-28 22:06:07.000000000 +0200
+@@ -115,7 +115,7 @@
+ void newtClearKeyBuffer(void);
+ void newtDelay(unsigned int usecs);
+ /* top, left are *not* counting the border */
+-int newtOpenWindow(unsigned int left,unsigned int top,
++int newtOpenWindow(int left,int top,
+ unsigned int width,unsigned int height,
+ const char * title);
+ int newtCenteredWindow(unsigned int width,unsigned int height, const char * title);
diff --git a/newt/build/newt-0.52.2-scrollbars.patch b/newt/build/newt-0.52.2-scrollbars.patch
new file mode 100644
index 00000000..9cf8542f
--- /dev/null
+++ b/newt/build/newt-0.52.2-scrollbars.patch
@@ -0,0 +1,21 @@
+diff -ru newt-0.51.6/scrollbar.c newt-0.51.6-new/scrollbar.c
+--- newt-0.51.6/scrollbar.c 2002-06-26 22:17:46.000000000 -0400
++++ newt-0.51.6-new/scrollbar.c 2005-08-06 22:33:00.000000000 -0400
+@@ -47,7 +47,7 @@
+ sb = malloc(sizeof(*sb));
+ co->data = sb;
+
+- if (!strcmp(getenv("TERM"), "linux") && height >= 2) {
++ if (height >= 2) {
+ sb->arrows = 1;
+ sb->curr = 1;
+ } else {
+@@ -100,7 +100,7 @@
+
+ static void sbDrawThumb(newtComponent co, int isOn) {
+ struct scrollbar * sb = co->data;
+- SLtt_Char_Type ch = isOn ? '#' : SLSMG_CKBRD_CHAR;
++ SLtt_Char_Type ch = isOn ? SLSMG_BLOCK_CHAR : SLSMG_CKBRD_CHAR;
+
+ if (!co->isMapped) return;
+