window: keep mouse disabled if it was initially disabled
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,6 +1,7 @@
|
|||||||
ncmpcpp-0.7_beta2 (????-??-??)
|
ncmpcpp-0.7_beta2 (????-??-??)
|
||||||
* Playlist sorting dialog now contains 'Album artist' option.
|
* Playlist sorting dialog now contains 'Album artist' option.
|
||||||
* Default keybindings were corrected to allow tag edition in the right column of tag editor.
|
* 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)
|
ncmpcpp-0.6.8 (2015-11-11)
|
||||||
* Application is now compatible with MPD >= 0.20.
|
* Application is now compatible with MPD >= 0.20.
|
||||||
|
|||||||
@@ -308,13 +308,13 @@ namespace Mouse {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool mouseEnabled = false;
|
bool supportEnabled = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable()
|
void enable()
|
||||||
{
|
{
|
||||||
if (mouseEnabled)
|
if (!supportEnabled)
|
||||||
return;
|
return;
|
||||||
// save old highlight mouse tracking
|
// save old highlight mouse tracking
|
||||||
std::printf("\e[?1001s");
|
std::printf("\e[?1001s");
|
||||||
@@ -322,12 +322,11 @@ void enable()
|
|||||||
std::printf("\e[?1000h");
|
std::printf("\e[?1000h");
|
||||||
// try to enable extended (urxvt) mouse tracking
|
// try to enable extended (urxvt) mouse tracking
|
||||||
std::printf("\e[?1015h");
|
std::printf("\e[?1015h");
|
||||||
mouseEnabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable()
|
void disable()
|
||||||
{
|
{
|
||||||
if (!mouseEnabled)
|
if (!supportEnabled)
|
||||||
return;
|
return;
|
||||||
// disable extended (urxvt) mouse tracking
|
// disable extended (urxvt) mouse tracking
|
||||||
std::printf("\e[?1015l");
|
std::printf("\e[?1015l");
|
||||||
@@ -335,7 +334,6 @@ void disable()
|
|||||||
std::printf("\e[?1000l");
|
std::printf("\e[?1000l");
|
||||||
// restore old highlight mouse tracking
|
// restore old highlight mouse tracking
|
||||||
std::printf("\e[?1001r");
|
std::printf("\e[?1001r");
|
||||||
mouseEnabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -360,8 +358,8 @@ void initScreen(bool enable_colors, bool enable_mouse)
|
|||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|
||||||
// setup mouse
|
// setup mouse
|
||||||
if (enable_mouse)
|
Mouse::supportEnabled = enable_mouse;
|
||||||
Mouse::enable();
|
Mouse::enable();
|
||||||
|
|
||||||
// initialize readline (needed, otherwise we get segmentation
|
// initialize readline (needed, otherwise we get segmentation
|
||||||
// fault on SIGWINCH). also, initialize first as doing this
|
// fault on SIGWINCH). also, initialize first as doing this
|
||||||
|
|||||||
Reference in New Issue
Block a user