tui: Only enable/disable mouse when there's something to do (#6411)

If we get a mouse_on/mouse_off event, but the mouse is already in the
corresponding state, there's no need to send the event up to the
terminal.

Closes #4394
This commit is contained in:
James McCoy 2017-04-01 18:00:42 -04:00 committed by Justin M. Keyes
parent 518f28f537
commit 16babc6687

View File

@ -452,15 +452,19 @@ static void tui_busy_stop(UI *ui)
static void tui_mouse_on(UI *ui) static void tui_mouse_on(UI *ui)
{ {
TUIData *data = ui->data; TUIData *data = ui->data;
unibi_out(ui, data->unibi_ext.enable_mouse); if (!data->mouse_enabled) {
data->mouse_enabled = true; unibi_out(ui, data->unibi_ext.enable_mouse);
data->mouse_enabled = true;
}
} }
static void tui_mouse_off(UI *ui) static void tui_mouse_off(UI *ui)
{ {
TUIData *data = ui->data; TUIData *data = ui->data;
unibi_out(ui, data->unibi_ext.disable_mouse); if (data->mouse_enabled) {
data->mouse_enabled = false; unibi_out(ui, data->unibi_ext.disable_mouse);
data->mouse_enabled = false;
}
} }
static void tui_mode_change(UI *ui, int mode) static void tui_mode_change(UI *ui, int mode)