summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2015-11-22 18:23:40 +0100
committerAndrzej Rybczak <electricityispower@gmail.com>2015-11-22 18:25:00 +0100
commitf173a582cefb895eb65128cae70cb264e2d4f009 (patch)
treec87f4bcd3db903123541c6e20b014cd9e1c0162e /src
parent7f148f9c34d9db2d98cd752e7085fea5cfd925df (diff)
window: keep mouse disabled if it was initially disabled
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 5a63fc67..e475fa0d 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -308,13 +308,13 @@ namespace Mouse {
namespace {
-bool mouseEnabled = false;
+bool supportEnabled = false;
}
void enable()
{
- if (mouseEnabled)
+ if (!supportEnabled)
return;
// save old highlight mouse tracking
std::printf("\e[?1001s");
@@ -322,12 +322,11 @@ void enable()
std::printf("\e[?1000h");
// try to enable extended (urxvt) mouse tracking
std::printf("\e[?1015h");
- mouseEnabled = true;
}
void disable()
{
- if (!mouseEnabled)
+ if (!supportEnabled)
return;
// disable extended (urxvt) mouse tracking
std::printf("\e[?1015l");
@@ -335,7 +334,6 @@ void disable()
std::printf("\e[?1000l");
// restore old highlight mouse tracking
std::printf("\e[?1001r");
- mouseEnabled = false;
}
}
@@ -360,8 +358,8 @@ void initScreen(bool enable_colors, bool enable_mouse)
curs_set(0);
// setup mouse
- if (enable_mouse)
- Mouse::enable();
+ Mouse::supportEnabled = enable_mouse;
+ Mouse::enable();
// initialize readline (needed, otherwise we get segmentation
// fault on SIGWINCH). also, initialize first as doing this