diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-10 08:58:47 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-10 08:58:47 +0300 |
commit | 8faf510eadb2a831c60d31cc66cfe9bac7db651f (patch) | |
tree | b965a5ae882e50f6a95c2154a06d68f0a537a8f3 /src | |
parent | a8cfbdc4f7ada9360d2068c4be1ce33d3da88671 (diff) |
Cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 2 | ||||
-rw-r--r-- | src/ui/lookupwidget.c | 5 | ||||
-rw-r--r-- | src/ui/util.c | 3 | ||||
-rw-r--r-- | src/ui/window.c | 8 |
4 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 6e10ff54..3e81b418 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1150,7 +1150,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1150 | return iTrue; | 1150 | return iTrue; |
1151 | } | 1151 | } |
1152 | else if (equal_Command(cmd, "valueinput.cancelled") && | 1152 | else if (equal_Command(cmd, "valueinput.cancelled") && |
1153 | cmp_String(string_Command(cmd, "id"), "document.input.submit") == 0) { | 1153 | equal_Rangecc(range_Command(cmd, "id"), "document.input.submit")) { |
1154 | postCommand_App("navigate.back"); | 1154 | postCommand_App("navigate.back"); |
1155 | return iTrue; | 1155 | return iTrue; |
1156 | } | 1156 | } |
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index ef262b46..b7de5872 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c | |||
@@ -570,7 +570,8 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
570 | presentResults_LookupWidget_(d); | 570 | presentResults_LookupWidget_(d); |
571 | return iTrue; | 571 | return iTrue; |
572 | } | 572 | } |
573 | if (isResize_UserEvent(ev)) { | 573 | if (isResize_UserEvent(ev) || (equal_Command(cmd, "layout.changed") && |
574 | equal_Rangecc(range_Command(cmd, "id"), "navbar"))) { | ||
574 | /* Position the lookup popup under the URL bar. */ { | 575 | /* Position the lookup popup under the URL bar. */ { |
575 | setSize_Widget(w, init_I2(width_Widget(findWidget_App("url")), | 576 | setSize_Widget(w, init_I2(width_Widget(findWidget_App("url")), |
576 | get_Window()->root->rect.size.y / 2)); | 577 | get_Window()->root->rect.size.y / 2)); |
@@ -580,7 +581,7 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
580 | updateVisible_ListWidget(d->list); | 581 | updateVisible_ListWidget(d->list); |
581 | invalidate_ListWidget(d->list); | 582 | invalidate_ListWidget(d->list); |
582 | } | 583 | } |
583 | if (equal_Command(cmd, "input.ended") && !cmp_String(string_Command(cmd, "id"), "url") && | 584 | if (equal_Command(cmd, "input.ended") && equal_Rangecc(range_Command(cmd, "id"), "url") && |
584 | !isFocused_Widget(w)) { | 585 | !isFocused_Widget(w)) { |
585 | setFlags_Widget(w, hidden_WidgetFlag, iTrue); | 586 | setFlags_Widget(w, hidden_WidgetFlag, iTrue); |
586 | } | 587 | } |
diff --git a/src/ui/util.c b/src/ui/util.c index 6969599b..9aa634bc 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -304,8 +304,7 @@ static iBool tabSwitcher_(iWidget *tabs, const char *cmd) { | |||
304 | if (equal_Command(cmd, "tabs.switch")) { | 304 | if (equal_Command(cmd, "tabs.switch")) { |
305 | iWidget *target = pointerLabel_Command(cmd, "page"); | 305 | iWidget *target = pointerLabel_Command(cmd, "page"); |
306 | if (!target) { | 306 | if (!target) { |
307 | const iString *id = string_Command(cmd, "id"); | 307 | target = findChild_Widget(tabs, cstr_Rangecc(range_Command(cmd, "id"))); |
308 | target = findChild_Widget(tabs, cstr_String(id)); | ||
309 | } | 308 | } |
310 | if (!target) return iFalse; | 309 | if (!target) return iFalse; |
311 | if (flags_Widget(target) & focusable_WidgetFlag) { | 310 | if (flags_Widget(target) & focusable_WidgetFlag) { |
diff --git a/src/ui/window.c b/src/ui/window.c index 8d76c68b..ea4d81ec 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -77,7 +77,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
77 | return iTrue; | 77 | return iTrue; |
78 | } | 78 | } |
79 | else if (equal_Command(cmd, "focus.set")) { | 79 | else if (equal_Command(cmd, "focus.set")) { |
80 | setFocus_Widget(findWidget_App(cstr_String(string_Command(cmd, "id")))); | 80 | setFocus_Widget(findWidget_App(cstr_Rangecc(range_Command(cmd, "id")))); |
81 | return iTrue; | 81 | return iTrue; |
82 | } | 82 | } |
83 | else if (handleCommand_App(cmd)) { | 83 | else if (handleCommand_App(cmd)) { |
@@ -204,6 +204,7 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
204 | } | 204 | } |
205 | arrange_Widget(navBar); | 205 | arrange_Widget(navBar); |
206 | refresh_Widget(navBar); | 206 | refresh_Widget(navBar); |
207 | postCommand_Widget(navBar, "layout.changed id:navbar"); | ||
207 | return iFalse; | 208 | return iFalse; |
208 | } | 209 | } |
209 | else if (equal_Command(cmd, "input.edited")) { | 210 | else if (equal_Command(cmd, "input.edited")) { |
@@ -289,7 +290,7 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
289 | 290 | ||
290 | static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) { | 291 | static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) { |
291 | if (equal_Command(cmd, "input.ended") && | 292 | if (equal_Command(cmd, "input.ended") && |
292 | cmp_String(string_Command(cmd, "id"), "find.input") == 0) { | 293 | equal_Rangecc(range_Command(cmd, "id"), "find.input")) { |
293 | iInputWidget *input = findChild_Widget(searchBar, "find.input"); | 294 | iInputWidget *input = findChild_Widget(searchBar, "find.input"); |
294 | if (arg_Command(cmd) && argLabel_Command(cmd, "enter") && isVisible_Widget(input)) { | 295 | if (arg_Command(cmd) && argLabel_Command(cmd, "enter") && isVisible_Widget(input)) { |
295 | postCommand_App("find.next"); | 296 | postCommand_App("find.next"); |
@@ -338,7 +339,8 @@ static void setupUserInterface_Window(iWindow *d) { | |||
338 | /* Navigation bar. */ { | 339 | /* Navigation bar. */ { |
339 | iWidget *navBar = new_Widget(); | 340 | iWidget *navBar = new_Widget(); |
340 | setId_Widget(navBar, "navbar"); | 341 | setId_Widget(navBar, "navbar"); |
341 | setPadding_Widget(navBar, gap_UI / 2, 0, gap_UI / 2, 0); | 342 | /*setPadding_Widget(navBar, gap_UI / 2, 0, gap_UI / 2, 0);*/ |
343 | setPadding_Widget(navBar, gap_UI, gap_UI / 2, gap_UI, gap_UI / 2); | ||
342 | setFlags_Widget(navBar, | 344 | setFlags_Widget(navBar, |
343 | arrangeHeight_WidgetFlag | resizeChildren_WidgetFlag | | 345 | arrangeHeight_WidgetFlag | resizeChildren_WidgetFlag | |
344 | arrangeHorizontal_WidgetFlag, | 346 | arrangeHorizontal_WidgetFlag, |