Commit 1a63b91d authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Tomaz Canabrava
Browse files

Respect read-only for all mouse tracking events

The read-only property wasn't being respected for mouse move and mouse
release events.
parent 7cbbb07f
......@@ -1264,21 +1264,23 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev)
// events then emit a mouse movement signal, unless the shift key is
// being held down, which overrides this.
if (_usesMouseTracking && !(ev->modifiers() & Qt::ShiftModifier)) {
int button = 3;
if ((ev->buttons() & Qt::LeftButton) != 0u) {
button = 0;
}
if ((ev->buttons() & Qt::MiddleButton) != 0u) {
button = 1;
}
if ((ev->buttons() & Qt::RightButton) != 0u) {
button = 2;
}
if (!_readOnly) {
int button = 3;
if ((ev->buttons() & Qt::LeftButton) != 0u) {
button = 0;
}
if ((ev->buttons() & Qt::MiddleButton) != 0u) {
button = 1;
}
if ((ev->buttons() & Qt::RightButton) != 0u) {
button = 2;
}
Q_EMIT mouseSignal(button,
charColumn + 1,
charLine + 1 + _scrollBar->value() - _scrollBar->maximum(),
1);
Q_EMIT mouseSignal(button,
charColumn + 1,
charLine + 1 + _scrollBar->value() - _scrollBar->maximum(),
1);
}
return;
}
......@@ -1504,7 +1506,7 @@ void TerminalDisplay::mouseReleaseEvent(QMouseEvent* ev)
// outside the range. The procedure used in `mouseMoveEvent'
// applies here, too.
if (_usesMouseTracking && !(ev->modifiers() & Qt::ShiftModifier)) {
if (_usesMouseTracking && !(ev->modifiers() & Qt::ShiftModifier) && !_readOnly) {
Q_EMIT mouseSignal(0,
charColumn + 1,
charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 2);
......@@ -1513,7 +1515,7 @@ void TerminalDisplay::mouseReleaseEvent(QMouseEvent* ev)
_dragInfo.state = diNone;
}
if (_usesMouseTracking &&
if (_usesMouseTracking && !_readOnly &&
(ev->button() == Qt::RightButton || ev->button() == Qt::MiddleButton) &&
!(ev->modifiers() & Qt::ShiftModifier)) {
Q_EMIT mouseSignal(ev->button() == Qt::MiddleButton ? 1 : 2,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment