summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c5
-rw-r--r--src/ui/window.c26
2 files changed, 19 insertions, 12 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index b540a999..1a7bf4a4 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1810,6 +1810,11 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
1810 postCommand_App("navigate.forward"); 1810 postCommand_App("navigate.forward");
1811 return iTrue; 1811 return iTrue;
1812 } 1812 }
1813 if (ev->button.button == SDL_BUTTON_MIDDLE && d->hoverLink) {
1814 postCommandf_App("open newtab:1 url:%s",
1815 cstr_String(linkUrl_GmDocument(d->doc, d->hoverLink->linkId)));
1816 return iTrue;
1817 }
1813 if (ev->button.button == SDL_BUTTON_RIGHT) { 1818 if (ev->button.button == SDL_BUTTON_RIGHT) {
1814 if (!d->menu || !isVisible_Widget(d->menu)) { 1819 if (!d->menu || !isVisible_Widget(d->menu)) {
1815 d->contextLink = d->hoverLink; 1820 d->contextLink = d->hoverLink;
diff --git a/src/ui/window.c b/src/ui/window.c
index 38ee3941..40215506 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -707,20 +707,22 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
707 } 707 }
708 } 708 }
709 iWidget *oldHover = hover_Widget(); 709 iWidget *oldHover = hover_Widget();
710 /* As a special case, clicking the middle mouse button can be used for pasting
711 from the clipboard. */
712 if (event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_MIDDLE) {
713 SDL_Event paste;
714 iZap(paste);
715 paste.type = SDL_KEYDOWN;
716 paste.key.keysym.sym = SDLK_v;
717 paste.key.keysym.mod = KMOD_PRIMARY;
718 paste.key.state = SDL_PRESSED;
719 paste.key.timestamp = SDL_GetTicks();
720 dispatchEvent_Widget(widget, &paste);
721 }
722 /* Dispatch the event to the tree of widgets. */ 710 /* Dispatch the event to the tree of widgets. */
723 iBool wasUsed = dispatchEvent_Widget(widget, &event); 711 iBool wasUsed = dispatchEvent_Widget(widget, &event);
712 if (!wasUsed) {
713 /* As a special case, clicking the middle mouse button can be used for pasting
714 from the clipboard. */
715 if (event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_MIDDLE) {
716 SDL_Event paste;
717 iZap(paste);
718 paste.type = SDL_KEYDOWN;
719 paste.key.keysym.sym = SDLK_v;
720 paste.key.keysym.mod = KMOD_PRIMARY;
721 paste.key.state = SDL_PRESSED;
722 paste.key.timestamp = SDL_GetTicks();
723 wasUsed = dispatchEvent_Widget(widget, &paste);
724 }
725 }
724 if (oldHover != hover_Widget()) { 726 if (oldHover != hover_Widget()) {
725 postRefresh_App(); 727 postRefresh_App();
726 } 728 }