# HG changeset patch # User Bram Moolenaar # Date 1556982007 -7200 # Node ID a72ad8a8b249e763dc058b0037eff166b27c41f7 # Parent 5da0fe072719486ab35eb1aeaa99e911aefaba75 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 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. diff --git a/src/keymap.h b/src/keymap.h --- a/src/keymap.h +++ b/src/keymap.h @@ -114,6 +114,9 @@ #define KS_SGR_MOUSE 237 #define KS_SGR_MOUSE_RELEASE 236 +/* Used for the GPM mouse. */ +#define KS_GPM_MOUSE 235 + /* * Filler used after KS_SPECIAL and others */ diff --git a/src/os_unix.c b/src/os_unix.c --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3794,7 +3794,10 @@ check_mouse_termcode(void) && !gui.in_use # endif ) - set_mouse_termcode(KS_MOUSE, (char_u *)IF_EB("\033MG", ESC_STR "MG")); + set_mouse_termcode(KS_GPM_MOUSE, + (char_u *)IF_EB("\033MG", ESC_STR "MG")); + else + del_mouse_termcode(KS_GPM_MOUSE); # endif # ifdef FEAT_SYSMOUSE @@ -7065,7 +7068,8 @@ gpm_close(void) Gpm_Close(); } -/* Reads gpm event and adds special keys to input buf. Returns length of +/* + * Reads gpm event and adds special keys to input buf. Returns length of * generated key sequence. * This function is styled after gui_send_mouse_event(). */ diff --git a/src/term.c b/src/term.c --- a/src/term.c +++ b/src/term.c @@ -4396,9 +4396,6 @@ check_termcode( # endif #endif int cpo_koffset; -#ifdef FEAT_MOUSE_GPM - extern int gpm_flag; /* gpm library variable */ -#endif cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL); @@ -5122,6 +5119,9 @@ check_termcode( * If it is a mouse click, get the coordinates. */ if (key_name[0] == KS_MOUSE +# ifdef FEAT_MOUSE_GPM + || key_name[0] == KS_GPM_MOUSE +# endif # ifdef FEAT_MOUSE_JSB || key_name[0] == KS_JSBTERM_MOUSE # endif @@ -5144,7 +5144,11 @@ check_termcode( # if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \ || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE) - if (key_name[0] == (int)KS_MOUSE) + if (key_name[0] == KS_MOUSE +# ifdef FEAT_MOUSE_GPM + || key_name[0] == KS_GPM_MOUSE +# endif + ) { /* * For xterm we get "scr", where @@ -5274,9 +5278,12 @@ check_termcode( modifiers = 0; } - if (key_name[0] == (int)KS_MOUSE + if (key_name[0] == KS_MOUSE +# ifdef FEAT_MOUSE_GPM + || key_name[0] == KS_GPM_MOUSE +# endif # ifdef FEAT_MOUSE_URXVT - || key_name[0] == (int)KS_URXVT_MOUSE + || key_name[0] == KS_URXVT_MOUSE # endif || key_name[0] == KS_SGR_MOUSE || key_name[0] == KS_SGR_MOUSE_RELEASE) @@ -5293,7 +5300,7 @@ check_termcode( && !gui.in_use # endif # ifdef FEAT_MOUSE_GPM - && gpm_flag == 0 + && key_name[0] != KS_GPM_MOUSE # endif ) { @@ -5342,7 +5349,7 @@ check_termcode( } # endif /* !UNIX || FEAT_MOUSE_XTERM */ # ifdef FEAT_MOUSE_NET - if (key_name[0] == (int)KS_NETTERM_MOUSE) + if (key_name[0] == KS_NETTERM_MOUSE) { int mc, mr; @@ -5365,7 +5372,7 @@ check_termcode( } # endif /* FEAT_MOUSE_NET */ # ifdef FEAT_MOUSE_JSB - if (key_name[0] == (int)KS_JSBTERM_MOUSE) + if (key_name[0] == KS_JSBTERM_MOUSE) { int mult, val, iter, button, status; @@ -5489,7 +5496,7 @@ check_termcode( } # endif /* FEAT_MOUSE_JSB */ # ifdef FEAT_MOUSE_DEC - if (key_name[0] == (int)KS_DEC_MOUSE) + if (key_name[0] == KS_DEC_MOUSE) { /* The DEC Locator Input Model * Netterm delivers the code sequence: @@ -5624,7 +5631,7 @@ check_termcode( } # endif /* FEAT_MOUSE_DEC */ # ifdef FEAT_MOUSE_PTERM - if (key_name[0] == (int)KS_PTERM_MOUSE) + if (key_name[0] == KS_PTERM_MOUSE) { int button, num_clicks, action; @@ -5705,14 +5712,14 @@ check_termcode( { # ifdef CHECK_DOUBLE_CLICK # ifdef FEAT_MOUSE_GPM + /* + * Only for Unix, when GUI not active, we handle + * multi-clicks here, but not for GPM mouse events. + */ # ifdef FEAT_GUI - /* - * Only for Unix, when GUI or gpm is not active, we handle - * multi-clicks here. - */ - if (gpm_flag == 0 && !gui.in_use) + if (key_name[0] != KS_GPM_MOUSE && !gui.in_use) # else - if (gpm_flag == 0) + if (key_name[0] != KS_GPM_MOUSE) # endif # else # ifdef FEAT_GUI @@ -5800,7 +5807,7 @@ check_termcode( /* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets * added, then it's not mouse up/down. */ - key_name[0] = (int)KS_EXTRA; + key_name[0] = KS_EXTRA; if (wheel_code != 0 && (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE) { diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1265, +/**/ 1264, /**/ 1263,