summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog27
-rw-r--r--README3
-rw-r--r--configure.in2
-rw-r--r--dillorc5
-rw-r--r--dlib/dlib.c4
-rw-r--r--dpi/bookmarks.c5
-rw-r--r--dpi/cookies.c9
-rw-r--r--dpi/downloads.cc10
-rw-r--r--dpi/https.c2
-rw-r--r--dpid/Makefile.am16
-rw-r--r--dpid/dpid.c2
-rw-r--r--dpid/dpidrc.in6
-rw-r--r--dw/findtext.hh2
-rw-r--r--dw/fltkviewbase.cc4
-rw-r--r--dw/style.hh4
-rw-r--r--lout/misc.hh2
-rw-r--r--lout/object.cc4
-rw-r--r--src/IO/dpi.c6
-rw-r--r--src/IO/http.c1
-rw-r--r--src/cookies.c3
-rw-r--r--src/css.cc4
-rw-r--r--src/dialog.cc2
-rw-r--r--src/dillo.cc7
-rw-r--r--src/dns.c34
-rw-r--r--src/dns.h2
-rw-r--r--src/html.cc20
-rw-r--r--src/prefs.c6
-rw-r--r--src/prefs.h1
-rw-r--r--src/styleengine.cc1
-rw-r--r--src/table.cc7
-rw-r--r--src/ui.cc12
-rw-r--r--src/ui.hh3
-rw-r--r--src/uicmd.cc54
-rw-r--r--src/uicmd.hh3
-rw-r--r--src/url.h12
35 files changed, 193 insertions, 92 deletions
diff --git a/ChangeLog b/ChangeLog
index cdbb2284..7589c70a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,22 +4,37 @@ Dillo project
dillo-2.1
++- Added ipv6 addresses iteration and ipv4 fallback.
+ Patch: James Turner, Jorge Arellano
+- Added support for numeric IPv6 addresses entered into the url bar.
- Used the URL authority part instead of stripped default port in HTTP query.
Patches: Justus Winter
+- Fix for file inputs without values (forms).
- Tuned input width a bit.
- Cleaned up resource embedding (forms)
+ - Made cookierc parsing more robust.
+ - Switched a_UIcmd_save() to take its URL from history (not location bar).
+ - Set prefs.vw_fontname as deafult font for the UI.
+ - Fix: recover page focus when clicking-out of a widget.
Patches: place (AKA corvid)
-+- Switched SSL enabled to configure.in (./configure --enable-ssl).
- Patch: Jeremy Henty
++- Switched SSL-enabled to configure.in (./configure --enable-ssl).
+ - Standardised the installation of dpid/dpidrc with auto* tools.
+ - Set the ScrollGroup as the resizable widget in downloads dpi.
+ - Cleaned up and normalized D_SUN_LEN usage.
+ Patches: Jeremy Henty
+- Allowed compilation with older machines by removing a few C99isms.
- Added use of inttypes.h when stdint.h isn't found.
Patches: Dan Fandrich
-+- Added ipv6 addresses iteration and ipv4 fallback.
- Patch: James Turner, Jorge Arellano
-+- Set the File menu label to hide when the File menu button is shown.
- Patch: Jorge Arellano
++- Made the DNS resolver report in numeric address notation.
+ Patch: Justus Winter
++- Reduced warnings with gcc-4.3.
+ Patch: Thomas Orgis
++- Added the "middle_click_drags_page" dillorc option.
+ Patch: Jorge Arellano, Thomas Orgis
++- Set the File menu label to hide when the File menu-button is shown.
+ ? Trying a new iconv() test in configure.in.
+ - Allowed the rc parser to skip whitespace around the equal sign.
+ Patches: Jorge Arellano
dw
diff --git a/README b/README
index 80f697fb..e927763b 100644
--- a/README
+++ b/README
@@ -23,7 +23,8 @@ In brief, a better dillo.
FLTK2
-----
- You can get the fltk2 library from fltk.org.
+ The FLTK2 library is statically linked into Dillo2.
+ You can get it from fltk.org.
The recommended version is >= r6403. e.g. in:
http://fltk.org/software.php?VERSION=2.0.x-r6403
diff --git a/configure.in b/configure.in
index 58ee8724..8e383ba5 100644
--- a/configure.in
+++ b/configure.in
@@ -334,6 +334,7 @@ if test "x$iconv_ok" = "xyes"; then
LIBS="$old_libs $LIBICONV_LIBS"
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
+ AC_LANG_PUSH([C++])
AC_TRY_COMPILE([#include <iconv.h>],
[
const char *inPtr;
@@ -343,6 +344,7 @@ if test "x$iconv_ok" = "xyes"; then
iconv(encoder, &inPtr, &inLeft, &outPtr, &outRoom);
],
iconv_old=yes,iconv_old=no)
+ AC_LANG_POP([C++])
LIBS="$old_libs"
CFLAGS="$old_cflags"
diff --git a/dillorc b/dillorc
index 05debda6..e61b1c40 100644
--- a/dillorc
+++ b/dillorc
@@ -203,6 +203,11 @@
# If you prefer to open a new Window instead, set it to NO.
#middle_click_opens_new_tab=YES
+# Mouse middle click by default drives drag-scrolling.
+# To paste an URL into the window instead of scrolling, set it to NO.
+# Note: You could always paste the URL onto the URL box clear button.
+#middle_click_drags_page=YES
+
# Focus follows new Tabs.
# You can hold SHIFT to temporarily revert this behaviour.
#focus_new_tab=YES
diff --git a/dlib/dlib.c b/dlib/dlib.c
index 76797af5..0f318134 100644
--- a/dlib/dlib.c
+++ b/dlib/dlib.c
@@ -776,6 +776,10 @@ int dParser_get_rc_pair(char **line, char **name, char **value)
*p = 0;
*name = *line;
+ /* skip whitespace */
+ if (p < eq)
+ for (++p; isspace(*p); ++p);
+
/* get value */
if (p == eq) {
for (++p; isspace(*p); ++p);
diff --git a/dpi/bookmarks.c b/dpi/bookmarks.c
index e5447331..a20d8ef6 100644
--- a/dpi/bookmarks.c
+++ b/dpi/bookmarks.c
@@ -44,11 +44,6 @@
#define _MSG(...)
#define MSG(...) printf("[bookmarks dpi]: " __VA_ARGS__)
-/* This one is tricky, some sources state it should include the byte
- * for the terminating NULL, and others say it shouldn't. */
-# define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
- + strlen ((ptr)->sun_path))
-
#define DOCTYPE \
"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"
diff --git a/dpi/cookies.c b/dpi/cookies.c
index bfdf3b3d..5b5bc35d 100644
--- a/dpi/cookies.c
+++ b/dpi/cookies.c
@@ -64,12 +64,6 @@ int main(void)
#define MSG(...) printf("[cookies dpi]: " __VA_ARGS__)
-/* This one is tricky, some sources state it should include the byte
- * for the terminating NULL, and others say it shouldn't. */
-# define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
- + strlen ((ptr)->sun_path))
-
-
/*
* a_List_add()
*
@@ -1247,12 +1241,11 @@ static int Cookie_control_init(void)
j = 0;
/* Get the domain */
- while (!isspace(line[i]))
+ while (line[i] != '\0' && !isspace(line[i]))
domain[j++] = line[i++];
domain[j] = '\0';
/* Skip past whitespaces */
- i++;
while (isspace(line[i]))
i++;
diff --git a/dpi/downloads.cc b/dpi/downloads.cc
index d2f3a54b..053d2de0 100644
--- a/dpi/downloads.cc
+++ b/dpi/downloads.cc
@@ -513,7 +513,7 @@ void DLItem::log_text_add(const char *buf, ssize_t st)
if (isdigit(*q++ = *p)) {
// keep here
} else if (*p == 'K') {
- for(--q; isdigit(q[-1]); --q); log_state = ST_discard;
+ for(--q; isdigit(q[-1]); --q) ; log_state = ST_discard;
} else {
log_state = ST_copy;
}
@@ -1027,10 +1027,10 @@ void DLWin::del(int n_item)
{
DLItem *dl_item = mDList->get(n_item);
- // Remove the widget from the scroll group
+ // Remove the widget from the packed group
mPG->remove(dl_item->get_widget());
- // Resize the scroll group
- mPG->resize(mWin->w(), 1);
+ // WORKAROUND: without this call FLTK2 doesn't clear the background.
+ mScroll->redraw();
mDList->del(n_item);
delete(dl_item);
@@ -1093,7 +1093,7 @@ DLWin::DLWin(int ww, int wh) {
mScroll->end();
mScroll->type(ScrollGroup::VERTICAL);
mWin->end();
- mWin->resizable(mPG);
+ mWin->resizable(mScroll);
mWin->callback(dlwin_esc_cb, NULL);
mWin->show();
diff --git a/dpi/https.c b/dpi/https.c
index 33c9b2d6..fff0be3b 100644
--- a/dpi/https.c
+++ b/dpi/https.c
@@ -25,7 +25,7 @@
* the https dillo plugin with the OpenSSL project's "OpenSSL"
* library, and distribute the linked executables, without including
* the source code for OpenSSL in the source distribution. You must
- * obey the GNU General Public License, version 2, in all respects
+ * obey the GNU General Public License, version 3, in all respects
* for all of the code used other than "OpenSSL".
*
*/
diff --git a/dpid/Makefile.am b/dpid/Makefile.am
index 938a6244..13e1aff2 100644
--- a/dpid/Makefile.am
+++ b/dpid/Makefile.am
@@ -3,7 +3,7 @@ AM_CPPFLAGS=-DDPIDRC_SYS='"$(sysconfdir)/dpidrc"'
bin_PROGRAMS = dpid
dpid_LDADD = ../dpip/libDpip.a ../dlib/libDlib.a
-EXTRA_DIST = dpidc
+EXTRA_DIST = dpidc dpidrc.in
bin_SCRIPTS = dpidc
dpid_SOURCES = \
@@ -21,11 +21,9 @@ dpid_SOURCES = \
main.c \
misc_new.c
-install-data-local :
- $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
- echo dpi_dir=$(libdir)/dillo/dpi > $(DESTDIR)$(sysconfdir)/dpidrc
- echo >> $(DESTDIR)$(sysconfdir)/dpidrc
- echo "proto.file=file/file.dpi" >> $(DESTDIR)$(sysconfdir)/dpidrc
- echo "proto.ftp=ftp/ftp.filter.dpi" >> $(DESTDIR)$(sysconfdir)/dpidrc
- echo "proto.https=https/https.filter.dpi" >> $(DESTDIR)$(sysconfdir)/dpidrc
- echo "proto.data=datauri/datauri.filter.dpi" >> $(DESTDIR)$(sysconfdir)/dpidrc
+sysconf_DATA = dpidrc
+CLEANFILES = $(sysconf_DATA)
+
+dpidrc: dpidrc.in Makefile
+ sed -e 's|[@]libdir[@]|$(libdir)|' dpidrc.in > dpidrc
+
diff --git a/dpid/dpid.c b/dpid/dpid.c
index 97e6414d..2eed0f02 100644
--- a/dpid/dpid.c
+++ b/dpid/dpid.c
@@ -728,7 +728,6 @@ void stop_active_dpis(struct dp *dpi_attr_list, int numdpis)
DpiBye_cmd = a_Dpip_build_cmd("cmd=%s", "DpiBye");
sun_path_len = sizeof(sa.sun_path);
- addr_len = sizeof(dpi_addr);
dpi_addr.sun_family = AF_LOCAL;
@@ -746,6 +745,7 @@ void stop_active_dpis(struct dp *dpi_attr_list, int numdpis)
MSG_ERR("\n - socket path = %s\n", dpi_attr_list[i].sockpath);
}
strncpy(dpi_addr.sun_path, dpi_attr_list[i].sockpath, sun_path_len);
+ addr_len = D_SUN_LEN(&dpi_addr);
if (connect(dpi_socket, (struct sockaddr *) &dpi_addr, addr_len) == -1) {
ERRMSG("stop_active_dpis", "connect", errno);
MSG_ERR("%s\n", dpi_addr.sun_path);
diff --git a/dpid/dpidrc.in b/dpid/dpidrc.in
new file mode 100644
index 00000000..23374d96
--- /dev/null
+++ b/dpid/dpidrc.in
@@ -0,0 +1,6 @@
+dpi_dir=@libdir@/dillo/dpi
+
+proto.file=file/file.dpi
+proto.ftp=ftp/ftp.filter.dpi
+proto.https=https/https.filter.dpi
+proto.data=datauri/datauri.filter.dpi
diff --git a/dw/findtext.hh b/dw/findtext.hh
index d0c20206..e9fb57c2 100644
--- a/dw/findtext.hh
+++ b/dw/findtext.hh
@@ -65,7 +65,7 @@ private:
inline static bool charsEqual (char c1, char c2, bool caseSens)
{ return caseSens ? c1 == c2 : tolower (c1) == tolower (c2) ||
- isspace (c1) && isspace (c2); }
+ (isspace (c1) && isspace (c2)); }
public:
FindtextState ();
diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc
index a282efd8..6e0f5bd7 100644
--- a/dw/fltkviewbase.cc
+++ b/dw/fltkviewbase.cc
@@ -204,6 +204,10 @@ int FltkViewBase::handle (int event)
translateViewYToCanvasY (event_y ()),
getDwButtonState (), event_button ());
//printf ("PUSH => %s\n", processed ? "true" : "false");
+ if (processed) {
+ /* pressed dw content; fltk widgets should no longer have focus */
+ ::fltk::focus(NULL);
+ }
return processed ? true : Group::handle (event);
case RELEASE:
diff --git a/dw/style.hh b/dw/style.hh
index 492efd30..0dd7fbd4 100644
--- a/dw/style.hh
+++ b/dw/style.hh
@@ -346,11 +346,11 @@ inline Length createAbsLength(int n) { return (n << 2) | 1; }
/** \brief Returns a percentage, \em v is relative to 1, not to 100. */
inline Length createPerLength(double v) {
- return (int)(v * (1 << 18)) & ~3 | 2; }
+ return ((int)(v * (1 << 18)) & ~3) | 2; }
/** \brief Returns a relative length. */
inline Length createRelLength(double v) {
- return (int)(v * (1 << 18)) & ~3 | 3; }
+ return ((int)(v * (1 << 18)) & ~3) | 3; }
/** \brief Returns true if \em l is an absolute length. */
inline bool isAbsLength(Length l) { return (l & 3) == 1; }
diff --git a/lout/misc.hh b/lout/misc.hh
index 8cd67f78..730a47a4 100644
--- a/lout/misc.hh
+++ b/lout/misc.hh
@@ -166,7 +166,7 @@ public:
*/
inline T* getRef (int i) {
if (BOUND_CHECKING)
- assert (i >= 0 && i < this->num);
+ assert (i >= 0 && this->num - i > 0);
return array + i;
}
diff --git a/lout/object.cc b/lout/object.cc
index 7da124fa..9e36e20c 100644
--- a/lout/object.cc
+++ b/lout/object.cc
@@ -251,7 +251,7 @@ bool PairBase::equals(Object *other)
return
// Identical?
- this == other ||
+ this == other || (
(// Both first parts are NULL, ...
(first == NULL && otherPair->first == NULL) ||
// ... or both first parts are not NULL and equal
@@ -260,7 +260,7 @@ bool PairBase::equals(Object *other)
// Same with second part.
((second == NULL && otherPair->second == NULL) ||
(second != NULL && otherPair->second != NULL
- && second->equals (otherPair->second)));
+ && second->equals (otherPair->second))));
}
int PairBase::hashValue()
diff --git a/src/IO/dpi.c b/src/IO/dpi.c
index 7c4357da..01d3a5b5 100644
--- a/src/IO/dpi.c
+++ b/src/IO/dpi.c
@@ -353,7 +353,7 @@ static int Dpi_check_uds(char *uds_name)
strncpy(pun.sun_path, uds_name, sizeof (pun.sun_path));
if ((SockFD = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1 ||
- connect(SockFD, (void*)&pun, D_SUN_LEN(&pun)) == -1) {
+ connect(SockFD, (struct sockaddr *) &pun, D_SUN_LEN(&pun)) == -1) {
MSG("Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name);
} else {
Dpi_close_fd(SockFD);
@@ -497,7 +497,7 @@ static char *Dpi_get_server_uds_name(const char *server_name)
_MSG("dpid_uds_name = [%s]\n", dpid_uds_name);
strncpy(dpid.sun_path, dpid_uds_name, sizeof(dpid.sun_path));
- if (connect(sock, (struct sockaddr *) &dpid, sizeof(dpid)) == -1)
+ if (connect(sock, (struct sockaddr *) &dpid, D_SUN_LEN(&dpid)) == -1)
perror("connect");
/* ask dpid to check the server plugin and send its UDS name back */
request = a_Dpip_build_cmd("cmd=%s msg=%s", "check_server", server_name);
@@ -717,7 +717,6 @@ void a_Dpi_bye_dpid()
srs_name = Dpi_get_dpid_uds_name();
sun_path_len = sizeof(sa.sun_path);
- addr_len = sizeof(sa);
sa.sun_family = AF_LOCAL;
@@ -725,6 +724,7 @@ void a_Dpi_bye_dpid()
MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno));
}
strncpy(sa.sun_path, srs_name, sizeof (sa.sun_path));
+ addr_len = D_SUN_LEN(&sa);
if (connect(new_socket, (struct sockaddr *) &sa, addr_len) == -1) {
MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno));
MSG("%s\n", sa.sun_path);
diff --git a/src/IO/http.c b/src/IO/http.c
index 692a9520..2c50e829 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -398,6 +398,7 @@ static int Http_must_use_proxy(const DilloUrl *url)
dFree(np);
}
}
+ _MSG("Http_must_use_proxy: %s\n %s\n", URL_STR(url), ret ? "YES":"NO");
return ret;
}
diff --git a/src/cookies.c b/src/cookies.c
index 1b336b83..b4843a1d 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -254,12 +254,11 @@ static int Cookie_control_init(void)
j = 0;
/* Get the domain */
- while (!isspace(line[i]))
+ while (line[i] != '\0' && !isspace(line[i]))
domain[j++] = line[i++];
domain[j] = '\0';
/* Skip past whitespaces */
- i++;
while (isspace(line[i]))
i++;
diff --git a/src/css.cc b/src/css.cc
index 030f3101..d50a1ecc 100644
--- a/src/css.cc
+++ b/src/css.cc
@@ -144,6 +144,10 @@ CssContext::CssContext () {
sheet[CSS_PRIMARY_USER_IMPORTANT] = userImportantStyle;
}
+CssContext::~CssContext () {
+}
+
+
void CssContext::apply (CssPropertyList *props, Doctree *docTree,
CssPropertyList *tagStyle, CssPropertyList *nonCss) {
diff --git a/src/dialog.cc b/src/dialog.cc
index 69781f32..8408782f 100644
--- a/src/dialog.cc
+++ b/src/dialog.cc
@@ -193,7 +193,7 @@ int a_Dialog_choice5(const char *QuestionTxt,
txt[0] = txt[6] = NULL;
txt[1] = alt1; txt[2] = alt2; txt[3] = alt3;
txt[4] = alt4; txt[5] = alt5;
- for (int i=1; txt[i]; ++i, ++nb);
+ for (int i=1; txt[i]; ++i, ++nb) ;
Window *window = new Window(ww,wh,"Choice5");
window->begin();
diff --git a/src/dillo.cc b/src/dillo.cc
index 7e29ac32..c20d1f02 100644
--- a/src/dillo.cc
+++ b/src/dillo.cc
@@ -26,6 +26,7 @@
#include <fltk/Window.h>
#include <fltk/TabGroup.h>
+#include <fltk/Font.h>
#include <fltk/run.h>
#include "msg.h"
@@ -108,6 +109,12 @@ int main(int argc, char **argv)
// WORKAROUND: sometimes the default pager triggers redraw storms
fltk::TabGroup::default_pager(fltk::PAGER_SHRINK);
+ fltk::Font *dfont = fltk::font(prefs.vw_fontname, 0);
+ if (dfont) {
+ fltk::Widget::default_style->textfont(dfont);
+ fltk::Widget::default_style->labelfont(dfont);
+ }
+
// Create a new UI/bw pair
BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, NULL);
diff --git a/src/dns.c b/src/dns.c
index 4ff2cb76..5c47aee5 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -18,6 +18,7 @@
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netinet/in.h>
#include <errno.h>
#include <unistd.h>
@@ -268,6 +269,8 @@ static void *Dns_server(void *data)
struct addrinfo hints, *res0;
int error;
Dlist *hosts;
+ size_t length, i;
+ char addr_string[40];
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
@@ -307,8 +310,18 @@ static void *Dns_server(void *data)
}
/* tell our findings */
- MSG("Dns_server [%d]: %s is %p\n", channel,
- dns_server[channel].hostname, hosts);
+ MSG("Dns_server [%d]: %s is", channel,
+ dns_server[channel].hostname);
+ if ((length = dList_length(hosts))) {
+ for (i = 0; i < length; i++) {
+ a_Dns_dillohost_to_string(dList_nth_data(hosts, i),
+ addr_string, sizeof(addr_string));
+ MSG(" %s", addr_string);
+ }
+ MSG("\n");
+ } else {
+ MSG(" (nil)\n");
+ }
dns_server[channel].addr_list = hosts;
dns_server[channel].ip_ready = TRUE;
@@ -482,3 +495,20 @@ void a_Dns_freeall(void)
dFree(dns_cache);
}
+/*
+ * Writes a string representation of the given DilloHost
+ * into dst. dst will be \0 terminated.
+ * Please note that dst must be at least 40 bytes long for IPv6
+ * addresses.
+ */
+void a_Dns_dillohost_to_string(DilloHost *host, char *dst, size_t size)
+{
+ if (!inet_ntop(host->af, host->data, dst, size)) {
+ switch (errno) {
+ case EAFNOSUPPORT:
+ snprintf(dst, size, "Unknown address family");
+ case ENOSPC:
+ snprintf(dst, size, "Buffer too small");
+ }
+ }
+}
diff --git a/src/dns.h b/src/dns.h
index 1749044f..fca28727 100644
--- a/src/dns.h
+++ b/src/dns.h
@@ -22,7 +22,7 @@ typedef struct _DilloHost
int alen;
char data[DILLO_ADDR_MAX];
} DilloHost;
-
+void a_Dns_dillohost_to_string(DilloHost *host, char *dst, size_t size);
#ifdef __cplusplus
}
diff --git a/src/html.cc b/src/html.cc
index b618fa96..47fa4885 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -724,10 +724,12 @@ bool DilloHtml::HtmlLinkReceiver::enter (Widget *widget, int link, int img,
if (link == -1) {
_MSG(" Link LEAVE notify...\n");
a_UIcmd_set_msg(bw, "");
+ a_UIcmd_set_pointer_on_link(bw, FALSE);
} else {
_MSG(" Link ENTER notify...\n");
Html_set_link_coordinates(html, link, x, y);
a_UIcmd_set_msg(bw, "%s", URL_STR(html->links->get(link)));
+ a_UIcmd_set_pointer_on_link(bw, TRUE);
}
return true;
}
@@ -997,7 +999,7 @@ static int Html_parse_entity(DilloHtml *html, const char *token,
} else if (isalpha(*s)) {
/* character entity reference */
- while (*++s && (isalnum(*s) || strchr(":_.-", *s)));
+ while (*++s && (isalnum(*s) || strchr(":_.-", *s))) ;
c = *s;
*s = 0;
@@ -1177,10 +1179,10 @@ static void Html_process_word(DilloHtml *html, const char *word, int size)
Pword = a_Html_parse_entities(html, word, size);
for (start = i = 0; Pword[i]; start = i)
if (isspace(Pword[i])) {
- while (Pword[++i] && isspace(Pword[i]));
+ while (Pword[++i] && isspace(Pword[i])) ;
Html_process_space(html, Pword + start, i - start);
} else {
- while (Pword[++i] && !isspace(Pword[i]));
+ while (Pword[++i] && !isspace(Pword[i])) ;
ch = Pword[i];
Pword[i] = 0;
DW2TB(html->dw)->addText(Pword, html->styleEngine->style ());
@@ -1199,7 +1201,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size)
Pword = a_Html_parse_entities(html, word, size);
for (i = 0; Pword[i]; ++i)
if (strchr("\t\f\n\r", Pword[i]))
- for (j = i; (Pword[j] = Pword[j+1]); ++j);
+ for (j = i; (Pword[j] = Pword[j+1]); ++j) ;
DW2TB(html->dw)->addText(Pword, html->styleEngine->style ());
dFree(Pword);
@@ -1319,8 +1321,8 @@ static void Html_tag_cleanup_at_close(DilloHtml *html, int TagIdx)
(cmp = (new_idx != html->stack->getRef(stack_idx)->tag_idx)) &&
((w3c_mode &&
Tags[html->stack->getRef(stack_idx)->tag_idx].EndTag == 'O') ||
- (!w3c_mode &&
- (Tags[html->stack->getRef(stack_idx)->tag_idx].EndTag == 'O') ||
+ ((!w3c_mode &&
+ (Tags[html->stack->getRef(stack_idx)->tag_idx].EndTag == 'O')) ||
Tags[html->stack->getRef(stack_idx)->tag_idx].TagLevel <
Tags[new_idx].TagLevel))) {
--stack_idx;
@@ -1504,7 +1506,7 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize)
* and replace '\n' and '\r' with ' ' inside quoted strings. */
for (i = 0, p = ntag; *p; ++p) {
if (isspace(*p)) {
- for (ntag[i++] = ' '; isspace(p[1]); ++p);
+ for (ntag[i++] = ' '; isspace(p[1]); ++p) ;
} else if ((quote = *p) == '"' || *p == '\'') {
for (ntag[i++] = *p++; (ntag[i++] = *p) && *p != quote; ++p) {
if (*p == '\n' || *p == '\r')
@@ -2892,7 +2894,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize)
sprintf(delay_str, ".");
/* Skip to anything after "URL=" */
- while (*content && *(content++) != '=');
+ while (*content && *(content++) != '=') ;
/* Send a custom HTML message.
* TODO: This is a hairy hack,
@@ -3745,7 +3747,7 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof)
if (isspace(buf[buf_index])) {
/* whitespace: group all available whitespace */
- while (++buf_index < bufsize && isspace(buf[buf_index]));
+ while (++buf_index < bufsize && isspace(buf[buf_index])) ;
Html_process_space(html, buf + token_start, buf_index - token_start);
token_start = buf_index;
diff --git a/src/prefs.c b/src/prefs.c
index 10e87d0c..29ed9442 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -61,6 +61,7 @@ DilloPrefs prefs;
/* define enumeration values to be returned for specific symbols */
typedef enum {
+ DRC_TOKEN_MIDDLE_CLICK_DRAGS_PAGE,
DRC_TOKEN_ALLOW_WHITE_BG,
DRC_TOKEN_BG_COLOR,
DRC_TOKEN_CONTRAST_VISITED_COLOR,
@@ -141,6 +142,7 @@ static const SymNode_t symbols[] = {
{ "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH },
{ "link_color", DRC_TOKEN_LINK_COLOR },
{ "load_images", DRC_TOKEN_LOAD_IMAGES },
+ { "middle_click_drags_page", DRC_TOKEN_MIDDLE_CLICK_DRAGS_PAGE },
{ "middle_click_opens_new_tab", DRC_TOKEN_MIDDLE_CLICK_OPENS_NEW_TAB },
{ "no_proxy", DRC_TOKEN_NOPROXY },
{ "panel_size", DRC_TOKEN_PANEL_SIZE },
@@ -236,6 +238,9 @@ static int Prefs_parse_pair(char *name, char *value)
case DRC_TOKEN_ALLOW_WHITE_BG:
prefs.allow_white_bg = (strcmp(value, "YES") == 0);
break;
+ case DRC_TOKEN_MIDDLE_CLICK_DRAGS_PAGE:
+ prefs.middle_click_drags_page = (strcmp(value, "YES") == 0);
+ break;
case DRC_TOKEN_FORCE_MY_COLORS:
prefs.force_my_colors = (strcmp(value, "YES") == 0);
break;
@@ -459,6 +464,7 @@ void a_Prefs_init(void)
prefs.save_dir = dStrdup(D_SAVE_DIR);
prefs.show_msg = TRUE;
prefs.show_extra_warnings = FALSE;
+ prefs.middle_click_drags_page = TRUE;
/* this locale stuff is to avoid parsing problems with float numbers */
old_locale = dStrdup (setlocale (LC_NUMERIC, NULL));
diff --git a/src/prefs.h b/src/prefs.h
index 7a409631..ec807f46 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -62,6 +62,7 @@ struct _DilloPrefs {
char *save_dir;
bool_t show_msg;
bool_t show_extra_warnings;
+ bool_t middle_click_drags_page;
};
/* Global Data */
diff --git a/src/styleengine.cc b/src/styleengine.cc
index cbdcf8a2..9eaca826 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -41,6 +41,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) {
StyleEngine::~StyleEngine () {
delete stack;
+ delete cssContext;
}
/**
diff --git a/src/table.cc b/src/table.cc
index bd57141a..ee93c5b0 100644
--- a/src/table.cc
+++ b/src/table.cc
@@ -35,7 +35,7 @@ using namespace dw::core::style;
static void Html_tag_open_table_cell(DilloHtml *html,
const char *tag, int tagsize,
- dw::core::style::TextAlignType text_align);
+ dw::core::style::TextAlignType text_align);
/*
* <TABLE>
@@ -287,8 +287,9 @@ static void Html_tag_open_table_cell(DilloHtml *html,
if (html->styleEngine->style ()->textAlign
== TEXT_ALIGN_STRING)
- col_tb = new dw::TableCell (((dw::Table*)S_TOP(html)->table)->getCellRef (),
- prefs.limit_text_width);
+ col_tb = new dw::TableCell (
+ ((dw::Table*)S_TOP(html)->table)->getCellRef (),
+ prefs.limit_text_width);
else
col_tb = new Textblock (prefs.limit_text_width);
diff --git a/src/ui.cc b/src/ui.cc
index 87fab74f..b47e11cf 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -621,9 +621,7 @@ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) :
{
int s_h = 20;
- Font *f = font(prefs.vw_fontname, 0);
- if (f)
- this->labelfont(f);
+ PointerOnLink = FALSE;
Tabs = NULL;
TabTooltip = NULL;
@@ -801,6 +799,14 @@ int UI::handle(int event)
ret = 1;
}
}
+
+ } else if (event == PUSH) {
+ if (prefs.middle_click_drags_page == 0 &&
+ event_button() == MiddleButton &&
+ !a_UIcmd_pointer_on_link(a_UIcmd_get_bw_by_widget(this))) {
+ paste_url();
+ ret = 1;
+ }
}
if (!ret)
diff --git a/src/ui.hh b/src/ui.hh
index 7a302efd..926a800f 100644
--- a/src/ui.hh
+++ b/src/ui.hh
@@ -64,6 +64,7 @@ class UI : public fltk::Group {
UIPanelmode Panelmode;
Findbar *findbar;
+ int PointerOnLink;
PackedGroup *make_toolbar(int tw, int th);
PackedGroup *make_location();
@@ -103,6 +104,8 @@ public:
CustTabGroup *tabs() { return Tabs; }
void tabs(CustTabGroup *tabs) { Tabs = tabs; }
+ int pointerOnLink() { return PointerOnLink; }
+ void pointerOnLink(int flag) { PointerOnLink = flag; }
// Hooks to method callbacks
void panel_cb_i();
diff --git a/src/uicmd.cc b/src/uicmd.cc
index 564e9957..9534a7fb 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -33,6 +33,8 @@
#include "nav.h"
+#define DEFAULT_TAB_LABEL "Dillo"
+
// Handy macro
#define BW2UI(bw) ((UI*)((bw)->ui))
@@ -83,11 +85,12 @@ public:
void remove (Widget *w) {
TabGroup::remove (w);
/* fixup resizable in case we just removed it */
- if (resizable () == w)
+ if (resizable () == w) {
if (children () > 0)
resizable (child (children () - 1));
else
resizable (NULL);
+ }
if (children () < 2)
hideLabels ();
@@ -177,7 +180,7 @@ BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, const void *vbw)
win->add(DilloTabs);
// Create and set the UI
- UI *new_ui = new UI(0, 0, ww, wh, "Label", old_bw ? BW2UI(old_bw) : NULL);
+ UI *new_ui = new UI(0, 0, ww, wh, DEFAULT_TAB_LABEL, old_bw ? BW2UI(old_bw) : NULL);
new_ui->set_status("http://www.dillo.org/");
new_ui->tabs(DilloTabs);
@@ -242,7 +245,7 @@ BrowserWindow *UIcmd_tab_new(const void *vbw)
vbw);
// Create and set the UI
- UI *new_ui = new UI(0, 0, ui->w(), ui->h(), "Label", ui);
+ UI *new_ui = new UI(0, 0, ui->w(), ui->h(), DEFAULT_TAB_LABEL, ui);
new_ui->tabs(ui->tabs());
new_ui->tabs()->add(new_ui);
@@ -481,24 +484,21 @@ void a_UIcmd_set_save_dir(const char *dir)
void a_UIcmd_save(void *vbw)
{
const char *name;
- char *SuggestedName, *urlstr;
- DilloUrl *url;
-
- a_UIcmd_set_save_dir(prefs.save_dir);
-
- urlstr = a_UIcmd_get_location_text((BrowserWindow*)vbw);
- url = a_Url_new(urlstr, NULL);
- SuggestedName = UIcmd_make_save_filename(URL_PATH(url));
- name = a_Dialog_save_file("Save Page as File", NULL, SuggestedName);
- MSG("a_UIcmd_save: %s\n", name);
- dFree(SuggestedName);
- dFree(urlstr);
+ char *SuggestedName;
+ BrowserWindow *bw = (BrowserWindow *)vbw;
+ const DilloUrl *url = a_History_get_url(NAV_TOP_UIDX(bw));
- if (name) {
- a_Nav_save_url((BrowserWindow*)vbw, url, name);
- }
+ if (url) {
+ a_UIcmd_set_save_dir(prefs.save_dir);
+ SuggestedName = UIcmd_make_save_filename(URL_PATH(url));
+ name = a_Dialog_save_file("Save Page as File", NULL, SuggestedName);
+ MSG("a_UIcmd_save: %s\n", name);
+ dFree(SuggestedName);
- a_Url_free(url);
+ if (name) {
+ a_Nav_save_url(bw, url, name);
+ }
+ }
}
/*
@@ -912,6 +912,22 @@ void a_UIcmd_set_buttons_sens(BrowserWindow *bw)
}
/*
+ * Keep track of mouse pointer over a link.
+ */
+void a_UIcmd_set_pointer_on_link(BrowserWindow *bw, int flag)
+{
+ BW2UI(bw)->pointerOnLink(flag);
+}
+
+/*
+ * Is the mouse pointer over a link?
+ */
+int a_UIcmd_pointer_on_link(BrowserWindow *bw)
+{
+ return BW2UI(bw)->pointerOnLink();
+}
+
+/*
* Toggle control panel (aka. fullscreen)
*/
void a_UIcmd_fullscreen_toggle(BrowserWindow *bw)
diff --git a/src/uicmd.hh b/src/uicmd.hh
index 02dbae8a..c4e34736 100644
--- a/src/uicmd.hh
+++ b/src/uicmd.hh
@@ -73,7 +73,8 @@ bool_t a_UIcmd_get_images_enabled(BrowserWindow *bw);
void a_UIcmd_set_images_enabled(BrowserWindow *bw, int flag);
void a_UIcmd_set_buttons_sens(BrowserWindow *bw);
void a_UIcmd_fullscreen_toggle(BrowserWindow *bw);
-
+void a_UIcmd_set_pointer_on_link(BrowserWindow *bw, int flag);
+int a_UIcmd_pointer_on_link(BrowserWindow *bw);
#ifdef __cplusplus
}
diff --git a/src/url.h b/src/url.h
index 32b173e6..02e89539 100644
--- a/src/url.h
+++ b/src/url.h
@@ -95,12 +95,12 @@ extern "C" {
struct _DilloUrl {
Dstr *url_string;
const char *buffer;
- const char *scheme; //
- const char *authority; //
- const char *path; // These are references only
- const char *query; // (no need to free them)
- const char *fragment; //
- const char *hostname; //
+ const char *scheme; /**/
+ const char *authority; /**/
+ const char *path; /* These are references only */
+ const char *query; /* (no need to free them) */
+ const char *fragment; /**/
+ const char *hostname; /**/
int port;
int flags;
Dstr *data; /* POST */