summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJekyll Wu <adaptee@gmail.com>2011-10-14 10:46:49 (GMT)
committerJekyll Wu <adaptee@gmail.com>2012-05-16 21:30:26 (GMT)
commita123872f295c3c15f45157162d2f06b272bc99ae (patch)
treebe91bb473b321d3352895d3351ce637761f60144
parent6fa0121b8ef31934153767678ed18467e900eca0 (diff)
Process the double-click event triggered by successive middle buttons
BUG: 280332 FIXED-IN: 4.9.0
-rw-r--r--src/TerminalDisplay.cpp42
-rw-r--r--src/TerminalDisplay.h2
2 files changed, 30 insertions, 14 deletions
diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
index 18f3268..aa75e7c 100644
--- a/src/TerminalDisplay.cpp
+++ b/src/TerminalDisplay.cpp
@@ -1784,20 +1784,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
}
}
} else if (ev->button() == Qt::MidButton) {
- if (_mouseMarks || (ev->modifiers() & Qt::ShiftModifier)) {
- const bool appendEnter = ev->modifiers() & Qt::ControlModifier;
-
- if ( _middleClickPasteMode == Enum::PasteFromX11Selection ) {
- pasteFromX11Selection(appendEnter);
- } else if ( _middleClickPasteMode == Enum::PasteFromClipboard ) {
- pasteFromClipboard(appendEnter);
- } else {
- Q_ASSERT(false);
- }
-
- } else {
- emit mouseSignal(1, charColumn + 1, charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 0);
- }
+ processMidButtonClick(ev);
} else if (ev->button() == Qt::RightButton) {
if (_mouseMarks || (ev->modifiers() & Qt::ShiftModifier))
emit configureRequest(ev->pos());
@@ -2190,8 +2177,35 @@ void TerminalDisplay::updateLineProperties()
_lineProperties = _screenWindow->getLineProperties();
}
+void TerminalDisplay::processMidButtonClick(QMouseEvent* ev)
+{
+ if (_mouseMarks || (ev->modifiers() & Qt::ShiftModifier)) {
+ const bool appendEnter = ev->modifiers() & Qt::ControlModifier;
+
+ if ( _middleClickPasteMode == Enum::PasteFromX11Selection ) {
+ pasteFromX11Selection(appendEnter);
+ } else if ( _middleClickPasteMode == Enum::PasteFromClipboard ) {
+ pasteFromClipboard(appendEnter);
+ } else {
+ Q_ASSERT(false);
+ }
+ } else {
+ int charLine = 0;
+ int charColumn = 0;
+ getCharacterPosition(ev->pos(), charLine, charColumn);
+
+ emit mouseSignal(1, charColumn + 1, charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 0);
+ }
+}
+
void TerminalDisplay::mouseDoubleClickEvent(QMouseEvent* ev)
{
+ // Yes, successive middle click can trigger this event
+ if (ev->button() == Qt::MidButton) {
+ processMidButtonClick(ev);
+ return;
+ }
+
if (ev->button() != Qt::LeftButton) return;
if (!_screenWindow) return;
diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h
index 69b96c0..c53af8c 100644
--- a/src/TerminalDisplay.h
+++ b/src/TerminalDisplay.h
@@ -692,6 +692,8 @@ private:
void doPaste(QString text, bool appendReturn);
+ void processMidButtonClick(QMouseEvent* event);
+
// the window onto the terminal screen which this display
// is currently showing.
QPointer<ScreenWindow> _screenWindow;