diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 76c26e27..99039ff5 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -5071,10 +5071,9 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
5071 | iArray items; | 5071 | iArray items; |
5072 | init_Array(&items, sizeof(iMenuItem)); | 5072 | init_Array(&items, sizeof(iMenuItem)); |
5073 | if (d->contextLink) { | 5073 | if (d->contextLink) { |
5074 | /* Context menu for a link. */ | 5074 | /* Construct the link context menu, depending on what kind of link was clicked. */ |
5075 | interactingWithLink_DocumentWidget_(d, d->contextLink->linkId); /* perhaps will be triggered */ | 5075 | interactingWithLink_DocumentWidget_(d, d->contextLink->linkId); /* perhaps will be triggered */ |
5076 | const iString *linkUrl = linkUrl_GmDocument(view->doc, d->contextLink->linkId); | 5076 | const iString *linkUrl = linkUrl_GmDocument(view->doc, d->contextLink->linkId); |
5077 | // const int linkFlags = linkFlags_GmDocument(d->doc, d->contextLink->linkId); | ||
5078 | const iRangecc scheme = urlScheme_String(linkUrl); | 5077 | const iRangecc scheme = urlScheme_String(linkUrl); |
5079 | const iBool isGemini = equalCase_Rangecc(scheme, "gemini"); | 5078 | const iBool isGemini = equalCase_Rangecc(scheme, "gemini"); |
5080 | iBool isNative = iFalse; | 5079 | iBool isNative = iFalse; |
@@ -5086,39 +5085,48 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
5086 | format_CStr("```%s", cstr_String(infoText)), | 5085 | format_CStr("```%s", cstr_String(infoText)), |
5087 | 0, 0, NULL }); | 5086 | 0, 0, NULL }); |
5088 | } | 5087 | } |
5089 | if (willUseProxy_App(scheme) || isGemini || | 5088 | if (isGemini || |
5089 | willUseProxy_App(scheme) || | ||
5090 | equalCase_Rangecc(scheme, "data") || | ||
5090 | equalCase_Rangecc(scheme, "file") || | 5091 | equalCase_Rangecc(scheme, "file") || |
5091 | equalCase_Rangecc(scheme, "finger") || | 5092 | equalCase_Rangecc(scheme, "finger") || |
5092 | equalCase_Rangecc(scheme, "gopher")) { | 5093 | equalCase_Rangecc(scheme, "gopher")) { |
5093 | isNative = iTrue; | 5094 | isNative = iTrue; |
5094 | /* Regular links that we can open. */ | 5095 | /* Regular links that we can open. */ |
5095 | pushBackN_Array( | 5096 | pushBackN_Array(&items, |
5096 | &items, | 5097 | (iMenuItem[]){ |
5097 | (iMenuItem[]){ { openTab_Icon " ${link.newtab}", | 5098 | { openTab_Icon " ${link.newtab}", |
5098 | 0, | 5099 | 0, |
5099 | 0, | 5100 | 0, |
5100 | format_CStr("!open newtab:1 origin:%s url:%s", | 5101 | format_CStr("!open newtab:1 origin:%s url:%s", |
5101 | cstr_String(id_Widget(w)), | 5102 | cstr_String(id_Widget(w)), |
5102 | cstr_String(linkUrl)) }, | 5103 | cstr_String(linkUrl)) }, |
5103 | { openTabBg_Icon " ${link.newtab.background}", | 5104 | { openTabBg_Icon " ${link.newtab.background}", |
5104 | 0, | 5105 | 0, |
5105 | 0, | 5106 | 0, |
5106 | format_CStr("!open newtab:2 origin:%s url:%s", | 5107 | format_CStr("!open newtab:2 origin:%s url:%s", |
5107 | cstr_String(id_Widget(w)), | 5108 | cstr_String(id_Widget(w)), |
5108 | cstr_String(linkUrl)) }, | 5109 | cstr_String(linkUrl)) }, |
5109 | { "${link.side}", | 5110 | { "${link.side}", |
5110 | 0, | 5111 | 0, |
5111 | 0, | 5112 | 0, |
5112 | format_CStr("!open newtab:4 origin:%s url:%s", | 5113 | format_CStr("!open newtab:4 origin:%s url:%s", |
5113 | cstr_String(id_Widget(w)), | 5114 | cstr_String(id_Widget(w)), |
5114 | cstr_String(linkUrl)) }, | 5115 | cstr_String(linkUrl)) }, |
5115 | { "${link.side.newtab}", | 5116 | { "${link.side.newtab}", |
5116 | 0, | 5117 | 0, |
5117 | 0, | 5118 | 0, |
5118 | format_CStr("!open newtab:5 origin:%s url:%s", | 5119 | format_CStr("!open newtab:5 origin:%s url:%s", |
5119 | cstr_String(id_Widget(w)), | 5120 | cstr_String(id_Widget(w)), |
5120 | cstr_String(linkUrl)) } }, | 5121 | cstr_String(linkUrl)) }, |
5121 | 4); | 5122 | { openWindow_Icon " ${link.newwindow}", |
5123 | 0, | ||
5124 | 0, | ||
5125 | format_CStr("!open newwindow:1 origin:%s url:%s", | ||
5126 | cstr_String(id_Widget(w)), | ||
5127 | cstr_String(linkUrl)) }, | ||
5128 | }, | ||
5129 | 5); | ||
5122 | if (deviceType_App() == phone_AppDeviceType) { | 5130 | if (deviceType_App() == phone_AppDeviceType) { |
5123 | removeN_Array(&items, size_Array(&items) - 2, iInvalidSize); | 5131 | removeN_Array(&items, size_Array(&items) - 2, iInvalidSize); |
5124 | } | 5132 | } |