window: keep mouse disabled if it was initially disabled

This commit is contained in:
Andrzej Rybczak
2015-11-22 18:23:40 +01:00
parent 7f148f9c34
commit f173a582ce
2 changed files with 6 additions and 7 deletions

1
NEWS
View File

@@ -1,6 +1,7 @@
ncmpcpp-0.7_beta2 (????-??-??)
* Playlist sorting dialog now contains 'Album artist' option.
* Default keybindings were corrected to allow tag edition in the right column of tag editor.
* Mouse is properly kept disabled if it was disabled in the configuration file.
ncmpcpp-0.6.8 (2015-11-11)
* Application is now compatible with MPD >= 0.20.

View File

@@ -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