Skip to content

Commit 4b8366b

Browse files
committed
patch 8.1.1267: cannot check if GPM mouse support is working
Problem: Cannot check if GPM mouse support is working. Solution: Add the "mouse_gpm_enable" feature.
1 parent 8caef44 commit 4b8366b

5 files changed

Lines changed: 19 additions & 2 deletions

File tree

runtime/doc/eval.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10532,6 +10532,7 @@ modify_fname Compiled with file name modifiers. |filename-modifiers|
1053210532
mouse Compiled with support mouse.
1053310533
mouse_dec Compiled with support for Dec terminal mouse.
1053410534
mouse_gpm Compiled with support for gpm (Linux console mouse)
10535+
mouse_gpm_enabled GPM mouse is working
1053510536
mouse_netterm Compiled with support for netterm mouse.
1053610537
mouse_pterm Compiled with support for qnx pterm mouse.
1053710538
mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse)

src/evalfunc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6810,6 +6810,10 @@ f_has(typval_T *argvars, typval_T *rettv)
68106810
else if (STRICMP(name, "netbeans_enabled") == 0)
68116811
n = netbeans_active();
68126812
#endif
6813+
#ifdef FEAT_MOUSE_GPM
6814+
else if (STRICMP(name, "mouse_gpm_enabled") == 0)
6815+
n = gpm_enabled();
6816+
#endif
68136817
#if defined(FEAT_TERMINAL) && defined(MSWIN)
68146818
else if (STRICMP(name, "terminal") == 0)
68156819
n = terminal_enabled();

src/os_unix.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7022,7 +7022,7 @@ mch_rename(const char *src, const char *dest)
70227022
}
70237023
#endif /* !HAVE_RENAME */
70247024

7025-
#ifdef FEAT_MOUSE_GPM
7025+
#if defined(FEAT_MOUSE_GPM) || defined(PROTO)
70267026
/*
70277027
* Initializes connection with gpm (if it isn't already opened)
70287028
* Return 1 if succeeded (or connection already opened), 0 if failed
@@ -7058,13 +7058,22 @@ gpm_open(void)
70587058
return 1; /* already open */
70597059
}
70607060

7061+
/*
7062+
* Returns TRUE if the GPM mouse is enabled.
7063+
*/
7064+
int
7065+
gpm_enabled(void)
7066+
{
7067+
return gpm_flag && gpm_fd >= 0;
7068+
}
7069+
70617070
/*
70627071
* Closes connection to gpm
70637072
*/
70647073
static void
70657074
gpm_close(void)
70667075
{
7067-
if (gpm_flag && gpm_fd >= 0) /* if Open */
7076+
if (gpm_enabled())
70687077
Gpm_Close();
70697078
}
70707079

src/proto/os_unix.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
7272
int mch_has_exp_wildcard(char_u *p);
7373
int mch_has_wildcard(char_u *p);
7474
int mch_rename(const char *src, const char *dest);
75+
int gpm_enabled(void);
7576
int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result);
7677
void setup_term_clip(void);
7778
void start_xterm_trace(int button);

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+
1267,
770772
/**/
771773
1266,
772774
/**/

0 commit comments

Comments
 (0)