diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-07 04:48:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-07 04:48:35 +0000 |
commit | 207df6fc406e81bfeebdff7f404bd242ff3f099f (patch) | |
tree | a1a796b056909dd0a04ffec163db9363a8757808 /src/xterm_mouse.cc | |
parent | Releasing progress-linux version 0.11.2-1~progress7.99u1. (diff) | |
download | lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip |
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/xterm_mouse.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/xterm_mouse.cc b/src/xterm_mouse.cc index f1f330a..0091f79 100644 --- a/src/xterm_mouse.cc +++ b/src/xterm_mouse.cc @@ -42,7 +42,6 @@ void xterm_mouse::handle_mouse() { bool release = false; - int ch; size_t index = 0; int bstate, x, y; char buffer[64]; @@ -52,7 +51,7 @@ xterm_mouse::handle_mouse() if (index >= sizeof(buffer) - 1) { break; } - ch = getch(); + auto ch = getch(); switch (ch) { case 'm': release = true; @@ -81,11 +80,13 @@ void xterm_mouse::set_enabled(bool enabled) { if (is_available()) { - putp(tparm((char*) XT_TERMCAP, enabled ? 1 : 0)); - putp(tparm((char*) XT_TERMCAP_TRACKING, enabled ? 1 : 0)); - putp(tparm((char*) XT_TERMCAP_SGR, enabled ? 1 : 0)); - fflush(stdout); - this->xm_enabled = enabled; + if (this->xm_enabled != enabled) { + putp(tparm((char*) XT_TERMCAP, enabled ? 1 : 0)); + putp(tparm((char*) XT_TERMCAP_TRACKING, enabled ? 1 : 0)); + putp(tparm((char*) XT_TERMCAP_SGR, enabled ? 1 : 0)); + fflush(stdout); + this->xm_enabled = enabled; + } } else { log_warning("mouse support is not available"); } |