summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-10-11 21:09:51 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-10-11 21:09:51 +0300
commitdb47de76ceb593f1415b5e8b3eec5299abfb3e22 (patch)
tree9837baea163f7e9905e9998db5178bc0300c4f82
parented34833077268ebf4b67bf73ff7b396a950893ad (diff)
Paste from clipboard on middle mouse click
-rw-r--r--src/ui/window.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 41d8078f..22ad02eb 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -706,6 +706,18 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
706 } 706 }
707 } 707 }
708 iWidget *oldHover = hover_Widget(); 708 iWidget *oldHover = hover_Widget();
709 /* As a special case, clicking the middle mouse button can be used for pasting
710 from the clipboard. */
711 if (event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_MIDDLE) {
712 SDL_Event paste;
713 iZap(paste);
714 paste.type = SDL_KEYDOWN;
715 paste.key.keysym.sym = SDLK_v;
716 paste.key.keysym.mod = KMOD_PRIMARY;
717 paste.key.state = SDL_PRESSED;
718 paste.key.timestamp = SDL_GetTicks();
719 dispatchEvent_Widget(widget, &paste);
720 }
709 /* Dispatch the event to the tree of widgets. */ 721 /* Dispatch the event to the tree of widgets. */
710 iBool wasUsed = dispatchEvent_Widget(widget, &event); 722 iBool wasUsed = dispatchEvent_Widget(widget, &event);
711 if (oldHover != hover_Widget()) { 723 if (oldHover != hover_Widget()) {