[elinks] fix patches such that they apply with zero offset
Kamil Dudka
kdudka at fedoraproject.org
Thu Apr 21 14:15:03 UTC 2011
commit 3086ecbf5614ccbcc3c15110786a0ef53a8811a3
Author: Kamil Dudka <kdudka at redhat.com>
Date: Thu Apr 21 15:53:27 2011 +0200
fix patches such that they apply with zero offset
elinks-0.10.1-xterm.patch | 2 +-
elinks-0.11.0-getaddrinfo.patch | 2 +-
elinks-0.11.0-ssl-noegd.patch | 2 +-
elinks-0.11.0-union.patch | 4 +-
elinks-0.11.3-macropen.patch | 21 +-
elinks-nss.patch | 8 +-
elinks-scroll.patch | 800 +++++++++++++++++++--------------------
7 files changed, 405 insertions(+), 434 deletions(-)
---
diff --git a/elinks-0.10.1-xterm.patch b/elinks-0.10.1-xterm.patch
index ad36ba1..969395f 100644
--- a/elinks-0.10.1-xterm.patch
+++ b/elinks-0.10.1-xterm.patch
@@ -1,6 +1,6 @@
--- elinks-0.10.1/src/config/options.c.xterm 2005-01-04 01:50:29.000000000 +0100
+++ elinks-0.10.1/src/config/options.c 2005-01-28 18:32:34.523579120 +0100
-@@ -643,8 +643,9 @@
+@@ -689,8 +689,9 @@ register_autocreated_options(void)
get_opt_bool("terminal.linux.m11_hack") = 1;
get_opt_int("terminal.vt100.type") = TERM_VT100;
get_opt_int("terminal.vt110.type") = TERM_VT100;
diff --git a/elinks-0.11.0-getaddrinfo.patch b/elinks-0.11.0-getaddrinfo.patch
index f5922a1..e91bbe4 100644
--- a/elinks-0.11.0-getaddrinfo.patch
+++ b/elinks-0.11.0-getaddrinfo.patch
@@ -1,6 +1,6 @@
--- elinks-0.11.0/src/network/dns.c.getaddrinfo 2006-01-01 17:39:36.000000000 +0100
+++ elinks-0.11.0/src/network/dns.c 2006-01-10 09:30:56.000000000 +0100
-@@ -156,9 +156,21 @@
+@@ -157,9 +157,21 @@ do_real_lookup(unsigned char *name, struct sockaddr_storage **addrs, int *addrno
* But we duplicate the code terribly here :|. */
/* hostent = getipnodebyname(name, AF_INET6, AI_ALL | AI_ADDRCONFIG, NULL); */
memset(&hint, 0, sizeof(hint));
diff --git a/elinks-0.11.0-ssl-noegd.patch b/elinks-0.11.0-ssl-noegd.patch
index 07ac93f..5818734 100644
--- a/elinks-0.11.0-ssl-noegd.patch
+++ b/elinks-0.11.0-ssl-noegd.patch
@@ -1,6 +1,6 @@
--- elinks-0.11.0/src/network/ssl/ssl.c.noegd 2006-01-10 09:24:50.000000000 +0100
+++ elinks-0.11.0/src/network/ssl/ssl.c 2006-01-10 09:25:01.000000000 +0100
-@@ -43,18 +43,6 @@
+@@ -44,18 +44,6 @@ SSL_CTX *context = NULL;
static void
init_openssl(struct module *module)
{
diff --git a/elinks-0.11.0-union.patch b/elinks-0.11.0-union.patch
index 0a64677..b84d884 100644
--- a/elinks-0.11.0-union.patch
+++ b/elinks-0.11.0-union.patch
@@ -1,6 +1,6 @@
--- elinks-0.11.0/src/config/options.h.union 2006-01-10 09:40:54.000000000 +0100
+++ elinks-0.11.0/src/config/options.h 2006-01-10 09:48:16.000000000 +0100
-@@ -131,7 +131,7 @@
+@@ -160,7 +160,7 @@ struct option {
};
#define INIT_OPTION(name, flags, type, min, max, value, desc, capt) \
@@ -9,7 +9,7 @@
extern struct option *config_options;
extern struct option *cmdline_options;
-@@ -292,40 +292,42 @@
+@@ -323,40 +323,42 @@ extern void register_options(struct option_info info[], struct option *tree);
extern void unregister_options(struct option_info info[], struct option *tree);
#define NULL_OPTION_INFO \
diff --git a/elinks-0.11.3-macropen.patch b/elinks-0.11.3-macropen.patch
index 534af82..e2908b8 100644
--- a/elinks-0.11.3-macropen.patch
+++ b/elinks-0.11.3-macropen.patch
@@ -1,11 +1,16 @@
---- elinks-0.11.3/src/encoding/encoding.c.macropen
-+++ elinks-0.11.3/src/encoding/encoding.c
-@@ -117,7 +117,7 @@
- if (!stream) return NULL;
+ src/encoding/encoding.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
- stream->encoding = encoding;
+diff --git a/src/encoding/encoding.c b/src/encoding/encoding.c
+index d019dab..9648da3 100644
+--- a/src/encoding/encoding.c
++++ b/src/encoding/encoding.c
+@@ -111,7 +111,7 @@ open_encoded(int fd, enum stream_encoding encoding)
+ if (!stream) return NULL;
+
+ stream->encoding = encoding;
- if (decoding_backends[stream->encoding]->open(stream, fd) >= 0)
+ if ((decoding_backends[stream->encoding]->open)(stream, fd) >= 0)
- return stream;
-
- mem_free(stream);
+ return stream;
+
+ mem_free(stream);
diff --git a/elinks-nss.patch b/elinks-nss.patch
index d0c7e25..e49b838 100644
--- a/elinks-nss.patch
+++ b/elinks-nss.patch
@@ -1,7 +1,7 @@
diff -ruNp elinks-0.12pre3.orig/configure.in elinks-0.12pre3/configure.in
--- elinks-0.12pre3.orig/configure.in 2009-04-28 12:19:38.816628000 +0200
+++ elinks-0.12pre3/configure.in 2009-04-28 12:56:07.343999815 +0200
-@@ -1021,6 +1022,37 @@ AC_ARG_WITH(openssl, [ --without-openss
+@@ -1020,6 +1020,37 @@ AC_ARG_WITH(openssl, [[ --with-openssl[=DIR] enable OpenSSL support (default
*) chosen_ssl_library="OpenSSL" ;;
esac])
@@ -39,7 +39,7 @@ diff -ruNp elinks-0.12pre3.orig/configure.in elinks-0.12pre3/configure.in
# ---- OpenSSL
AC_MSG_CHECKING([for OpenSSL])
-@@ -1143,10 +1175,11 @@ AC_MSG_RESULT($cf_result)
+@@ -1142,10 +1173,11 @@ fi
# Final SSL setup
@@ -223,7 +223,7 @@ diff -ruNp elinks-0.12pre3.orig/src/network/ssl/ssl.c elinks-0.12pre3/src/networ
socket->ssl = SSL_new(context);
if (!socket->ssl) return S_SSL_ERROR;
#elif defined(CONFIG_GNUTLS)
-@@ -263,7 +283,7 @@ done_ssl_connection(struct socket *socke
+@@ -271,7 +291,7 @@ done_ssl_connection(struct socket *socket)
ssl_t *ssl = socket->ssl;
if (!ssl) return;
@@ -232,7 +232,7 @@ diff -ruNp elinks-0.12pre3.orig/src/network/ssl/ssl.c elinks-0.12pre3/src/networ
SSL_free(ssl);
#elif defined(CONFIG_GNUTLS)
gnutls_deinit(*ssl);
-@@ -280,7 +300,7 @@ get_ssl_connection_cipher(struct socket
+@@ -288,7 +308,7 @@ get_ssl_connection_cipher(struct socket *socket)
if (!init_string(&str)) return NULL;
diff --git a/elinks-scroll.patch b/elinks-scroll.patch
index 39ec536..6d61766 100644
--- a/elinks-scroll.patch
+++ b/elinks-scroll.patch
@@ -4,69 +4,40 @@ Date: Sun Aug 31 14:23:28 2008 +0200
Use real_box in dialog.c.
-diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c
-index 644f643..5b94be0 100644
---- a/src/bfu/dialog.c
-+++ b/src/bfu/dialog.c
-@@ -82,20 +82,18 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
- }
-
- if (!dlg_data->dlg->layout.only_widgets) {
-- struct box box;
--
-- set_box(&box,
-+ set_box(&dlg_data->real_box,
- dlg_data->box.x + (DIALOG_LEFT_BORDER + 1),
- dlg_data->box.y + (DIALOG_TOP_BORDER + 1),
- dlg_data->box.width - 2 * (DIALOG_LEFT_BORDER + 1),
- dlg_data->box.height - 2 * (DIALOG_TOP_BORDER + 1));
-
-- draw_border(term, &box, get_bfu_color(term, "dialog.frame"), DIALOG_FRAME);
-+ draw_border(term, &dlg_data->real_box, get_bfu_color(term, "dialog.frame"), DIALOG_FRAME);
-
- assert(dlg_data->dlg->title);
-
- title_color = get_bfu_color(term, "dialog.title");
-- if (title_color && box.width > 2) {
-+ if (title_color && dlg_data->real_box.width > 2) {
- unsigned char *title = dlg_data->dlg->title;
- int titlelen = strlen(title);
- int titlecells = titlelen;
-@@ -107,7 +105,7 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
- &title[titlelen]);
- #endif /* CONFIG_UTF8 */
-
-- titlecells = int_min(box.width - 2, titlecells);
-+ titlecells = int_min(dlg_data->real_box.width - 2, titlecells);
-
- #ifdef CONFIG_UTF8
- if (term->utf8_cp)
-@@ -115,8 +113,8 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
- NULL);
- #endif /* CONFIG_UTF8 */
-
-- x = (box.width - titlecells) / 2 + box.x;
-- y = box.y - 1;
-+ x = (dlg_data->real_box.width - titlecells) / 2 + dlg_data->real_box.x;
-+ y = dlg_data->real_box.y - 1;
-
-
- draw_text(term, x - 1, y, " ", 1, 0, title_color);
-
-commit 0f02ab5501c976c1d9b9f42894f936a403773c58
-Author: Witold Filipczyk <witekfl at poczta.onet.pl>
-Date: Sun Aug 31 18:56:23 2008 +0200
-
- Added draw_text2 functions and others.
-
- draw2_text checks whether text of dialogs fit on the screen.
- At the start the bottom part of the dialogs is shown.
- Scrolling works with bittorrent. I did not check listbox.
+ src/bfu/button.c | 32 +++++++++++++-------------
+ src/bfu/button.h | 3 +-
+ src/bfu/checkbox.c | 13 +++++-----
+ src/bfu/checkbox.h | 3 +-
+ src/bfu/dialog.c | 59 ++++++++++++++++++++++++++++++++++-------------
+ src/bfu/dialog.h | 2 +
+ src/bfu/group.c | 18 +++++++-------
+ src/bfu/group.h | 2 +-
+ src/bfu/inpfield.c | 10 ++++----
+ src/bfu/inpfield.h | 2 +-
+ src/bfu/listbox.c | 3 +-
+ src/bfu/listbox.h | 2 +-
+ src/bfu/text.c | 16 +++++++-----
+ src/bfu/text.h | 5 ++-
+ src/dialogs/download.c | 12 +++++-----
+ src/terminal/draw.c | 36 +++++++++++++++++++++++++++++
+ src/terminal/draw.h | 10 ++++++++
+ src/terminal/window.c | 15 ++++++++++++
+ src/terminal/window.h | 2 +
+ 19 files changed, 170 insertions(+), 75 deletions(-)
diff --git a/src/bfu/button.c b/src/bfu/button.c
-index 0915b81..b5b0c66 100644
+index 8267c94..8e6ac62 100644
--- a/src/bfu/button.c
+++ b/src/bfu/button.c
+@@ -115,7 +115,7 @@ buttons_width(struct widget_data *widget_data, int n,
+ }
+
+ void
+-dlg_format_buttons(struct terminal *term,
++dlg_format_buttons(struct terminal *term, struct dialog_data *dlg_data,
+ struct widget_data *widget_data, int n,
+ int x, int *y, int w, int *rw, enum format_align align, int format_only)
+ {
@@ -212,7 +212,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
}
@@ -76,7 +47,7 @@ index 0915b81..b5b0c66 100644
if (len > 0) {
unsigned char *text = widget_data->widget->text;
int hk_pos = widget_data->widget->info.button.hotkey_pos;
-@@ -237,15 +237,15 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
+@@ -236,15 +236,15 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
NULL);
if (hk_pos)
@@ -95,7 +66,7 @@ index 0915b81..b5b0c66 100644
pos->y,
&text[hk_pos + hk_bytes + 1],
right - 1, 0, color);
-@@ -258,11 +258,11 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
+@@ -257,11 +257,11 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
len - hk_width,
NULL);
@@ -109,7 +80,7 @@ index 0915b81..b5b0c66 100644
&text[hk_len], len_to_display,
0, color);
}
-@@ -272,18 +272,18 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
+@@ -271,18 +271,18 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
int right = widget_data->widget->info.button.truetextlen - hk_pos - 1;
if (hk_pos) {
@@ -133,7 +104,7 @@ index 0915b81..b5b0c66 100644
}
}
#ifdef CONFIG_UTF8
-@@ -291,15 +291,15 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
+@@ -290,15 +290,15 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
@@ -153,10 +124,48 @@ index 0915b81..b5b0c66 100644
}
return EVENT_PROCESSED;
}
+diff --git a/src/bfu/button.h b/src/bfu/button.h
+index ca7b3d6..3f00b26 100644
+--- a/src/bfu/button.h
++++ b/src/bfu/button.h
+@@ -5,6 +5,7 @@
+ #include "util/align.h"
+
+ struct dialog;
++struct dialog_data;
+ struct terminal;
+ struct widget_data;
+
+@@ -48,6 +49,6 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge
+ #endif
+
+ extern const struct widget_ops button_ops;
+-void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
++void dlg_format_buttons(struct terminal *, struct dialog_data *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
+
+ #endif
diff --git a/src/bfu/checkbox.c b/src/bfu/checkbox.c
-index b44ce19..d7c974b 100644
+index 7ed97e0..d7c974b 100644
--- a/src/bfu/checkbox.c
+++ b/src/bfu/checkbox.c
+@@ -36,7 +36,7 @@ add_dlg_radio_do(struct dialog *dlg, unsigned char *text,
+ }
+
+ void
+-dlg_format_checkbox(struct terminal *term,
++dlg_format_checkbox(struct terminal *term, struct dialog_data *dlg_data,
+ struct widget_data *widget_data,
+ int x, int *y, int w, int *rw,
+ enum format_align align, int format_only)
+@@ -49,7 +49,7 @@ dlg_format_checkbox(struct terminal *term,
+
+ if (text && *text) {
+ if (rw) *rw -= CHECKBOX_LS;
+- dlg_format_text_do(term, text, x + CHECKBOX_LS, y,
++ dlg_format_text_do(term, dlg_data, text, x + CHECKBOX_LS, y,
+ w - CHECKBOX_LS, rw,
+ get_bfu_color(term, "dialog.checkbox-label"),
+ align, format_only);
@@ -78,11 +78,11 @@ display_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
else
text = widget_data->widget->info.checkbox.gid ? "( )" : "[ ]";
@@ -190,12 +199,72 @@ index b44ce19..d7c974b 100644
return EVENT_PROCESSED;
}
+diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h
+index 573f1d2..b4e65ce 100644
+--- a/src/bfu/checkbox.h
++++ b/src/bfu/checkbox.h
+@@ -2,6 +2,7 @@
+ #define EL__BFU_CHECKBOX_H
+
+ struct dialog;
++struct dialog_data;
+ struct terminal;
+ struct widget_data;
+
+@@ -30,7 +31,7 @@ void add_dlg_radio_do(struct dialog *dlg, unsigned char *text, int groupid, int
+ extern const struct widget_ops checkbox_ops;
+
+ void
+-dlg_format_checkbox(struct terminal *term,
++dlg_format_checkbox(struct terminal *term, struct dialog_data *dlg_data,
+ struct widget_data *widget_data,
+ int x, int *y, int w, int *rw,
+ enum format_align align, int format_only);
diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c
-index 5b94be0..bb4f901 100644
+index b2df9f8..414283f 100644
--- a/src/bfu/dialog.c
+++ b/src/bfu/dialog.c
-@@ -117,9 +117,9 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
- y = dlg_data->real_box.y - 1;
+@@ -82,20 +82,18 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
+ }
+
+ if (!dlg_data->dlg->layout.only_widgets) {
+- struct box box;
+-
+- set_box(&box,
++ set_box(&dlg_data->real_box,
+ dlg_data->box.x + (DIALOG_LEFT_BORDER + 1),
+ dlg_data->box.y + (DIALOG_TOP_BORDER + 1),
+ dlg_data->box.width - 2 * (DIALOG_LEFT_BORDER + 1),
+ dlg_data->box.height - 2 * (DIALOG_TOP_BORDER + 1));
+
+- draw_border(term, &box, get_bfu_color(term, "dialog.frame"), DIALOG_FRAME);
++ draw_border(term, &dlg_data->real_box, get_bfu_color(term, "dialog.frame"), DIALOG_FRAME);
+
+ assert(dlg_data->dlg->title);
+
+ title_color = get_bfu_color(term, "dialog.title");
+- if (title_color && box.width > 2) {
++ if (title_color && dlg_data->real_box.width > 2) {
+ unsigned char *title = dlg_data->dlg->title;
+ int titlelen = strlen(title);
+ int titlecells = titlelen;
+@@ -107,7 +105,7 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
+ &title[titlelen]);
+ #endif /* CONFIG_UTF8 */
+
+- titlecells = int_min(box.width - 2, titlecells);
++ titlecells = int_min(dlg_data->real_box.width - 2, titlecells);
+
+ #ifdef CONFIG_UTF8
+ if (term->utf8_cp)
+@@ -115,13 +113,13 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
+ NULL);
+ #endif /* CONFIG_UTF8 */
+
+- x = (box.width - titlecells) / 2 + box.x;
+- y = box.y - 1;
++ x = (dlg_data->real_box.width - titlecells) / 2 + dlg_data->real_box.x;
++ y = dlg_data->real_box.y - 1;
- draw_text(term, x - 1, y, " ", 1, 0, title_color);
@@ -207,7 +276,7 @@ index 5b94be0..bb4f901 100644
title_color);
}
}
-@@ -179,6 +179,23 @@ init_widget(struct dialog_data *dlg_data, int i)
+@@ -181,6 +179,23 @@ init_widget(struct dialog_data *dlg_data, int i)
return widget_data;
}
@@ -231,352 +300,45 @@ index 5b94be0..bb4f901 100644
void
select_widget(struct dialog_data *dlg_data, struct widget_data *widget_data)
{
-@@ -188,6 +205,9 @@ select_widget(struct dialog_data *dlg_data, struct widget_data *widget_data)
+@@ -190,6 +205,9 @@ select_widget(struct dialog_data *dlg_data, struct widget_data *widget_data)
dlg_data->selected_widget_id = widget_data - dlg_data->widgets_data;
-+ if (check_range(dlg_data, widget_data))
-+ return;
-+
- display_widget(dlg_data, previously_selected_widget);
- display_widget(dlg_data, widget_data);
- }
-@@ -226,6 +246,11 @@ cycle_widget_focus(struct dialog_data *dlg_data, int direction)
- } while (!widget_is_focusable(selected_widget(dlg_data))
- && dlg_data->selected_widget_id != prev_selected);
-
-+ if (check_range(dlg_data, selected_widget(dlg_data))) {
-+ redraw_from_window(dlg_data->win);
-+ return;
-+ }
-+
- display_widget(dlg_data, previously_selected_widget);
- display_widget(dlg_data, selected_widget(dlg_data));
- redraw_from_window(dlg_data->win);
-@@ -236,6 +261,7 @@ dialog_ev_init(struct dialog_data *dlg_data)
- {
- int i;
-
-+ dlg_data->y = 0;
- /* TODO: foreachback_widget() */
- for (i = dlg_data->number_of_widgets - 1; i >= 0; i--) {
- struct widget_data *widget_data;
-@@ -419,6 +445,7 @@ dialog_ev_abort(struct dialog_data *dlg_data)
- }
-
- freeml(dlg_data->ml);
-+ dlg_data->y = 0;
- }
-
- /* TODO: use EVENT_PROCESSED/EVENT_NOT_PROCESSED. */
-diff --git a/src/bfu/group.c b/src/bfu/group.c
-index c3da0d2..15bd827 100644
---- a/src/bfu/group.c
-+++ b/src/bfu/group.c
-@@ -87,14 +87,14 @@ dlg_format_group(struct terminal *term, struct dialog_data *dlg_data,
- text,
- label_length,
- NULL);
-- draw_text(term, xpos + width
-+ draw_text2(term, dlg_data, xpos + width
- + label_padding,
- *y, text, lb, 0,
- color);
- } else
- #endif /* CONFIG_UTF8 */
- {
-- draw_text(term, xpos + width
-+ draw_text2(term, dlg_data, xpos + width
- + label_padding,
- *y, text,
- label_length, 0,
-@@ -113,12 +113,12 @@ dlg_format_group(struct terminal *term, struct dialog_data *dlg_data,
- text,
- label_length,
- NULL);
-- draw_text(term, xpos, *y,
-+ draw_text2(term, dlg_data, xpos, *y,
- text, lb, 0, color);
- } else
- #endif /* CONFIG_UTF8 */
- {
-- draw_text(term, xpos, *y,
-+ draw_text2(term, dlg_data, xpos, *y,
- text, label_length,
- 0, color);
- }
-diff --git a/src/bfu/inpfield.c b/src/bfu/inpfield.c
-index 0e1ba35..4ba30eb 100644
---- a/src/bfu/inpfield.c
-+++ b/src/bfu/inpfield.c
-@@ -312,7 +312,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
- if (term->utf8_cp)
- w = utf8_cells2bytes(text, w, NULL);
- #endif /* CONFIG_UTF8 */
-- draw_text(term, widget_data->box.x, widget_data->box.y,
-+ draw_text2(term, dlg_data, widget_data->box.x, widget_data->box.y,
- text, w, 0, color);
- } else {
- struct box box;
-diff --git a/src/bfu/text.c b/src/bfu/text.c
-index c1bfc4c..3d2895e 100644
---- a/src/bfu/text.c
-+++ b/src/bfu/text.c
-@@ -256,7 +256,7 @@ dlg_format_text_do(struct terminal *term, struct dialog_data *dlg_data,
-
- assert(cells <= width && shift < width);
-
-- draw_text(term, x + shift, *y, text, line_width, 0, color);
-+ draw_text2(term, dlg_data, x + shift, *y, text, line_width, 0, color);
- }
- }
-
-@@ -397,8 +397,8 @@ display_text(struct dialog_data *dlg_data, struct widget_data *widget_data)
-
- /* Hope this is at least a bit reasonable. Set cursor
- * and window pointer to start of the first text line. */
-- set_cursor(win->term, widget_data->box.x, widget_data->box.y, 1);
-- set_window_ptr(win, widget_data->box.x, widget_data->box.y);
-+ set_cursor2(win->term, dlg_data, widget_data->box.x, widget_data->box.y, 1);
-+ set_window_ptr2(dlg_data, win, widget_data->box.x, widget_data->box.y);
-
- return EVENT_PROCESSED;
- }
-diff --git a/src/terminal/draw.c b/src/terminal/draw.c
-index 9189a2d..45deccb 100644
---- a/src/terminal/draw.c
-+++ b/src/terminal/draw.c
-@@ -7,6 +7,7 @@
-
- #include "elinks.h"
-
-+#include "bfu/dialog.h"
- #include "config/options.h"
- #include "intl/charsets.h"
- #include "terminal/color.h"
-@@ -559,6 +560,23 @@ draw_text(struct terminal *term, int x, int y,
- }
-
- void
-+draw_text2(struct terminal *term, struct dialog_data *dlg_data, int x, int y,
-+ unsigned char *text, int length,
-+ enum screen_char_attr attr, struct color_pair *color)
-+{
-+ struct box *box = &dlg_data->real_box;
-+
-+ if (box->height) {
-+ int y_max = box->y + box->height;
-+
-+ y -= dlg_data->y;
-+ if (y < box->y || y >= y_max) return;
-+ }
-+ draw_text(term, x, y, text, length, attr, color);
-+}
-+
-+
-+void
- set_cursor(struct terminal *term, int x, int y, int blockable)
- {
- assert(term && term->screen);
-@@ -580,6 +598,24 @@ set_cursor(struct terminal *term, int x, int y, int blockable)
- }
-
- void
-+set_cursor2(struct terminal *term, struct dialog_data *dlg_data, int x, int y, int blockable)
-+{
-+ struct box *box = &dlg_data->real_box;
-+
-+ assert(term && term->screen);
-+ if_assert_failed return;
-+
-+ if (box->height) {
-+ int y_max = box->y + box->height;
-+
-+ y -= dlg_data->y;
-+ if (y < box->y || y >= y_max) return;
-+ }
-+ set_cursor(term, x, y, blockable);
-+}
-+
-+
-+void
- clear_terminal(struct terminal *term)
- {
- struct box box;
-diff --git a/src/terminal/draw.h b/src/terminal/draw.h
-index 6dcd31a..20fba4e 100644
---- a/src/terminal/draw.h
-+++ b/src/terminal/draw.h
-@@ -4,6 +4,7 @@
- #include "intl/charsets.h" /* unicode_val_T */
-
- struct color_pair;
-+struct dialog_data;
- struct box;
- struct terminal;
-
-@@ -280,6 +281,12 @@ void draw_text(struct terminal *term, int x, int y,
- enum screen_char_attr attr,
- struct color_pair *color);
-
-+/** Draws text for dialogs. */
-+void draw_text2(struct terminal *term, struct dialog_data *dlg_data, int x, int y,
-+ unsigned char *text, int length,
-+ enum screen_char_attr attr, struct color_pair *color);
-+
-+
- /** Draws @a length chars from @a line on the screen. */
- void draw_line(struct terminal *term, int x, int y, int length,
- struct screen_char *line);
-@@ -289,6 +296,9 @@ void draw_line(struct terminal *term, int x, int y, int length,
- * bottom right corner of the screen. */
- void set_cursor(struct terminal *term, int x, int y, int blockable);
-
-+/* set cursor for dialogs */
-+void set_cursor2(struct terminal *term, struct dialog_data *dlg_data, int x, int y, int blockable);
-+
- /** Blanks the screen. */
- void clear_terminal(struct terminal *);
-
-diff --git a/src/terminal/window.c b/src/terminal/window.c
-index d4cd6c1..1d2273b 100644
---- a/src/terminal/window.c
-+++ b/src/terminal/window.c
-@@ -7,6 +7,7 @@
-
- #include "elinks.h"
-
-+#include "bfu/dialog.h"
- #include "bfu/menu.h"
- #include "terminal/event.h"
- #include "terminal/tab.h"
-@@ -205,3 +206,17 @@ assert_window_stacking(struct terminal *term)
- }
- }
- #endif /* CONFIG_DEBUG */
-+
-+void
-+set_window_ptr2(struct dialog_data *dlg_data, struct window *window, int x, int y)
-+{
-+ struct box *box = &dlg_data->real_box;
-+
-+ if (box->height) {
-+ int y_max = box->y + box->height;
-+
-+ y -= dlg_data->y;
-+ if (y < box->y || y >= y_max) return;
-+ }
-+ set_window_ptr(window, x, y);
-+}
-diff --git a/src/terminal/window.h b/src/terminal/window.h
-index e94da64..c9122f1 100644
---- a/src/terminal/window.h
-+++ b/src/terminal/window.h
-@@ -3,6 +3,7 @@
-
- #include "util/lists.h"
-
-+struct dialog_data;
- struct term_event;
- struct terminal;
- struct window;
-@@ -73,6 +74,7 @@ void add_window(struct terminal *, window_handler_T, void *);
- void delete_window(struct window *);
- void delete_window_ev(struct window *, struct term_event *ev);
- #define set_window_ptr(window, x_, y_) do { (window)->x = (x_); (window)->y = (y_); } while (0)
-+void set_window_ptr2(struct dialog_data *dlg_data, struct window *window, int x, int y);
- void get_parent_ptr(struct window *, int *, int *);
-
- void add_empty_window(struct terminal *, void (*)(void *), void *);
-
-commit 9fd863d024e00e1f907b1581780a195b59bf6f0a
-Author: Witold Filipczyk <witekfl at poczta.onet.pl>
-Date: Sun Aug 31 14:17:45 2008 +0200
-
- Pass dlg_data to all format functions. It will be used later by
- scrolling.
-
-diff --git a/src/bfu/button.c b/src/bfu/button.c
-index b567251..0915b81 100644
---- a/src/bfu/button.c
-+++ b/src/bfu/button.c
-@@ -115,7 +115,7 @@ buttons_width(struct widget_data *widget_data, int n,
- }
-
- void
--dlg_format_buttons(struct terminal *term,
-+dlg_format_buttons(struct terminal *term, struct dialog_data *dlg_data,
- struct widget_data *widget_data, int n,
- int x, int *y, int w, int *rw, enum format_align align, int format_only)
- {
-diff --git a/src/bfu/button.h b/src/bfu/button.h
-index ca7b3d6..3f00b26 100644
---- a/src/bfu/button.h
-+++ b/src/bfu/button.h
-@@ -5,6 +5,7 @@
- #include "util/align.h"
-
- struct dialog;
-+struct dialog_data;
- struct terminal;
- struct widget_data;
-
-@@ -48,6 +49,6 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge
- #endif
-
- extern const struct widget_ops button_ops;
--void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
-+void dlg_format_buttons(struct terminal *, struct dialog_data *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
-
- #endif
-diff --git a/src/bfu/checkbox.c b/src/bfu/checkbox.c
-index 7ed97e0..b44ce19 100644
---- a/src/bfu/checkbox.c
-+++ b/src/bfu/checkbox.c
-@@ -36,7 +36,7 @@ add_dlg_radio_do(struct dialog *dlg, unsigned char *text,
- }
-
- void
--dlg_format_checkbox(struct terminal *term,
-+dlg_format_checkbox(struct terminal *term, struct dialog_data *dlg_data,
- struct widget_data *widget_data,
- int x, int *y, int w, int *rw,
- enum format_align align, int format_only)
-@@ -49,7 +49,7 @@ dlg_format_checkbox(struct terminal *term,
-
- if (text && *text) {
- if (rw) *rw -= CHECKBOX_LS;
-- dlg_format_text_do(term, text, x + CHECKBOX_LS, y,
-+ dlg_format_text_do(term, dlg_data, text, x + CHECKBOX_LS, y,
- w - CHECKBOX_LS, rw,
- get_bfu_color(term, "dialog.checkbox-label"),
- align, format_only);
-diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h
-index 573f1d2..b4e65ce 100644
---- a/src/bfu/checkbox.h
-+++ b/src/bfu/checkbox.h
-@@ -2,6 +2,7 @@
- #define EL__BFU_CHECKBOX_H
++ if (check_range(dlg_data, widget_data))
++ return;
++
+ display_widget(dlg_data, previously_selected_widget);
+ display_widget(dlg_data, widget_data);
+ }
+@@ -228,6 +246,11 @@ cycle_widget_focus(struct dialog_data *dlg_data, int direction)
+ } while (!widget_is_focusable(selected_widget(dlg_data))
+ && dlg_data->selected_widget_id != prev_selected);
- struct dialog;
-+struct dialog_data;
- struct terminal;
- struct widget_data;
++ if (check_range(dlg_data, selected_widget(dlg_data))) {
++ redraw_from_window(dlg_data->win);
++ return;
++ }
++
+ display_widget(dlg_data, previously_selected_widget);
+ display_widget(dlg_data, selected_widget(dlg_data));
+ redraw_from_window(dlg_data->win);
+@@ -238,6 +261,7 @@ dialog_ev_init(struct dialog_data *dlg_data)
+ {
+ int i;
-@@ -30,7 +31,7 @@ void add_dlg_radio_do(struct dialog *dlg, unsigned char *text, int groupid, int
- extern const struct widget_ops checkbox_ops;
++ dlg_data->y = 0;
+ /* TODO: foreachback_widget() */
+ for (i = dlg_data->number_of_widgets - 1; i >= 0; i--) {
+ struct widget_data *widget_data;
+@@ -421,6 +445,7 @@ dialog_ev_abort(struct dialog_data *dlg_data)
+ }
- void
--dlg_format_checkbox(struct terminal *term,
-+dlg_format_checkbox(struct terminal *term, struct dialog_data *dlg_data,
- struct widget_data *widget_data,
- int x, int *y, int w, int *rw,
- enum format_align align, int format_only);
-diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c
-index f99e781..644f643 100644
---- a/src/bfu/dialog.c
-+++ b/src/bfu/dialog.c
-@@ -554,17 +554,17 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
+ freeml(dlg_data->ml);
++ dlg_data->y = 0;
+ }
+
+ /* TODO: use EVENT_PROCESSED/EVENT_NOT_PROCESSED. */
+@@ -554,17 +579,17 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
switch (wdata->widget->type) {
case WIDGET_FIELD_PASS:
case WIDGET_FIELD:
@@ -597,7 +359,7 @@ index f99e781..644f643 100644
format_only);
break;
-@@ -583,7 +583,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
+@@ -583,7 +608,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
break;
}
@@ -606,7 +368,7 @@ index f99e781..644f643 100644
format_only);
wdata += size - 1;
-@@ -591,7 +591,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
+@@ -591,7 +616,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
/* No horizontal space between checkboxes belonging to
* the same group. */
@@ -615,7 +377,7 @@ index f99e781..644f643 100644
ALIGN_LEFT, format_only);
if (widgets > 1
&& group == widget_has_group(&wdata[1]))
-@@ -603,7 +603,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
+@@ -603,7 +628,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
/* We assume that the buttons are all stuffed at the very end
* of the dialog. */
case WIDGET_BUTTON:
@@ -638,7 +400,7 @@ index b0cde3b..bec914c 100644
int selected_widget_id;
struct term_event *term_event;
diff --git a/src/bfu/group.c b/src/bfu/group.c
-index cc4c6d8..c3da0d2 100644
+index cc4c6d8..15bd827 100644
--- a/src/bfu/group.c
+++ b/src/bfu/group.c
@@ -20,7 +20,7 @@
@@ -650,6 +412,38 @@ index cc4c6d8..c3da0d2 100644
struct widget_data *widget_data,
int n, int x, int *y, int w, int *rw, int format_only)
{
+@@ -87,14 +87,14 @@ dlg_format_group(struct terminal *term,
+ text,
+ label_length,
+ NULL);
+- draw_text(term, xpos + width
++ draw_text2(term, dlg_data, xpos + width
+ + label_padding,
+ *y, text, lb, 0,
+ color);
+ } else
+ #endif /* CONFIG_UTF8 */
+ {
+- draw_text(term, xpos + width
++ draw_text2(term, dlg_data, xpos + width
+ + label_padding,
+ *y, text,
+ label_length, 0,
+@@ -113,12 +113,12 @@ dlg_format_group(struct terminal *term,
+ text,
+ label_length,
+ NULL);
+- draw_text(term, xpos, *y,
++ draw_text2(term, dlg_data, xpos, *y,
+ text, lb, 0, color);
+ } else
+ #endif /* CONFIG_UTF8 */
+ {
+- draw_text(term, xpos, *y,
++ draw_text2(term, dlg_data, xpos, *y,
+ text, label_length,
+ 0, color);
+ }
@@ -155,11 +155,11 @@ group_layouter(struct dialog_data *dlg_data)
#endif /* CONFIG_UTF8 */
rw = int_min(w, strlen(dlg_data->dlg->title));
@@ -691,7 +485,7 @@ index 0de645d..9b92c2a 100644
int n, int x, int *y, int w, int *rw, int format_only);
diff --git a/src/bfu/inpfield.c b/src/bfu/inpfield.c
-index f0b8539..0e1ba35 100644
+index 4c0dcd2..0a9c63e 100644
--- a/src/bfu/inpfield.c
+++ b/src/bfu/inpfield.c
@@ -103,7 +103,7 @@ check_nonempty(struct dialog_data *dlg_data, struct widget_data *widget_data)
@@ -721,7 +515,16 @@ index f0b8539..0e1ba35 100644
x + label_width, y, w, rw,
text_color, ALIGN_LEFT, format_only);
w -= INPUTFIELD_FLOAT_SEPARATOR_LEN + INPUTFIELD_FLOATLABEL_PADDING;
-@@ -765,7 +765,7 @@ input_line_layouter(struct dialog_data *dlg_data)
+@@ -312,7 +312,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
+ if (term->utf8_cp)
+ w = utf8_cells2bytes(text, w, NULL);
+ #endif /* CONFIG_UTF8 */
+- draw_text(term, widget_data->box.x, widget_data->box.y,
++ draw_text2(term, dlg_data, widget_data->box.x, widget_data->box.y,
+ text, w, 0, color);
+ } else {
+ struct box box;
+@@ -763,7 +763,7 @@ input_line_layouter(struct dialog_data *dlg_data)
- ses->status.show_status_bar
- ses->status.show_tabs_bar;
@@ -744,7 +547,7 @@ index d45a902..fb2270e 100644
void input_field(struct terminal *, struct memory_list *, int, unsigned char *,
unsigned char *, unsigned char *, unsigned char *, void *,
diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c
-index 2e27aba..c4a4160 100644
+index 7ec1b66..e4de12f 100644
--- a/src/bfu/listbox.c
+++ b/src/bfu/listbox.c
@@ -41,7 +41,8 @@ get_listbox_widget_data(struct widget_data *widget_data)
@@ -771,7 +574,7 @@ index c3599e5..63b8be4 100644
struct listbox_item *traverse_listbox_items_list(struct listbox_item *, struct listbox_data *, int, int, int (*)(struct listbox_item *, void *, int *), void *);
diff --git a/src/bfu/text.c b/src/bfu/text.c
-index e8be019..c1bfc4c 100644
+index e8be019..3d2895e 100644
--- a/src/bfu/text.c
+++ b/src/bfu/text.c
@@ -211,7 +211,8 @@ split_lines(struct widget_data *widget_data, int max_width)
@@ -784,7 +587,13 @@ index e8be019..c1bfc4c 100644
int x, int *y, int width, int *real_width,
struct color_pair *color, enum format_align align,
int format_only)
-@@ -260,7 +261,8 @@ dlg_format_text_do(struct terminal *term, unsigned char *text,
+@@ -255,12 +256,13 @@ dlg_format_text_do(struct terminal *term, unsigned char *text,
+
+ assert(cells <= width && shift < width);
+
+- draw_text(term, x + shift, *y, text, line_width, 0, color);
++ draw_text2(term, dlg_data, x + shift, *y, text, line_width, 0, color);
+ }
}
void
@@ -803,6 +612,17 @@ index e8be019..c1bfc4c 100644
x, y, width, real_width,
get_bfu_color(term, "dialog.text"),
widget_data->widget->info.text.align, format_only);
+@@ -395,8 +397,8 @@ display_text(struct dialog_data *dlg_data, struct widget_data *widget_data)
+
+ /* Hope this is at least a bit reasonable. Set cursor
+ * and window pointer to start of the first text line. */
+- set_cursor(win->term, widget_data->box.x, widget_data->box.y, 1);
+- set_window_ptr(win, widget_data->box.x, widget_data->box.y);
++ set_cursor2(win->term, dlg_data, widget_data->box.x, widget_data->box.y, 1);
++ set_window_ptr2(dlg_data, win, widget_data->box.x, widget_data->box.y);
+
+ return EVENT_PROCESSED;
+ }
@@ -423,7 +425,7 @@ format_and_display_text(struct widget_data *widget_data,
draw_box(term, &widget_data->box, ' ', 0,
get_bfu_color(term, "dialog.generic"));
@@ -889,3 +709,149 @@ index 0116578..b90f047 100644
dlg_data->number_of_widgets, x, &y, w,
NULL, ALIGN_CENTER, 0);
+diff --git a/src/terminal/draw.c b/src/terminal/draw.c
+index b3b3706..267d9ac 100644
+--- a/src/terminal/draw.c
++++ b/src/terminal/draw.c
+@@ -7,6 +7,7 @@
+
+ #include "elinks.h"
+
++#include "bfu/dialog.h"
+ #include "config/options.h"
+ #include "intl/charsets.h"
+ #include "terminal/color.h"
+@@ -559,6 +560,23 @@ draw_text(struct terminal *term, int x, int y,
+ }
+
+ void
++draw_text2(struct terminal *term, struct dialog_data *dlg_data, int x, int y,
++ unsigned char *text, int length,
++ enum screen_char_attr attr, struct color_pair *color)
++{
++ struct box *box = &dlg_data->real_box;
++
++ if (box->height) {
++ int y_max = box->y + box->height;
++
++ y -= dlg_data->y;
++ if (y < box->y || y >= y_max) return;
++ }
++ draw_text(term, x, y, text, length, attr, color);
++}
++
++
++void
+ set_cursor(struct terminal *term, int x, int y, int blockable)
+ {
+ assert(term && term->screen);
+@@ -580,6 +598,24 @@ set_cursor(struct terminal *term, int x, int y, int blockable)
+ }
+
+ void
++set_cursor2(struct terminal *term, struct dialog_data *dlg_data, int x, int y, int blockable)
++{
++ struct box *box = &dlg_data->real_box;
++
++ assert(term && term->screen);
++ if_assert_failed return;
++
++ if (box->height) {
++ int y_max = box->y + box->height;
++
++ y -= dlg_data->y;
++ if (y < box->y || y >= y_max) return;
++ }
++ set_cursor(term, x, y, blockable);
++}
++
++
++void
+ clear_terminal(struct terminal *term)
+ {
+ struct box box;
+diff --git a/src/terminal/draw.h b/src/terminal/draw.h
+index 6dcd31a..20fba4e 100644
+--- a/src/terminal/draw.h
++++ b/src/terminal/draw.h
+@@ -4,6 +4,7 @@
+ #include "intl/charsets.h" /* unicode_val_T */
+
+ struct color_pair;
++struct dialog_data;
+ struct box;
+ struct terminal;
+
+@@ -280,6 +281,12 @@ void draw_text(struct terminal *term, int x, int y,
+ enum screen_char_attr attr,
+ struct color_pair *color);
+
++/** Draws text for dialogs. */
++void draw_text2(struct terminal *term, struct dialog_data *dlg_data, int x, int y,
++ unsigned char *text, int length,
++ enum screen_char_attr attr, struct color_pair *color);
++
++
+ /** Draws @a length chars from @a line on the screen. */
+ void draw_line(struct terminal *term, int x, int y, int length,
+ struct screen_char *line);
+@@ -289,6 +296,9 @@ void draw_line(struct terminal *term, int x, int y, int length,
+ * bottom right corner of the screen. */
+ void set_cursor(struct terminal *term, int x, int y, int blockable);
+
++/* set cursor for dialogs */
++void set_cursor2(struct terminal *term, struct dialog_data *dlg_data, int x, int y, int blockable);
++
+ /** Blanks the screen. */
+ void clear_terminal(struct terminal *);
+
+diff --git a/src/terminal/window.c b/src/terminal/window.c
+index d4cd6c1..1d2273b 100644
+--- a/src/terminal/window.c
++++ b/src/terminal/window.c
+@@ -7,6 +7,7 @@
+
+ #include "elinks.h"
+
++#include "bfu/dialog.h"
+ #include "bfu/menu.h"
+ #include "terminal/event.h"
+ #include "terminal/tab.h"
+@@ -205,3 +206,17 @@ assert_window_stacking(struct terminal *term)
+ }
+ }
+ #endif /* CONFIG_DEBUG */
++
++void
++set_window_ptr2(struct dialog_data *dlg_data, struct window *window, int x, int y)
++{
++ struct box *box = &dlg_data->real_box;
++
++ if (box->height) {
++ int y_max = box->y + box->height;
++
++ y -= dlg_data->y;
++ if (y < box->y || y >= y_max) return;
++ }
++ set_window_ptr(window, x, y);
++}
+diff --git a/src/terminal/window.h b/src/terminal/window.h
+index e94da64..c9122f1 100644
+--- a/src/terminal/window.h
++++ b/src/terminal/window.h
+@@ -3,6 +3,7 @@
+
+ #include "util/lists.h"
+
++struct dialog_data;
+ struct term_event;
+ struct terminal;
+ struct window;
+@@ -73,6 +74,7 @@ void add_window(struct terminal *, window_handler_T, void *);
+ void delete_window(struct window *);
+ void delete_window_ev(struct window *, struct term_event *ev);
+ #define set_window_ptr(window, x_, y_) do { (window)->x = (x_); (window)->y = (y_); } while (0)
++void set_window_ptr2(struct dialog_data *dlg_data, struct window *window, int x, int y);
+ void get_parent_ptr(struct window *, int *, int *);
+
+ void add_empty_window(struct terminal *, void (*)(void *), void *);
More information about the scm-commits
mailing list