From f173a582cefb895eb65128cae70cb264e2d4f009 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 22 Nov 2015 18:23:40 +0100 Subject: window: keep mouse disabled if it was initially disabled --- src/window.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') 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 -- cgit v1.2.3