diff options
Diffstat (limited to 'src')
-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 |
13 files changed, 71 insertions, 112 deletions
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); } /* |