]> granicus.if.org Git - vim/commitdiff
patch 8.1.1267: cannot check if GPM mouse support is working v8.1.1267
authorBram Moolenaar <Bram@vim.org>
Sat, 4 May 2019 15:34:34 +0000 (17:34 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 May 2019 15:34:34 +0000 (17:34 +0200)
Problem:    Cannot check if GPM mouse support is working.
Solution:   Add the "mouse_gpm_enable" feature.

runtime/doc/eval.txt
src/evalfunc.c
src/os_unix.c
src/proto/os_unix.pro
src/version.c

index c12e69e4a153d49b16eb2f7be2a64f6be35ef84d..bc18daaca290a36a01a64ed83bb633e840cffa37 100644 (file)
@@ -10532,6 +10532,7 @@ modify_fname            Compiled with file name modifiers. |filename-modifiers|
 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)
index 7b6785cfae6fe9d40231a10720fdb10148c95d79..a2be7b903b07daade63ef444a0d7943bca58b243 100644 (file)
@@ -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();
index 9f8a7b110ead886a2edee026073580faf62ce2ec..b5627b162812c266b8b7f01494055c10815ea06b 100644 (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();
 }
 
index 721c07daac6430409077ba9eb2b046b93a9ffef5..0117b1ea1e71703f16ca1c7f3962fe76f7d65708 100644 (file)
@@ -72,6 +72,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
 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);
index 8458a816386321fa8174c76eb6a94f65d8520895..6877673604d33ce445295b791a9027401dbdc291 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1267,
 /**/
     1266,
 /**/