Mercurial > vim
comparison src/term.c @ 16523:a72ad8a8b249 v8.1.1265
patch 8.1.1265: when GPM mouse support is enabled double clicks do not work
commit https://github.com/vim/vim/commit/bedf091a951bdcd5f9f13839c0aaf2e395a635f6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 4 16:58:45 2019 +0200
patch 8.1.1265: when GPM mouse support is enabled double clicks do not work
Problem: When GPM mouse support is enabled double clicks in xterm do not
work.
Solution: Use KS_GPM_MOUSE for GPM mouse events.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 May 2019 17:00:07 +0200 |
parents | 5273b506b050 |
children | 5ebb2c87d1f5 |
comparison
equal
deleted
inserted
replaced
16522:5da0fe072719 | 16523:a72ad8a8b249 |
---|---|
4394 struct timeval mouse_time; /* time of current mouse click */ | 4394 struct timeval mouse_time; /* time of current mouse click */ |
4395 long timediff; /* elapsed time in msec */ | 4395 long timediff; /* elapsed time in msec */ |
4396 # endif | 4396 # endif |
4397 #endif | 4397 #endif |
4398 int cpo_koffset; | 4398 int cpo_koffset; |
4399 #ifdef FEAT_MOUSE_GPM | |
4400 extern int gpm_flag; /* gpm library variable */ | |
4401 #endif | |
4402 | 4399 |
4403 cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL); | 4400 cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL); |
4404 | 4401 |
4405 /* | 4402 /* |
4406 * Speed up the checks for terminal codes by gathering all first bytes | 4403 * Speed up the checks for terminal codes by gathering all first bytes |
5120 # endif | 5117 # endif |
5121 /* | 5118 /* |
5122 * If it is a mouse click, get the coordinates. | 5119 * If it is a mouse click, get the coordinates. |
5123 */ | 5120 */ |
5124 if (key_name[0] == KS_MOUSE | 5121 if (key_name[0] == KS_MOUSE |
5122 # ifdef FEAT_MOUSE_GPM | |
5123 || key_name[0] == KS_GPM_MOUSE | |
5124 # endif | |
5125 # ifdef FEAT_MOUSE_JSB | 5125 # ifdef FEAT_MOUSE_JSB |
5126 || key_name[0] == KS_JSBTERM_MOUSE | 5126 || key_name[0] == KS_JSBTERM_MOUSE |
5127 # endif | 5127 # endif |
5128 # ifdef FEAT_MOUSE_NET | 5128 # ifdef FEAT_MOUSE_NET |
5129 || key_name[0] == KS_NETTERM_MOUSE | 5129 || key_name[0] == KS_NETTERM_MOUSE |
5142 { | 5142 { |
5143 is_click = is_drag = FALSE; | 5143 is_click = is_drag = FALSE; |
5144 | 5144 |
5145 # if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \ | 5145 # if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \ |
5146 || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE) | 5146 || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE) |
5147 if (key_name[0] == (int)KS_MOUSE) | 5147 if (key_name[0] == KS_MOUSE |
5148 # ifdef FEAT_MOUSE_GPM | |
5149 || key_name[0] == KS_GPM_MOUSE | |
5150 # endif | |
5151 ) | |
5148 { | 5152 { |
5149 /* | 5153 /* |
5150 * For xterm we get "<t_mouse>scr", where | 5154 * For xterm we get "<t_mouse>scr", where |
5151 * s == encoded button state: | 5155 * s == encoded button state: |
5152 * 0x20 = left button down | 5156 * 0x20 = left button down |
5272 /* The modifiers were the mouse coordinates, not the | 5276 /* The modifiers were the mouse coordinates, not the |
5273 * modifier keys (alt/shift/ctrl/meta) state. */ | 5277 * modifier keys (alt/shift/ctrl/meta) state. */ |
5274 modifiers = 0; | 5278 modifiers = 0; |
5275 } | 5279 } |
5276 | 5280 |
5277 if (key_name[0] == (int)KS_MOUSE | 5281 if (key_name[0] == KS_MOUSE |
5282 # ifdef FEAT_MOUSE_GPM | |
5283 || key_name[0] == KS_GPM_MOUSE | |
5284 # endif | |
5278 # ifdef FEAT_MOUSE_URXVT | 5285 # ifdef FEAT_MOUSE_URXVT |
5279 || key_name[0] == (int)KS_URXVT_MOUSE | 5286 || key_name[0] == KS_URXVT_MOUSE |
5280 # endif | 5287 # endif |
5281 || key_name[0] == KS_SGR_MOUSE | 5288 || key_name[0] == KS_SGR_MOUSE |
5282 || key_name[0] == KS_SGR_MOUSE_RELEASE) | 5289 || key_name[0] == KS_SGR_MOUSE_RELEASE) |
5283 { | 5290 { |
5284 # if !defined(MSWIN) | 5291 # if !defined(MSWIN) |
5291 if (mouse_code >= MOUSEWHEEL_LOW | 5298 if (mouse_code >= MOUSEWHEEL_LOW |
5292 # ifdef FEAT_GUI | 5299 # ifdef FEAT_GUI |
5293 && !gui.in_use | 5300 && !gui.in_use |
5294 # endif | 5301 # endif |
5295 # ifdef FEAT_MOUSE_GPM | 5302 # ifdef FEAT_MOUSE_GPM |
5296 && gpm_flag == 0 | 5303 && key_name[0] != KS_GPM_MOUSE |
5297 # endif | 5304 # endif |
5298 ) | 5305 ) |
5299 { | 5306 { |
5300 # if defined(UNIX) && defined(FEAT_MOUSE_TTY) | 5307 # if defined(UNIX) && defined(FEAT_MOUSE_TTY) |
5301 if (use_xterm_mouse() > 1 && mouse_code >= 0x80) | 5308 if (use_xterm_mouse() > 1 && mouse_code >= 0x80) |
5340 # endif | 5347 # endif |
5341 # endif | 5348 # endif |
5342 } | 5349 } |
5343 # endif /* !UNIX || FEAT_MOUSE_XTERM */ | 5350 # endif /* !UNIX || FEAT_MOUSE_XTERM */ |
5344 # ifdef FEAT_MOUSE_NET | 5351 # ifdef FEAT_MOUSE_NET |
5345 if (key_name[0] == (int)KS_NETTERM_MOUSE) | 5352 if (key_name[0] == KS_NETTERM_MOUSE) |
5346 { | 5353 { |
5347 int mc, mr; | 5354 int mc, mr; |
5348 | 5355 |
5349 /* expect a rather limited sequence like: balancing { | 5356 /* expect a rather limited sequence like: balancing { |
5350 * \033}6,45\r | 5357 * \033}6,45\r |
5363 mouse_code = MOUSE_LEFT; | 5370 mouse_code = MOUSE_LEFT; |
5364 slen += (int)(p - (tp + slen)); | 5371 slen += (int)(p - (tp + slen)); |
5365 } | 5372 } |
5366 # endif /* FEAT_MOUSE_NET */ | 5373 # endif /* FEAT_MOUSE_NET */ |
5367 # ifdef FEAT_MOUSE_JSB | 5374 # ifdef FEAT_MOUSE_JSB |
5368 if (key_name[0] == (int)KS_JSBTERM_MOUSE) | 5375 if (key_name[0] == KS_JSBTERM_MOUSE) |
5369 { | 5376 { |
5370 int mult, val, iter, button, status; | 5377 int mult, val, iter, button, status; |
5371 | 5378 |
5372 /* JSBTERM Input Model | 5379 /* JSBTERM Input Model |
5373 * \033[0~zw uniq escape sequence | 5380 * \033[0~zw uniq escape sequence |
5487 | 5494 |
5488 slen += (p - (tp + slen)); | 5495 slen += (p - (tp + slen)); |
5489 } | 5496 } |
5490 # endif /* FEAT_MOUSE_JSB */ | 5497 # endif /* FEAT_MOUSE_JSB */ |
5491 # ifdef FEAT_MOUSE_DEC | 5498 # ifdef FEAT_MOUSE_DEC |
5492 if (key_name[0] == (int)KS_DEC_MOUSE) | 5499 if (key_name[0] == KS_DEC_MOUSE) |
5493 { | 5500 { |
5494 /* The DEC Locator Input Model | 5501 /* The DEC Locator Input Model |
5495 * Netterm delivers the code sequence: | 5502 * Netterm delivers the code sequence: |
5496 * \033[2;4;24;80&w (left button down) | 5503 * \033[2;4;24;80&w (left button down) |
5497 * \033[3;0;24;80&w (left button up) | 5504 * \033[3;0;24;80&w (left button up) |
5622 | 5629 |
5623 slen += (int)(p - (tp + slen)); | 5630 slen += (int)(p - (tp + slen)); |
5624 } | 5631 } |
5625 # endif /* FEAT_MOUSE_DEC */ | 5632 # endif /* FEAT_MOUSE_DEC */ |
5626 # ifdef FEAT_MOUSE_PTERM | 5633 # ifdef FEAT_MOUSE_PTERM |
5627 if (key_name[0] == (int)KS_PTERM_MOUSE) | 5634 if (key_name[0] == KS_PTERM_MOUSE) |
5628 { | 5635 { |
5629 int button, num_clicks, action; | 5636 int button, num_clicks, action; |
5630 | 5637 |
5631 p = tp + slen; | 5638 p = tp + slen; |
5632 | 5639 |
5703 } | 5710 } |
5704 else if (wheel_code == 0) | 5711 else if (wheel_code == 0) |
5705 { | 5712 { |
5706 # ifdef CHECK_DOUBLE_CLICK | 5713 # ifdef CHECK_DOUBLE_CLICK |
5707 # ifdef FEAT_MOUSE_GPM | 5714 # ifdef FEAT_MOUSE_GPM |
5715 /* | |
5716 * Only for Unix, when GUI not active, we handle | |
5717 * multi-clicks here, but not for GPM mouse events. | |
5718 */ | |
5708 # ifdef FEAT_GUI | 5719 # ifdef FEAT_GUI |
5709 /* | 5720 if (key_name[0] != KS_GPM_MOUSE && !gui.in_use) |
5710 * Only for Unix, when GUI or gpm is not active, we handle | |
5711 * multi-clicks here. | |
5712 */ | |
5713 if (gpm_flag == 0 && !gui.in_use) | |
5714 # else | 5721 # else |
5715 if (gpm_flag == 0) | 5722 if (key_name[0] != KS_GPM_MOUSE) |
5716 # endif | 5723 # endif |
5717 # else | 5724 # else |
5718 # ifdef FEAT_GUI | 5725 # ifdef FEAT_GUI |
5719 if (!gui.in_use) | 5726 if (!gui.in_use) |
5720 # endif | 5727 # endif |
5798 else if (orig_num_clicks == 4) | 5805 else if (orig_num_clicks == 4) |
5799 modifiers |= MOD_MASK_4CLICK; | 5806 modifiers |= MOD_MASK_4CLICK; |
5800 | 5807 |
5801 /* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets | 5808 /* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets |
5802 * added, then it's not mouse up/down. */ | 5809 * added, then it's not mouse up/down. */ |
5803 key_name[0] = (int)KS_EXTRA; | 5810 key_name[0] = KS_EXTRA; |
5804 if (wheel_code != 0 | 5811 if (wheel_code != 0 |
5805 && (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE) | 5812 && (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE) |
5806 { | 5813 { |
5807 if (wheel_code & MOUSE_CTRL) | 5814 if (wheel_code & MOUSE_CTRL) |
5808 modifiers |= MOD_MASK_CTRL; | 5815 modifiers |= MOD_MASK_CTRL; |