0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-05-04 17:34:34 +02:00
parent 8caef443b2
commit 4b8366b56e
5 changed files with 19 additions and 2 deletions

View File

@@ -7022,7 +7022,7 @@ mch_rename(const char *src, const char *dest)
}
#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
@@ -7058,13 +7058,22 @@ gpm_open(void)
return 1; /* already open */
}
/*
* 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();
}