diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-07 06:32:10 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-07 06:32:10 +0200 |
commit | 31e855d81b64a8f8960d725b821861631343d947 (patch) | |
tree | 7c4292f06da01eaf7a6c48595d7fb684541047f7 /src/ui | |
parent | b7deb632513795e495e9a3aa76a9400fef4de364 (diff) |
DocumentWidget: Wrong tab gets input query string
Input submission events are now tied to a particular document and not implicitly to the current one.
As a workaround, input queries will now force a tab to the foreground.
IssueID #142
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 38e7fcca..68965aa8 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1188,7 +1188,6 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) { | |||
1188 | case categoryInput_GmStatusCode: { | 1188 | case categoryInput_GmStatusCode: { |
1189 | iUrl parts; | 1189 | iUrl parts; |
1190 | init_Url(&parts, d->mod.url); | 1190 | init_Url(&parts, d->mod.url); |
1191 | // printf("%s\n", cstr_String(meta_GmRequest(d->request))); | ||
1192 | iWidget *dlg = makeValueInput_Widget( | 1191 | iWidget *dlg = makeValueInput_Widget( |
1193 | as_Widget(d), | 1192 | as_Widget(d), |
1194 | NULL, | 1193 | NULL, |
@@ -1197,10 +1196,12 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) { | |||
1197 | ? format_CStr("Please enter input for %s:", cstr_Rangecc(parts.path)) | 1196 | ? format_CStr("Please enter input for %s:", cstr_Rangecc(parts.path)) |
1198 | : cstr_String(&resp->meta), | 1197 | : cstr_String(&resp->meta), |
1199 | uiTextCaution_ColorEscape "Send \u21d2", | 1198 | uiTextCaution_ColorEscape "Send \u21d2", |
1200 | "document.input.submit"); | 1199 | format_CStr("!document.input.submit doc:%p", d)); |
1201 | setSensitiveContent_InputWidget(findChild_Widget(dlg, "input"), | 1200 | setSensitiveContent_InputWidget(findChild_Widget(dlg, "input"), |
1202 | statusCode == sensitiveInput_GmStatusCode); | 1201 | statusCode == sensitiveInput_GmStatusCode); |
1203 | updateTheme_DocumentWidget_(d); | 1202 | if (document_App() != d) { |
1203 | postCommandf_App("tabs.switch page:%p", d); | ||
1204 | } | ||
1204 | break; | 1205 | break; |
1205 | } | 1206 | } |
1206 | case categorySuccess_GmStatusCode: | 1207 | case categorySuccess_GmStatusCode: |
@@ -1701,7 +1702,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1701 | } | 1702 | } |
1702 | return iTrue; | 1703 | return iTrue; |
1703 | } | 1704 | } |
1704 | else if (equal_Command(cmd, "document.input.submit") && document_App() == d) { | 1705 | else if (equal_Command(cmd, "document.input.submit") && document_Command(cmd) == d) { |
1705 | iString *value = suffix_Command(cmd, "value"); | 1706 | iString *value = suffix_Command(cmd, "value"); |
1706 | set_String(value, collect_String(urlEncode_String(value))); | 1707 | set_String(value, collect_String(urlEncode_String(value))); |
1707 | iString *url = collect_String(copy_String(d->mod.url)); | 1708 | iString *url = collect_String(copy_String(d->mod.url)); |