diff options
author | Ernie Rael <errael@raelity.com> | 2022-04-03 15:47:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-03 15:47:28 +0100 |
commit | c4cb544cd5beaa864b3893e4b8d0085393c7dbce (patch) | |
tree | 3e04f56d7b0a6d71d3bcb40c9107b031cf5bd949 /src/testing.c | |
parent | 8ef6997e2d90808dec033373c96dda68843af12e (diff) | |
download | vim-git-c4cb544cd5beaa864b3893e4b8d0085393c7dbce.tar.gz |
patch 8.2.4674: cannot force getting MouseMove eventsv8.2.4674
Problem: Cannot force getting MouseMove events.
Solution: Add the 'mousemoveevent' option with implementaiton for the GUI.
(Ernie Rael, closes #10044)
Diffstat (limited to 'src/testing.c')
-rw-r--r-- | src/testing.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/testing.c b/src/testing.c index 48ba14d2c..c05348753 100644 --- a/src/testing.c +++ b/src/testing.c @@ -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 + 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) + || 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; } |