From c4cb544cd5beaa864b3893e4b8d0085393c7dbce Mon Sep 17 00:00:00 2001 From: Ernie Rael Date: Sun, 3 Apr 2022 15:47:28 +0100 Subject: patch 8.2.4674: cannot force getting MouseMove events Problem: Cannot force getting MouseMove events. Solution: Add the 'mousemoveevent' option with implementaiton for the GUI. (Ernie Rael, closes #10044) --- src/gui.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/gui.c') diff --git a/src/gui.c b/src/gui.c index 3e383a4b4e..3b8c0d0a80 100644 --- a/src/gui.c +++ b/src/gui.c @@ -3142,13 +3142,26 @@ button_set: if (hold_gui_events) return; + row = gui_xy2colrow(x, y, &col); + // Don't report a mouse move unless moved to a + // different character position. + if (button == MOUSE_MOVE) + { + if (row == prev_row && col == prev_col) + return; + else + { + prev_row = row >= 0 ? row : 0; + prev_col = col; + } + } + string[3] = CSI; string[4] = KS_EXTRA; string[5] = (int)button_char; // Pass the pointer coordinates of the scroll event so that we // know which window to scroll. - row = gui_xy2colrow(x, y, &col); string[6] = (char_u)(col / 128 + ' ' + 1); string[7] = (char_u)(col % 128 + ' ' + 1); string[8] = (char_u)(row / 128 + ' ' + 1); @@ -4967,12 +4980,14 @@ gui_mouse_moved(int x, int y) // apply 'mousefocus' and pointer shape gui_mouse_focus(x, y); + if (p_mousemev #ifdef FEAT_PROP_POPUP - if (popup_uses_mouse_move) - // Generate a mouse-moved event, so that the popup can perhaps be - // closed, just like in the terminal. - gui_send_mouse_event(MOUSE_MOVE, x, y, FALSE, 0); + || popup_uses_mouse_move #endif + ) + // Generate a mouse-moved event. For a mapping. Or so the + // popup can perhaps be closed, just like in the terminal. + gui_send_mouse_event(MOUSE_MOVE, x, y, FALSE, 0); } /* -- cgit v1.2.3