Mercurial > vim
comparison src/os_unix.c @ 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 | a72ad8a8b249 |
children | 0422b14bce58 |
comparison
equal
deleted
inserted
replaced
16526:8f85d2c73e7e | 16527:5412fcd03ecb |
---|---|
7020 return 0; | 7020 return 0; |
7021 return -1; | 7021 return -1; |
7022 } | 7022 } |
7023 #endif /* !HAVE_RENAME */ | 7023 #endif /* !HAVE_RENAME */ |
7024 | 7024 |
7025 #ifdef FEAT_MOUSE_GPM | 7025 #if defined(FEAT_MOUSE_GPM) || defined(PROTO) |
7026 /* | 7026 /* |
7027 * Initializes connection with gpm (if it isn't already opened) | 7027 * Initializes connection with gpm (if it isn't already opened) |
7028 * Return 1 if succeeded (or connection already opened), 0 if failed | 7028 * Return 1 if succeeded (or connection already opened), 0 if failed |
7029 */ | 7029 */ |
7030 static int | 7030 static int |
7057 } | 7057 } |
7058 return 1; /* already open */ | 7058 return 1; /* already open */ |
7059 } | 7059 } |
7060 | 7060 |
7061 /* | 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 | |
7070 /* | |
7062 * Closes connection to gpm | 7071 * Closes connection to gpm |
7063 */ | 7072 */ |
7064 static void | 7073 static void |
7065 gpm_close(void) | 7074 gpm_close(void) |
7066 { | 7075 { |
7067 if (gpm_flag && gpm_fd >= 0) /* if Open */ | 7076 if (gpm_enabled()) |
7068 Gpm_Close(); | 7077 Gpm_Close(); |
7069 } | 7078 } |
7070 | 7079 |
7071 /* | 7080 /* |
7072 * Reads gpm event and adds special keys to input buf. Returns length of | 7081 * Reads gpm event and adds special keys to input buf. Returns length of |