mirror of
https://github.com/KDE/konsole.git
synced 2026-06-10 15:05:11 -04:00
Also prevent an intermediate selection entry for triple click
If a release event is the result of a double click, don't copy immediately to X11 selection. Instead, start a timer, and copy only if no third click happens during the interval.
This commit is contained in:
committed by
Kurt Hindenburg
parent
f68f7f7cff
commit
0752cf3d62
@@ -1118,6 +1118,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent *ev)
|
||||
}
|
||||
|
||||
if (_possibleTripleClick && (ev->button() == Qt::LeftButton)) {
|
||||
_needCopyToX11Selection = false;
|
||||
mouseTripleClickEvent(ev);
|
||||
return;
|
||||
}
|
||||
@@ -1476,7 +1477,16 @@ void TerminalDisplay::mouseReleaseEvent(QMouseEvent *ev)
|
||||
_screenWindow->clearSelection();
|
||||
} else {
|
||||
if (_actSel > 1) {
|
||||
copyToX11Selection();
|
||||
if (_possibleTripleClick) {
|
||||
_needCopyToX11Selection = true;
|
||||
QTimer::singleShot(QApplication::doubleClickInterval(), this, [this]() {
|
||||
if (_needCopyToX11Selection) {
|
||||
copyToX11Selection();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
copyToX11Selection();
|
||||
}
|
||||
}
|
||||
|
||||
_actSel = 0;
|
||||
|
||||
@@ -730,6 +730,7 @@ private:
|
||||
Enum::TripleClickModeEnum _tripleClickMode = Enum::SelectWholeLine;
|
||||
bool _possibleTripleClick = false; // is set in mouseDoubleClickEvent and deleted
|
||||
// after QApplication::doubleClickInterval() delay
|
||||
bool _needCopyToX11Selection = false; // set in mouseReleaseEvent after mouseDoubleClickEvent
|
||||
|
||||
QLabel *_resizeWidget = nullptr;
|
||||
QTimer *_resizeTimer = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user