summaryrefslogtreecommitdiff
path: root/src/gui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-08 21:57:30 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-08 21:57:30 +0200
commit49fe95f22517b775506ef34681000d84bb417eb3 (patch)
tree7ad7c9afcc187735c9b6175bf85ac8efff012a2b /src/gui.c
parent999224422633935eaa8b804ce3d1c2f9ca195d0a (diff)
downloadvim-git-49fe95f22517b775506ef34681000d84bb417eb3.tar.gz
patch 8.1.1652: GUI: popup window doesn't close on mouse movementv8.1.1652
Problem: GUI: popup window doesn't close on mouse movement. (Paul Jolly) Solution: Generate mouse-move events when a popup window is visible.
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/gui.c b/src/gui.c
index 7c378c6fe..5dcab515a 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4823,18 +4823,15 @@ gui_focus_change(int in_focus)
}
/*
- * Called when the mouse moved (but not when dragging).
+ * When mouse moved: apply 'mousefocus'.
+ * Also updates the mouse pointer shape.
*/
- void
-gui_mouse_moved(int x, int y)
+ static void
+gui_mouse_focus(int x, int y)
{
win_T *wp;
char_u st[8];
- /* Ignore this while still starting up. */
- if (!gui.in_use || gui.starting)
- return;
-
#ifdef FEAT_MOUSESHAPE
/* Get window pointer, and update mouse shape as well. */
wp = xy2win(x, y);
@@ -4894,6 +4891,27 @@ gui_mouse_moved(int x, int y)
}
/*
+ * Called when the mouse moved (but not when dragging).
+ */
+ void
+gui_mouse_moved(int x, int y)
+{
+ // Ignore this while still starting up.
+ if (!gui.in_use || gui.starting)
+ return;
+
+ // apply 'mousefocus' and pointer shape
+ gui_mouse_focus(x, y);
+
+#ifdef FEAT_TEXT_PROP
+ if (popup_visible)
+ // Generate a mouse-moved event, so that the popup can perhaps be
+ // closed, just like in the terminal.
+ gui_send_mouse_event(MOUSE_DRAG, x, y, FALSE, 0);
+#endif
+}
+
+/*
* Called when mouse should be moved to window with focus.
*/
void