summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/documentwidget.c16
-rw-r--r--src/ui/keys.c1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index b3235755..3373771d 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -131,6 +131,7 @@ enum iDocumentWidgetFlag {
131 selecting_DocumentWidgetFlag = iBit(1), 131 selecting_DocumentWidgetFlag = iBit(1),
132 noHoverWhileScrolling_DocumentWidgetFlag = iBit(2), 132 noHoverWhileScrolling_DocumentWidgetFlag = iBit(2),
133 showLinkNumbers_DocumentWidgetFlag = iBit(3), 133 showLinkNumbers_DocumentWidgetFlag = iBit(3),
134 setHoverViaKeys_DocumentWidgetFlag = iBit(4),
134}; 135};
135 136
136enum iDocumentLinkOrdinalMode { 137enum iDocumentLinkOrdinalMode {
@@ -1786,6 +1787,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1786 else { 1787 else {
1787 d->ordinalMode = arg_Command(cmd); 1788 d->ordinalMode = arg_Command(cmd);
1788 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iTrue); 1789 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iTrue);
1790 iChangeFlags(d->flags, setHoverViaKeys_DocumentWidgetFlag,
1791 argLabel_Command(cmd, "hover") != 0);
1789 } 1792 }
1790 invalidateVisibleLinks_DocumentWidget_(d); 1793 invalidateVisibleLinks_DocumentWidget_(d);
1791 refresh_Widget(d); 1794 refresh_Widget(d);
@@ -2195,10 +2198,15 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
2195 const iGmRun *run = i.ptr; 2198 const iGmRun *run = i.ptr;
2196 if (run->flags & decoration_GmRunFlag && 2199 if (run->flags & decoration_GmRunFlag &&
2197 visibleLinkOrdinal_DocumentWidget_(d, run->linkId) == ord) { 2200 visibleLinkOrdinal_DocumentWidget_(d, run->linkId) == ord) {
2198 postCommandf_App("open newtab:%d url:%s", 2201 if (d->flags & setHoverViaKeys_DocumentWidgetFlag) {
2199 openTabMode_Sym(SDL_GetModState()), 2202 d->hoverLink = run;
2200 cstr_String(absoluteUrl_String( 2203 }
2201 d->mod.url, linkUrl_GmDocument(d->doc, run->linkId)))); 2204 else {
2205 postCommandf_App("open newtab:%d url:%s",
2206 openTabMode_Sym(SDL_GetModState()),
2207 cstr_String(absoluteUrl_String(
2208 d->mod.url, linkUrl_GmDocument(d->doc, run->linkId))));
2209 }
2202 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse); 2210 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse);
2203 invalidateVisibleLinks_DocumentWidget_(d); 2211 invalidateVisibleLinks_DocumentWidget_(d);
2204 refresh_Widget(d); 2212 refresh_Widget(d);
diff --git a/src/ui/keys.c b/src/ui/keys.c
index 99000d54..941dda54 100644
--- a/src/ui/keys.c
+++ b/src/ui/keys.c
@@ -77,6 +77,7 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =
77 { 35, { "Reload page", reload_KeyShortcut, "document.reload" }, 0 }, 77 { 35, { "Reload page", reload_KeyShortcut, "document.reload" }, 0 },
78 { 40, { "Open link via home row keys", 'f', 0, "document.linkkeys arg:1" }, 0 }, 78 { 40, { "Open link via home row keys", 'f', 0, "document.linkkeys arg:1" }, 0 },
79 { 41, { "Open link via modifier key", SDLK_LALT, 0, "document.linkkeys arg:0" }, argRelease_BindFlag }, 79 { 41, { "Open link via modifier key", SDLK_LALT, 0, "document.linkkeys arg:0" }, argRelease_BindFlag },
80 { 45, { "Hover on link via home row keys", 'f', KMOD_SHIFT, "document.linkkeys arg:1 hover:1" }, 0 },
80 { 70, { "Zoom in", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, 0 }, 81 { 70, { "Zoom in", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, 0 },
81 { 71, { "Zoom out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 0 }, 82 { 71, { "Zoom out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 0 },
82 { 72, { "Reset zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 0 }, 83 { 72, { "Reset zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 0 },