Skip to content

Commit bedf091

Browse files
committed
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.
1 parent d2fad67 commit bedf091

4 files changed

Lines changed: 35 additions & 19 deletions

File tree

src/keymap.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@
114114
#define KS_SGR_MOUSE 237
115115
#define KS_SGR_MOUSE_RELEASE 236
116116

117+
/* Used for the GPM mouse. */
118+
#define KS_GPM_MOUSE 235
119+
117120
/*
118121
* Filler used after KS_SPECIAL and others
119122
*/

src/os_unix.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3794,7 +3794,10 @@ check_mouse_termcode(void)
37943794
&& !gui.in_use
37953795
# endif
37963796
)
3797-
set_mouse_termcode(KS_MOUSE, (char_u *)IF_EB("\033MG", ESC_STR "MG"));
3797+
set_mouse_termcode(KS_GPM_MOUSE,
3798+
(char_u *)IF_EB("\033MG", ESC_STR "MG"));
3799+
else
3800+
del_mouse_termcode(KS_GPM_MOUSE);
37983801
# endif
37993802

38003803
# ifdef FEAT_SYSMOUSE
@@ -7065,7 +7068,8 @@ gpm_close(void)
70657068
Gpm_Close();
70667069
}
70677070

7068-
/* Reads gpm event and adds special keys to input buf. Returns length of
7071+
/*
7072+
* Reads gpm event and adds special keys to input buf. Returns length of
70697073
* generated key sequence.
70707074
* This function is styled after gui_send_mouse_event().
70717075
*/

src/term.c

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4396,9 +4396,6 @@ check_termcode(
43964396
# endif
43974397
#endif
43984398
int cpo_koffset;
4399-
#ifdef FEAT_MOUSE_GPM
4400-
extern int gpm_flag; /* gpm library variable */
4401-
#endif
44024399

44034400
cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL);
44044401

@@ -5122,6 +5119,9 @@ check_termcode(
51225119
* If it is a mouse click, get the coordinates.
51235120
*/
51245121
if (key_name[0] == KS_MOUSE
5122+
# ifdef FEAT_MOUSE_GPM
5123+
|| key_name[0] == KS_GPM_MOUSE
5124+
# endif
51255125
# ifdef FEAT_MOUSE_JSB
51265126
|| key_name[0] == KS_JSBTERM_MOUSE
51275127
# endif
@@ -5144,7 +5144,11 @@ check_termcode(
51445144

51455145
# if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
51465146
|| 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+
)
51485152
{
51495153
/*
51505154
* For xterm we get "<t_mouse>scr", where
@@ -5274,9 +5278,12 @@ check_termcode(
52745278
modifiers = 0;
52755279
}
52765280

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
52785285
# ifdef FEAT_MOUSE_URXVT
5279-
|| key_name[0] == (int)KS_URXVT_MOUSE
5286+
|| key_name[0] == KS_URXVT_MOUSE
52805287
# endif
52815288
|| key_name[0] == KS_SGR_MOUSE
52825289
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
@@ -5293,7 +5300,7 @@ check_termcode(
52935300
&& !gui.in_use
52945301
# endif
52955302
# ifdef FEAT_MOUSE_GPM
5296-
&& gpm_flag == 0
5303+
&& key_name[0] != KS_GPM_MOUSE
52975304
# endif
52985305
)
52995306
{
@@ -5342,7 +5349,7 @@ check_termcode(
53425349
}
53435350
# endif /* !UNIX || FEAT_MOUSE_XTERM */
53445351
# ifdef FEAT_MOUSE_NET
5345-
if (key_name[0] == (int)KS_NETTERM_MOUSE)
5352+
if (key_name[0] == KS_NETTERM_MOUSE)
53465353
{
53475354
int mc, mr;
53485355

@@ -5365,7 +5372,7 @@ check_termcode(
53655372
}
53665373
# endif /* FEAT_MOUSE_NET */
53675374
# ifdef FEAT_MOUSE_JSB
5368-
if (key_name[0] == (int)KS_JSBTERM_MOUSE)
5375+
if (key_name[0] == KS_JSBTERM_MOUSE)
53695376
{
53705377
int mult, val, iter, button, status;
53715378

@@ -5489,7 +5496,7 @@ check_termcode(
54895496
}
54905497
# endif /* FEAT_MOUSE_JSB */
54915498
# ifdef FEAT_MOUSE_DEC
5492-
if (key_name[0] == (int)KS_DEC_MOUSE)
5499+
if (key_name[0] == KS_DEC_MOUSE)
54935500
{
54945501
/* The DEC Locator Input Model
54955502
* Netterm delivers the code sequence:
@@ -5624,7 +5631,7 @@ check_termcode(
56245631
}
56255632
# endif /* FEAT_MOUSE_DEC */
56265633
# ifdef FEAT_MOUSE_PTERM
5627-
if (key_name[0] == (int)KS_PTERM_MOUSE)
5634+
if (key_name[0] == KS_PTERM_MOUSE)
56285635
{
56295636
int button, num_clicks, action;
56305637

@@ -5705,14 +5712,14 @@ check_termcode(
57055712
{
57065713
# ifdef CHECK_DOUBLE_CLICK
57075714
# ifdef FEAT_MOUSE_GPM
5708-
# ifdef FEAT_GUI
57095715
/*
5710-
* Only for Unix, when GUI or gpm is not active, we handle
5711-
* multi-clicks here.
5716+
* Only for Unix, when GUI not active, we handle
5717+
* multi-clicks here, but not for GPM mouse events.
57125718
*/
5713-
if (gpm_flag == 0 && !gui.in_use)
5719+
# ifdef FEAT_GUI
5720+
if (key_name[0] != KS_GPM_MOUSE && !gui.in_use)
57145721
# else
5715-
if (gpm_flag == 0)
5722+
if (key_name[0] != KS_GPM_MOUSE)
57165723
# endif
57175724
# else
57185725
# ifdef FEAT_GUI
@@ -5800,7 +5807,7 @@ check_termcode(
58005807

58015808
/* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets
58025809
* added, then it's not mouse up/down. */
5803-
key_name[0] = (int)KS_EXTRA;
5810+
key_name[0] = KS_EXTRA;
58045811
if (wheel_code != 0
58055812
&& (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE)
58065813
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1265,
770772
/**/
771773
1264,
772774
/**/

0 commit comments

Comments
 (0)