Mercurial > vim
changeset 16527:5412fcd03ecb v8.1.1267
patch 8.1.1267: cannot check if GPM mouse support is working
commit https://github.com/vim/vim/commit/4b8366b56edbf4f3efcaeedbaba491c49c5788ca
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 4 17:34:34 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 May 2019 17:45:06 +0200 |
parents | 8f85d2c73e7e |
children | 36f7c8df8a66 |
files | runtime/doc/eval.txt src/evalfunc.c src/os_unix.c src/proto/os_unix.pro src/version.c |
diffstat | 5 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -10532,6 +10532,7 @@ modify_fname Compiled with file name mo mouse Compiled with support mouse. mouse_dec Compiled with support for Dec terminal mouse. mouse_gpm Compiled with support for gpm (Linux console mouse) +mouse_gpm_enabled GPM mouse is working mouse_netterm Compiled with support for netterm mouse. mouse_pterm Compiled with support for qnx pterm mouse. mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse)
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -6810,6 +6810,10 @@ f_has(typval_T *argvars, typval_T *rettv else if (STRICMP(name, "netbeans_enabled") == 0) n = netbeans_active(); #endif +#ifdef FEAT_MOUSE_GPM + else if (STRICMP(name, "mouse_gpm_enabled") == 0) + n = gpm_enabled(); +#endif #if defined(FEAT_TERMINAL) && defined(MSWIN) else if (STRICMP(name, "terminal") == 0) n = terminal_enabled();
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -7022,7 +7022,7 @@ mch_rename(const char *src, const char * } #endif /* !HAVE_RENAME */ -#ifdef FEAT_MOUSE_GPM +#if defined(FEAT_MOUSE_GPM) || defined(PROTO) /* * Initializes connection with gpm (if it isn't already opened) * Return 1 if succeeded (or connection already opened), 0 if failed @@ -7059,12 +7059,21 @@ gpm_open(void) } /* + * Returns TRUE if the GPM mouse is enabled. + */ + int +gpm_enabled(void) +{ + return gpm_flag && gpm_fd >= 0; +} + +/* * Closes connection to gpm */ static void gpm_close(void) { - if (gpm_flag && gpm_fd >= 0) /* if Open */ + if (gpm_enabled()) Gpm_Close(); }
--- a/src/proto/os_unix.pro +++ b/src/proto/os_unix.pro @@ -72,6 +72,7 @@ int mch_expand_wildcards(int num_pat, ch int mch_has_exp_wildcard(char_u *p); int mch_has_wildcard(char_u *p); int mch_rename(const char *src, const char *dest); +int gpm_enabled(void); int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result); void setup_term_clip(void); void start_xterm_trace(int button);