diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-28 10:32:04 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-28 10:32:04 +0300 |
commit | 57ca0f82de3540b0e73c46970e91516e7371913b (patch) | |
tree | 2c703f8f5b64c6a1f970e7643f41e17309a497df /src | |
parent | 0700048de99c4a00094d594dcf321637514f3a6a (diff) |
Improved title user parsing; back/forward mouse buttons
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 26 | ||||
-rw-r--r-- | src/ui/window.c | 2 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 882e029a..fd13cd72 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -272,12 +272,18 @@ void setUrl_DocumentWidget(iDocumentWidget *d, const iString *url) { | |||
272 | set_String(d->url, newUrl); | 272 | set_String(d->url, newUrl); |
273 | fetch_DocumentWidget_(d); | 273 | fetch_DocumentWidget_(d); |
274 | } | 274 | } |
275 | iRegExp *userPat = new_RegExp("~([^/?]+)", 0); | 275 | /* See if there a username in the URL. */ { |
276 | iRegExpMatch m; | 276 | clear_String(d->titleUser); |
277 | if (matchString_RegExp(userPat, d->url, &m)) { | 277 | iRegExp *userPats[2] = { new_RegExp("~([^/?]+)", 0), |
278 | setRange_String(d->titleUser, capturedRange_RegExpMatch(&m, 1)); | 278 | new_RegExp("/users/([^/?]+)", caseInsensitive_RegExpOption) }; |
279 | iRegExpMatch m; | ||
280 | iForIndices(i, userPats) { | ||
281 | if (matchString_RegExp(userPats[i], d->url, &m)) { | ||
282 | setRange_String(d->titleUser, capturedRange_RegExpMatch(&m, 1)); | ||
283 | } | ||
284 | iRelease(userPats[i]); | ||
285 | } | ||
279 | } | 286 | } |
280 | iRelease(userPat); | ||
281 | delete_String(newUrl); | 287 | delete_String(newUrl); |
282 | } | 288 | } |
283 | 289 | ||
@@ -611,6 +617,16 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
611 | } | 617 | } |
612 | } | 618 | } |
613 | } | 619 | } |
620 | if (ev->type == SDL_MOUSEBUTTONDOWN) { | ||
621 | if (ev->button.button == SDL_BUTTON_X1) { | ||
622 | postCommand_App("navigate.back"); | ||
623 | return iTrue; | ||
624 | } | ||
625 | if (ev->button.button == SDL_BUTTON_X2) { | ||
626 | postCommand_App("navigate.forward"); | ||
627 | return iTrue; | ||
628 | } | ||
629 | } | ||
614 | processContextMenuEvent_Widget(d->menu, ev); | 630 | processContextMenuEvent_Widget(d->menu, ev); |
615 | switch (processEvent_Click(&d->click, ev)) { | 631 | switch (processEvent_Click(&d->click, ev)) { |
616 | case started_ClickResult: | 632 | case started_ClickResult: |
diff --git a/src/ui/window.c b/src/ui/window.c index 79715b6e..ad2aced8 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -176,7 +176,6 @@ static void setupUserInterface_Window(iWindow *d) { | |||
176 | addChild_Widget(div, iClob(navBar)); | 176 | addChild_Widget(div, iClob(navBar)); |
177 | setBackgroundColor_Widget(navBar, gray25_ColorId); | 177 | setBackgroundColor_Widget(navBar, gray25_ColorId); |
178 | setCommandHandler_Widget(navBar, handleNavBarCommands_); | 178 | setCommandHandler_Widget(navBar, handleNavBarCommands_); |
179 | |||
180 | addChild_Widget(navBar, iClob(new_LabelWidget(" \u25c4 ", 0, 0, "navigate.back"))); | 179 | addChild_Widget(navBar, iClob(new_LabelWidget(" \u25c4 ", 0, 0, "navigate.back"))); |
181 | addChild_Widget(navBar, iClob(new_LabelWidget(" \u25ba ", 0, 0, "navigate.forward"))); | 180 | addChild_Widget(navBar, iClob(new_LabelWidget(" \u25ba ", 0, 0, "navigate.forward"))); |
182 | addChild_Widget(navBar, iClob(new_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); | 181 | addChild_Widget(navBar, iClob(new_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); |
@@ -201,7 +200,6 @@ static void setupUserInterface_Window(iWindow *d) { | |||
201 | addChild_Widget(div, iClob(searchBar)); | 200 | addChild_Widget(div, iClob(searchBar)); |
202 | setBackgroundColor_Widget(searchBar, gray25_ColorId); | 201 | setBackgroundColor_Widget(searchBar, gray25_ColorId); |
203 | setCommandHandler_Widget(searchBar, handleSearchBarCommands_); | 202 | setCommandHandler_Widget(searchBar, handleSearchBarCommands_); |
204 | |||
205 | addChild_Widget(searchBar, iClob(new_LabelWidget("\U0001f50d Text", 0, 0, NULL))); | 203 | addChild_Widget(searchBar, iClob(new_LabelWidget("\U0001f50d Text", 0, 0, NULL))); |
206 | iInputWidget *input = new_InputWidget(0); | 204 | iInputWidget *input = new_InputWidget(0); |
207 | setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), | 205 | setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), |