diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-16 14:47:19 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-16 14:47:19 +0300 |
commit | 8a3520c43ab22666bf07fc5b4b6bf62995ceb87a (patch) | |
tree | abe0316bdba99ad11c4d92629f364cfcf0b813bd /src/ui/window.c | |
parent | deea90b7255455b52723de6195fbf86b156dc3ce (diff) |
Open link in new tab with middle mouse button
IssueID #8
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 26 |
1 files changed, 14 insertions, 12 deletions
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 | } |