diff options
author | Sebastian Geerken <devnull@localhost> | 2012-10-30 09:54:14 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2012-10-30 09:54:14 +0100 |
commit | 76cf4173b653db09c3bacbb0d01c1e153e52eac4 (patch) | |
tree | e8d33d03e2c6023427ea025197dae2ccd5e8553d | |
parent | d6b244d49b86d8fb79f44765f50b2674c4cb7aed (diff) | |
parent | 0c62630e68c0d6376ee04f163d48315c725ecf5c (diff) |
Merge with http://hg.dillo.org/dillo
-rw-r--r-- | doc/dw-line-breaking.doc | 9 | ||||
-rw-r--r-- | dpi/cookies.c | 27 | ||||
-rw-r--r-- | dw/fltkimgbuf.cc | 4 | ||||
-rw-r--r-- | dw/fltkplatform.cc | 2 | ||||
-rw-r--r-- | dw/hyphenator.cc | 4 | ||||
-rw-r--r-- | dw/imgbuf.hh | 4 | ||||
-rw-r--r-- | dw/layout.hh | 2 | ||||
-rw-r--r-- | dw/platform.hh | 2 | ||||
-rw-r--r-- | dw/selection.cc | 4 | ||||
-rw-r--r-- | dw/style.cc | 4 | ||||
-rw-r--r-- | dw/textblock.hh | 12 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 17 | ||||
-rw-r--r-- | lout/misc.hh | 2 | ||||
-rw-r--r-- | src/cache.c | 6 | ||||
-rw-r--r-- | src/css.cc | 8 | ||||
-rw-r--r-- | src/cssparser.cc | 4 | ||||
-rw-r--r-- | src/dillo.cc | 2 | ||||
-rw-r--r-- | src/findbar.cc | 2 | ||||
-rw-r--r-- | src/html.cc | 24 | ||||
-rw-r--r-- | src/jpeg.c | 1 | ||||
-rw-r--r-- | src/menu.cc | 44 | ||||
-rw-r--r-- | src/nav.c | 8 | ||||
-rw-r--r-- | src/nav.h | 1 | ||||
-rw-r--r-- | src/pixmaps.h | 72 | ||||
-rw-r--r-- | src/ui.hh | 2 | ||||
-rw-r--r-- | src/uicmd.cc | 9 | ||||
-rw-r--r-- | test/liang.cc | 1 |
27 files changed, 128 insertions, 149 deletions
diff --git a/doc/dw-line-breaking.doc b/doc/dw-line-breaking.doc index afebf104..6492a579 100644 --- a/doc/dw-line-breaking.doc +++ b/doc/dw-line-breaking.doc @@ -338,7 +338,7 @@ be easily extended. words containing hyphens already. Example: "Abtei-Stadt", which is divided into "Abtei-" and "Stadt", resulting possibly in "Abtei-<span></span>-[new line]Stadt". See also below under -"Low Priority", on how to deal with hyphens and dashes. +"Medium Priority", on how to deal with hyphens and dashes. <h3>Medium Priority</h3> @@ -357,6 +357,13 @@ hyphenation.</li> Where to implement? In the same dynamic, lazy way like hyphenation? As part of hyphenation? +Notice that Liang's algorithm may behave different regarding hyphens: +"Abtei-Stadt" is (using the patterns from CTAN) divided into "Abtei-" +and "Stadt", but "Nordrhein-Westfalen" is divided into "Nord", +"rhein-West", "fa", "len": the part containing the hyphen +("rhein-West") is untouched. (Sorry for the German words; if you have +got English examples, send them me.) + <b>Incorrect calculation of extremes:</b> The minimal width of a text block (as part of the width extremes, which are mainly used for tables) is defined by everything between two possible breaks. A diff --git a/dpi/cookies.c b/dpi/cookies.c index a3cb53cb..95b2a9a3 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -805,6 +805,9 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date) /* Get the value for the attribute and store it */ if (first_attr) { + time_t now; + struct tm *tm; + if (*str != '=' || *attr == '\0') { /* disregard nameless cookie */ dFree(attr); @@ -815,8 +818,8 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date) cookie->value = Cookies_parse_value(&str); /* let's arbitrarily initialise with a year for now */ - time_t now = time(NULL); - struct tm *tm = gmtime(&now); + now = time(NULL); + tm = gmtime(&now); ++tm->tm_year; cookie->expires_at = mktime(tm); if (cookie->expires_at == (time_t) -1) @@ -847,10 +850,12 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date) dFree(value); } else if (dStrAsciiCasecmp(attr, "Expires") == 0) { if (!max_age) { + struct tm *tm; + value = Cookies_parse_value(&str); Cookies_unquote_string(value); _MSG("Expires attribute gives %s\n", value); - struct tm *tm = Cookies_parse_date(value); + tm = Cookies_parse_date(value); if (tm) { tm->tm_sec += Cookies_server_timediff(server_date); cookie->expires_at = mktime(tm); @@ -1037,15 +1042,15 @@ static uint_t Cookies_internal_dots_required(const char *host) if (tld_len > 0) { /* These TLDs were chosen by examining the current publicsuffix list - * in September 2011 and picking out those where it was simplest for - * them to describe the situation by beginning with a "*.[tld]" rule. + * in October 2012 and picking out those where it was simplest for + * them to describe the situation by beginning with a "*.[tld]" rule + * or every rule was "[something].[tld]". */ - const char *const tlds[] = {"ar","au","bd","bn","bt","ck","cy", - "er","et","fj","fk","gt","gu","id", - "il","jm","ke","kh","kw","ml","mm","mt", - "mz","ni","np","nz","om","pg","py","qa", - "sv","tr","uk","uy","ve","ye","yu","za", - "zm","zw"}; + const char *const tlds[] = {"ar","au","bd","bn","ck","cy","er","et", + "fj","fk","gt","gu","il","jm","ke","kh", + "kp","kw","lb","lr","mm","mt","mz","ni", + "np","nz","om","pg","py","sv","tr","uk", + "ve","ye","za","zm","zw"}; uint_t i, tld_num = sizeof(tlds) / sizeof(tlds[0]); for (i = 0; i < tld_num; i++) { diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc index 97cbc1b4..4ede6c5b 100644 --- a/dw/fltkimgbuf.cc +++ b/dw/fltkimgbuf.cc @@ -228,12 +228,12 @@ void FltkImgbuf::getRowArea (int row, dw::core::Rectangle *area) } } -int FltkImgbuf::getRootWidth () +int FltkImgbuf::getRootWidth () { return root ? root->width : width; } -int FltkImgbuf::getRootHeight () +int FltkImgbuf::getRootHeight () { return root ? root->height : height; } diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index fecd76a7..d8e95a6e 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -493,7 +493,7 @@ void FltkPlatform::attachView (core::View *view) } -void FltkPlatform::detachView (core::View *view) +void FltkPlatform::detachView (core::View *view) { if (this->view != view) MSG_ERR("FltkPlatform::detachView: this->view: %p view: %p\n", diff --git a/dw/hyphenator.cc b/dw/hyphenator.cc index 62a47a73..61cbef0d 100644 --- a/dw/hyphenator.cc +++ b/dw/hyphenator.cc @@ -490,14 +490,14 @@ Trie::Trie (TrieNode *array, int size, bool freeArray, ZoneAllocator *dataZone) this->size = size; this->freeArray = freeArray; this->dataZone = dataZone; -}; +} Trie::~Trie () { delete dataZone; if (freeArray) free(array); -}; +} void Trie::save (FILE *file) { diff --git a/dw/imgbuf.hh b/dw/imgbuf.hh index 150bf165..d6f41d21 100644 --- a/dw/imgbuf.hh +++ b/dw/imgbuf.hh @@ -175,8 +175,8 @@ public: virtual Imgbuf* getScaledBuf (int width, int height) = 0; virtual void getRowArea (int row, dw::core::Rectangle *area) = 0; - virtual int getRootWidth () = 0; - virtual int getRootHeight () = 0; + virtual int getRootWidth () = 0; + virtual int getRootHeight () = 0; /* * Reference counting. diff --git a/dw/layout.hh b/dw/layout.hh index 4b80456b..e3e89c52 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -334,7 +334,7 @@ public: inline style::Font *createFont (style::FontAttrs *attrs, bool tryEverything) { - return platform->createFont (attrs, tryEverything); + return platform->createFont (attrs, tryEverything); } inline bool fontExists (const char *name) diff --git a/dw/platform.hh b/dw/platform.hh index cb714583..c7eb37ee 100644 --- a/dw/platform.hh +++ b/dw/platform.hh @@ -44,7 +44,7 @@ public: * \brief This methods notifies the platform, that a view has been detached * from the related layout. */ - virtual void detachView (View *view) = 0; + virtual void detachView (View *view) = 0; /* * ----------------------------------- diff --git a/dw/selection.cc b/dw/selection.cc index 1552e80e..64a0b526 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -344,8 +344,8 @@ int SelectionState::correctCharPos (DeepIterator *it, int charPos) return misc::min(charPos, len); } -void SelectionState::highlight0 (bool fl, DeepIterator *from, int fromChar, - DeepIterator *to, int toChar, int dir) +void SelectionState::highlight0 (bool fl, DeepIterator *from, int fromChar, + DeepIterator *to, int toChar, int dir) { DeepIterator *a, *b, *i; int cmp, aChar, bChar; diff --git a/dw/style.cc b/dw/style.cc index b0868c1f..7083ef2a 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -179,8 +179,8 @@ int StyleAttrs::hashValue () { borderCollapse + (intptr_t) borderColor.top + (intptr_t) borderColor.right + - (intptr_t) borderColor.bottom + - (intptr_t) borderColor.left + + (intptr_t) borderColor.bottom + + (intptr_t) borderColor.left + borderStyle.top + borderStyle.right + borderStyle.bottom + diff --git a/dw/textblock.hh b/dw/textblock.hh index 8e2f18bb..70759079 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -181,12 +181,14 @@ private: INF_VALUE = 0, /* simple values */ INF_LARGE, /* large values, like QUITE_LOOSE */ INF_NOT_STRETCHABLE, /* reserved for NOT_STRECTHABLE */ + INF_TOO_TIGHT, /* used for lines, which are too tight */ INF_PENALTIES, /* used for penalties */ - INF_TOO_TIGHT, /* used for lines, which are too tight; - that this is the last value means - that lines, which are too tight, are - regarded as the worst case */ - INF_MAX = INF_TOO_TIGHT + INF_MAX = INF_PENALTIES + + // That INF_PENALTIES is the last value means that an + // infinite penalty (breaking is prohibited) makes a break + // not possible at all, so that pre-formatted text + // etc. works. }; int badnessValue (int infLevel); diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index bd49049b..be3f1b05 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -520,7 +520,7 @@ void Textblock::wordWrap (int wordIndex, bool wrapAll) word->badnessAndPenalty.lineTooTight () && words->getRef(wordIndex - 1) ->badnessAndPenalty.lineCanBeBroken ()) { - // TODO Comment the last condition (also below where the minimun is + // TODO Comment the last condition (also below where the minimum is // searched for) newLine = true; searchUntil = wordIndex - 1; @@ -573,13 +573,18 @@ void Textblock::wordWrap (int wordIndex, bool wrapAll) if (wrapAll && searchUntil == words->size () - 1) { // Since no break and no space is added, the last word - // will have a penalty of inf. Actually, it should be -inf, - // since it is the last word. However, since more words may - // follow, the penalty is not changesd, but here, the search - // is corrected (maybe only temporary). + // will have a penalty of inf. Actually, it should be + // less, since it is the last word. However, since more + // words may follow, the penalty is not changesd, but + // here, the search is corrected (maybe only + // temporary). + + // (Notice that it was once (temporally) set to -inf, + // not 0, but this will make e.g. test/table-1.html not + // work.) Word *lastWord = words->getRef (searchUntil); BadnessAndPenalty correctedBap = lastWord->badnessAndPenalty; - correctedBap.setPenaltyForceBreak (); + correctedBap.setPenalty (0); if (correctedBap.compareTo (&words->getRef(breakPos)->badnessAndPenalty) <= 0) { breakPos = searchUntil; diff --git a/lout/misc.hh b/lout/misc.hh index 437d229e..e5413f05 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -433,7 +433,7 @@ public: T *src = i < oldNumExtra ? this->arrayExtra1 + i : arrayMainI + (i - oldNumExtra); T *dest = i < diff ? - arrayMainI + i : arrayExtra2 + (i - diff); + arrayMainI + i : arrayExtra2 + (i - diff); *dest = *src; } diff --git a/src/cache.c b/src/cache.c index 4a689833..ab7063f9 100644 --- a/src/cache.c +++ b/src/cache.c @@ -911,9 +911,9 @@ void a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size, } if ((entry->Flags & CA_GotLength) && (entry->ExpectedSize != entry->TransferSize)) { - MSG_HTTP("Content-Length does NOT match message body,\n" - " at: %s\n", URL_STR_(entry->Url)); - MSG("entry->ExpectedSize = %d, entry->TransferSize = %d\n", + MSG_HTTP("Content-Length does NOT match message body at\n" + "%s\n", URL_STR_(entry->Url)); + MSG("Expected size: %d, Transfer size: %d\n", entry->ExpectedSize, entry->TransferSize); } if (!entry->TransferSize && !(entry->Flags & CA_Redirect) && @@ -44,7 +44,7 @@ CssPropertyList::CssPropertyList (const CssPropertyList &p, bool deep) : } else { ownerOfStrings = false; } -}; +} CssPropertyList::~CssPropertyList () { if (ownerOfStrings) @@ -108,7 +108,7 @@ CssSelector::CssSelector () { cs->notMatchingBefore = -1; cs->combinator = COMB_NONE; cs->selector = new CssSimpleSelector (); -}; +} CssSelector::~CssSelector () { for (int i = selectorList->size () - 1; i >= 0; i--) @@ -329,12 +329,12 @@ CssRule::CssRule (CssSelector *selector, CssPropertyList *props, int pos) { this->props->ref (); this->pos = pos; spec = selector->specificity (); -}; +} CssRule::~CssRule () { selector->unref (); props->unref (); -}; +} void CssRule::apply (CssPropertyList *props, Doctree *docTree, const DoctreeNode *node) { diff --git a/src/cssparser.cc b/src/cssparser.cc index bd065234..28b3badb 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -701,7 +701,7 @@ bool CssParser::tokenMatchesProperty(CssPropertyName prop, CssValueType *type) case CSS_TYPE_LENGTH_PERCENTAGE: case CSS_TYPE_LENGTH_PERCENTAGE_NUMBER: case CSS_TYPE_LENGTH: - if (tval[0] == '-') + if (tval[0] == '-') return false; // Fall Through case CSS_TYPE_SIGNED_LENGTH: @@ -1063,7 +1063,7 @@ void CssParser::parseDeclaration(CssPropertyList * props, CssPropertyName prop; CssPropertyValue val, dir_vals[4]; - CssValueType dir_types[4]; + CssValueType dir_types[4]; bool found, weight; int sh_index, i, j, n; int dir_set[4][4] = { diff --git a/src/dillo.cc b/src/dillo.cc index 3599ca7a..135a9e45 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -148,7 +148,7 @@ static OptID getCmdOption(const CLI_options *options, int argc, char **argv, } if (state == O_FOUND) { int n_arg = options[i].opt_argc; - opt_id = options[i].id; + opt_id = options[i].id; /* Find the required/optional arguments of the option */ for (i = 0; *idx < argc && i < abs(n_arg) && argv[*idx][0] != '-'; i++) opt_argv[i] = argv[(*idx)++]; diff --git a/src/findbar.cc b/src/findbar.cc index 47363db0..28790563 100644 --- a/src/findbar.cc +++ b/src/findbar.cc @@ -61,7 +61,7 @@ int MyInput::handle(int e) if (ret) ret = Fl_Input::handle(e); return ret; -}; +} /* * Find next occurrence of input key diff --git a/src/html.cc b/src/html.cc index 6f5e94ae..07590517 100644 --- a/src/html.cc +++ b/src/html.cc @@ -98,11 +98,6 @@ void *a_Html_text(const char *type, void *P, CA_Callback_t *Call,void **Data); /*----------------------------------------------------------------------------- * Forward declarations *---------------------------------------------------------------------------*/ -static const char *Html_get_attr2(DilloHtml *html, - const char *tag, - int tagsize, - const char *attrname, - int tag_parsing_flags); static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof); static bool Html_load_image(BrowserWindow *bw, DilloUrl *url, const DilloUrl *requester, DilloImage *image); @@ -1151,7 +1146,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) dStr_append_l(html->Stash, word, size); } - if (parse_mode == DILLO_HTML_PARSE_MODE_STASH || + if (parse_mode == DILLO_HTML_PARSE_MODE_STASH || parse_mode == DILLO_HTML_PARSE_MODE_VERBATIM) { /* skip until the closing instructions */ @@ -3456,8 +3451,7 @@ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize) const char *attrbuf; if (tagsize >= 8 && /* length of "<t id=i>" */ - (attrbuf = Html_get_attr2(html, tag, tagsize, "id", - HTML_LeftTrim | HTML_RightTrim))) { + (attrbuf = a_Html_get_attr(html, tag, tagsize, "id"))) { /* According to the SGML declaration of HTML 4, all NAME values * occuring outside entities must be converted to uppercase * (this is what "NAMECASE GENERAL YES" says). But the HTML 4 @@ -3471,13 +3465,11 @@ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize) if (tagsize >= 11 && (prefs.parse_embedded_css || prefs.load_stylesheets)) { /* length of "<t class=i>" or "<t style=i>" */ - attrbuf = Html_get_attr2(html, tag, tagsize, "class", - HTML_LeftTrim | HTML_RightTrim); + attrbuf = a_Html_get_attr(html, tag, tagsize, "class"); if (attrbuf) html->styleEngine->setClass (attrbuf); - attrbuf = Html_get_attr2(html, tag, tagsize, "style", - HTML_LeftTrim | HTML_RightTrim); + attrbuf = a_Html_get_attr(html, tag, tagsize, "style"); if (attrbuf) html->styleEngine->setStyle (attrbuf); } @@ -3486,8 +3478,7 @@ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize) int hasXmlLang = 0; if (tagsize >= 14) { /* length of "<t xml:lang=i>" */ - attrbuf = Html_get_attr2(html, tag, tagsize, "xml:lang", - HTML_LeftTrim | HTML_RightTrim); + attrbuf = a_Html_get_attr(html, tag, tagsize, "xml:lang"); if (attrbuf) { html->styleEngine->setNonCssHint(PROPERTY_X_LANG, CSS_TYPE_STRING, attrbuf); @@ -3496,8 +3487,7 @@ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize) } if (!hasXmlLang && tagsize >= 10) { /* 'xml:lang' prevails over 'lang' */ /* length of "<t lang=i>" */ - attrbuf = Html_get_attr2(html, tag, tagsize, "lang", - HTML_LeftTrim | HTML_RightTrim); + attrbuf = a_Html_get_attr(html, tag, tagsize, "lang"); if (attrbuf) html->styleEngine->setNonCssHint(PROPERTY_X_LANG, CSS_TYPE_STRING, attrbuf); @@ -3639,7 +3629,7 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) /* Request immediate close for elements with forbidden close tag. */ /* TODO: XHTML always requires close tags. A simple implementation * of the commented clause below will make it work. */ - if (/* parsing HTML && */ Tags[ni].EndTag == 'F') + if (/* parsing HTML && */ Tags[ni].EndTag == 'F') html->ReqTagClose = true; /* Don't break! Open tags may also close themselves */ @@ -80,7 +80,6 @@ typedef struct DilloJpeg { * Forward declarations */ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize); -METHODDEF(void) Jpeg_errorexit (j_common_ptr cinfo); /* this is the routine called by libjpeg when it detects an error. */ diff --git a/src/menu.cc b/src/menu.cc index 63fa2f52..d89c9ee1 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -25,6 +25,16 @@ #include "timeout.hh" /* + * Local data types + */ + +typedef struct { + const char *title; + const Fl_Menu_Item *picked; + const Fl_Menu_Item *menu; +} Menu_popup_data_t; + +/* * Local data */ @@ -287,7 +297,7 @@ static void Menu_history_cb(Fl_Widget*, void *data) * avoid a segfault when a new page replaces the page that issued * the popup menu. */ -static void Menu_popup_cb(void *data) +static void Menu_simple_popup_cb(void *data) { const Fl_Menu_Item *m = ((Fl_Menu_Item *)data)->popup(popup_x, popup_y); @@ -296,6 +306,19 @@ static void Menu_popup_cb(void *data) a_Timeout_remove(); } +static void Menu_popup_cb(void *data) +{ + Menu_popup_data_t *d = (Menu_popup_data_t *)data; + const Fl_Menu_Item *picked = d->menu->popup(popup_x, popup_y, d->title, + d->picked); + if (picked) { + d->picked = picked; + if (picked->callback()) + picked->do_callback((Fl_Widget *)(d->menu)); + } + a_Timeout_remove(); +} + /* * Page popup menu (construction & popup) */ @@ -317,6 +340,7 @@ void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, {"Save page as...", 0, Menu_save_page_cb,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} }; + static Menu_popup_data_t page_data = {"Page menu", NULL, pm}; popup_x = Fl::event_x(); popup_y = Fl::event_y(); @@ -379,7 +403,7 @@ void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, } pm[3].user_data(popup_url); - a_Timeout_add(0.0, Menu_popup_cb, (void*)pm); + a_Timeout_add(0.0, Menu_popup_cb, (void*)&page_data); } static Fl_Menu_Item link_menu[] = { @@ -405,6 +429,8 @@ static void Menu_set_link_menu_user_data(void *user_data) */ void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url) { + static Menu_popup_data_t link_data = {"Link menu", NULL, link_menu}; + popup_x = Fl::event_x(); popup_y = Fl::event_y(); popup_bw = bw; @@ -413,7 +439,7 @@ void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url) Menu_set_link_menu_user_data(popup_url); - a_Timeout_add(0.0, Menu_popup_cb, (void*)link_menu); + a_Timeout_add(0.0, Menu_popup_cb, (void*)&link_data); } /* @@ -437,6 +463,7 @@ void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url, {"Link menu", 0, Menu_nop_cb, link_menu, FL_SUBMENU_POINTER,0,0,0,0}, {0,0,0,0,0,0,0,0,0} }; + static Menu_popup_data_t image_data = {"Image menu", NULL, pm}; popup_x = Fl::event_x(); popup_y = Fl::event_y(); @@ -471,7 +498,7 @@ void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url, pm[7].deactivate(); } - a_Timeout_add(0.0, Menu_popup_cb, (void*)pm); + a_Timeout_add(0.0, Menu_popup_cb, (void*)&image_data); } /* @@ -487,6 +514,7 @@ void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url, {0, 0, Menu_form_hiddens_cb, &hiddens_visible, 0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} }; + static Menu_popup_data_t form_data = {"Form menu", NULL, pm}; popup_x = Fl::event_x(); popup_y = Fl::event_y(); @@ -498,7 +526,7 @@ void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url, hiddens_visible = hidvis; pm[2].label(hiddens_visible ? "Hide hiddens": "Show hiddens"); - a_Timeout_add(0.0, Menu_popup_cb, (void*)pm); + a_Timeout_add(0.0, Menu_popup_cb, (void*)&form_data); } /* @@ -531,7 +559,7 @@ void a_Menu_file_popup(BrowserWindow *bw, void *v_wid) popup_url = NULL; //pm->label(wid->visible() ? NULL : "File"); - a_Timeout_add(0.0, Menu_popup_cb, (void*)pm); + a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm); } /* @@ -553,7 +581,7 @@ void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url) a_Url_free(popup_url); popup_url = a_Url_dup(url); - a_Timeout_add(0.0, Menu_popup_cb, (void*)pm); + a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm); } /* @@ -590,7 +618,7 @@ void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction) pm[i].label(FL_NORMAL_LABEL, a_History_get_title(history_list[i], 1)); pm[i].callback(Menu_history_cb, INT2VOIDP(i+1)); } - a_Timeout_add(0.0, Menu_popup_cb, (void*)pm); + a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm); } /* @@ -590,6 +590,14 @@ void a_Nav_unref_buf(const DilloUrl *Url) } /* + * Wrapper for a_Capi_get_content_type(). + */ +const char *a_Nav_get_content_type(const DilloUrl *url) +{ + return a_Capi_get_content_type(url); +} + +/* * Wrapper for a_Capi_set_vsource_url(). */ void a_Nav_set_vsource_url(const DilloUrl *Url) @@ -35,6 +35,7 @@ void a_Nav_save_url(BrowserWindow *bw, const DilloUrl *url, const char *filename); int a_Nav_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize); void a_Nav_unref_buf(const DilloUrl *Url); +const char *a_Nav_get_content_type(const DilloUrl *url); void a_Nav_set_vsource_url(const DilloUrl *Url); #ifdef __cplusplus diff --git a/src/pixmaps.h b/src/pixmaps.h index 9d3c4f28..c1c6c294 100644 --- a/src/pixmaps.h +++ b/src/pixmaps.h @@ -13,36 +13,6 @@ #ifndef __PIXMAPS_H__ #define __PIXMAPS_H__ -/* XPM -static const char *const history_xpm[] = { -"11 20 6 1", -" c None", -". c #000000000000", -"X c #9658A289BEFB", -"O c #FFFF9A690000", -"+ c #FFFFFFFF0000", -"@ c #FFFFFFFFFFFF", -" ", -" . ", -" .X. ", -" .XXX. ", -" .XXXXX. ", -" .XXXXXXX. ", -" ...XXX... ", -" .XXX. ", -" .XXX. ", -" .XXX. ", -" OOOOO ", -" .XXX. ", -" .XXX. ", -" ...XXX... ", -" .XXXXXXX. ", -" .XXXXX. ", -" .XXX. ", -" .X. ", -" . ", -" "}; -*/ /* XPM */ static const char *const left_xpm[] = { "22 22 46 1", @@ -1557,48 +1527,6 @@ static const char *const help_xpm[] = { " 44 "}; /* XPM */ -static const char *const full_screen_on_xpm[] = { -"13 15 2 1", -" c None", -". c #000000", -" ", -".............", -". . .", -". ... .", -". ..... .", -". ....... .", -". . .", -". . .", -". . .", -". ....... .", -". ..... .", -". ... .", -". . .", -".............", -" "}; - -/* XPM */ -static const char *const full_screen_off_xpm[] = { -"13 15 2 1", -" c None", -". c #000000", -" ", -".............", -". . . . . . .", -".. . . . . ..", -".............", -". .", -". .", -". .", -". .", -". .", -". .", -".............", -". . . . . . .", -".............", -" "}; - -/* XPM */ static const char *const mini_bug_xpm[] = { "16 16 7 1", " c None", @@ -153,7 +153,7 @@ class UI : public CustGroupVertical { Fl_Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools, *Clear, *Search, *Help, *BugMeter, *FileButton; CustGroupHorizontal *LocBar, *NavBar, *StatusBar; - Fl_Input *Location; + Fl_Input *Location; CustProgressBox *PProg, *IProg; Fl_Group *Panel, *Main; Fl_Output *StatusOutput; diff --git a/src/uicmd.cc b/src/uicmd.cc index 6ca98280..b7c5fbf5 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -1019,14 +1019,18 @@ void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr) */ void a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url) { - char *buf; + char *buf, *major; int buf_size; Dstr *dstr_url; DilloUrl *vs_url; static int post_id = 0; char tag[8]; + const char *content_type = a_Nav_get_content_type(url); - if (a_Nav_get_buf(url, &buf, &buf_size)) { + a_Misc_parse_content_type(content_type, &major, NULL, NULL); + + if (major && dStrAsciiCasecmp(major, "image") && + a_Nav_get_buf(url, &buf, &buf_size)) { a_Nav_set_vsource_url(url); dstr_url = dStr_new("dpi:/vsource/:"); dStr_append(dstr_url, URL_STR(url)); @@ -1042,6 +1046,7 @@ void a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url) dStr_free(dstr_url, 1); a_Nav_unref_buf(url); } + dFree(major); } /* diff --git a/test/liang.cc b/test/liang.cc index 6b5a424a..4b756a60 100644 --- a/test/liang.cc +++ b/test/liang.cc @@ -48,6 +48,7 @@ int main (int argc, char *argv[]) "thiomethyl)-8-oxo-5-thia-1-azabicyclo[4.2.0]oct-2-en-2-" "carbonsäure-7²-(Z)-(O-methyloxim)"); hyphenateWord (&p, "Abtei-Stadt"); + hyphenateWord (&p, "Nordrhein-Westfalen"); return 0; } |