0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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)
This commit is contained in:
Ernie Rael
2022-04-03 15:47:28 +01:00
committed by Bram Moolenaar
parent 8ef6997e2d
commit c4cb544cd5
9 changed files with 166 additions and 16 deletions

View File

@@ -1368,22 +1368,35 @@ test_gui_mouse_event(dict_T *args)
int col;
int repeated_click;
int_u mods;
int move;
if (dict_find(args, (char_u *)"button", -1) == NULL
|| dict_find(args, (char_u *)"row", -1) == NULL
|| dict_find(args, (char_u *)"col", -1) == NULL
|| dict_find(args, (char_u *)"multiclick", -1) == NULL
|| dict_find(args, (char_u *)"modifiers", -1) == NULL)
if (dict_find(args, (char_u *)"row", -1) == NULL
|| dict_find(args, (char_u *)"col", -1) == NULL)
return FALSE;
// Note: "move" is optional, requires fewer arguments
move = (int)dict_get_bool(args, (char_u *)"move", FALSE);
if (!move && (dict_find(args, (char_u *)"button", -1) == NULL
|| dict_find(args, (char_u *)"multiclick", -1) == NULL
|| dict_find(args, (char_u *)"modifiers", -1) == NULL))
return FALSE;
button = (int)dict_get_number(args, (char_u *)"button");
row = (int)dict_get_number(args, (char_u *)"row");
col = (int)dict_get_number(args, (char_u *)"col");
repeated_click = (int)dict_get_number(args, (char_u *)"multiclick");
mods = (int)dict_get_number(args, (char_u *)"modifiers");
gui_send_mouse_event(button, TEXT_X(col - 1), TEXT_Y(row - 1),
if (move)
gui_mouse_moved(col, row);
else
{
button = (int)dict_get_number(args, (char_u *)"button");
repeated_click = (int)dict_get_number(args, (char_u *)"multiclick");
mods = (int)dict_get_number(args, (char_u *)"modifiers");
gui_send_mouse_event(button, TEXT_X(col - 1), TEXT_Y(row - 1),
repeated_click, mods);
}
return TRUE;
}