changeset 16647:d446e99f89f7

disallow setting selection with right mouse button in windows terminal * QWinTerminalImpl.cpp (QConsolePrivate::m_settingSelection): New member variable. (QConsolePrivate::QConsolePrivate): Initialize it. (QWinTerminalImpl::mousePressEvent, QWinTerminalImpl::mouseReleaseEvent): Set d->m_settingSelection. (QWinTerminalImpl::mouseMoveEvent): Don't do anything unless d->m_settingSelection is true.
author John W. Eaton <jwe@octave.org>
date Mon, 13 May 2013 05:58:12 -0400
parents 025bc6b5080e
children b04413e5a811
files libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp	Sun May 12 22:21:46 2013 -0400
+++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp	Mon May 13 05:58:12 2013 -0400
@@ -171,6 +171,7 @@
 
   QPoint m_beginSelection;
   QPoint m_endSelection;
+  bool m_settingSelection;
 
   QColor m_selectionColor;
   QColor m_cursorColor;
@@ -202,7 +203,8 @@
 QConsolePrivate::QConsolePrivate (QWinTerminalImpl* parent, const QString& cmd)
   : q (parent), m_command (cmd), m_hasBlinkingCursor (true),
     m_cursorType (BlockCursor), m_beginSelection (0, 0),
-    m_endSelection (0, 0), m_process (NULL), m_inWheelEvent (false)
+    m_endSelection (0, 0), m_settingSelection (false),
+    m_process (NULL), m_inWheelEvent (false)
 {
   log (NULL);
 
@@ -1177,15 +1179,22 @@
 
 void QWinTerminalImpl::mouseMoveEvent (QMouseEvent *event)
 {
-  d->m_endSelection = d->posToCell (event->pos ());
+  if (d->m_settingSelection)
+    {
+      d->m_endSelection = d->posToCell (event->pos ());
 
-  updateSelection ();
+      updateSelection ();
+    }
 }
 
 void QWinTerminalImpl::mousePressEvent (QMouseEvent *event)
 {
   if (event->button () == Qt::LeftButton)
-    d->m_beginSelection = d->posToCell (event->pos ());
+    {
+      d->m_settingSelection = true;
+
+      d->m_beginSelection = d->posToCell (event->pos ());
+    }
 }
 
 void QWinTerminalImpl::mouseReleaseEvent (QMouseEvent *event)
@@ -1195,6 +1204,8 @@
       d->m_endSelection = d->posToCell (event->pos ());
 
       updateSelection ();
+
+      d->m_settingSelection = false;
     }
 }