From 435455abc1d3e5243b9d4e156bca752129e71bb7 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 30 Apr 2009 20:19:43 +0000 Subject: [PATCH] * textviews that aren't editable no longer perform cut or paste actions (again reported by kirilla, thanks!) * when tracking the mouse in order to detect drags, it is not necessary to check if the pointer is within the selection, as that causes problems when you e.g. click on the border of the selection and then move the mouse outside of it (we'd still want to initiate a drag in that case) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30519 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/TextView.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index ba1b02ff40..230e565a48 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -1342,6 +1342,8 @@ void BTextView::Cut(BClipboard *clipboard) { _CancelInputMethod(); + if (!fEditable) + return; if (fUndo) { delete fUndo; fUndo = new CutUndoBuffer(this); @@ -1391,7 +1393,7 @@ BTextView::Paste(BClipboard *clipboard) CALLED(); _CancelInputMethod(); - if (!clipboard->Lock()) + if (!fEditable || !clipboard->Lock()) return; BMessage *clip = clipboard->Data(); @@ -4439,8 +4441,7 @@ BTextView::_PerformMouseUp(BPoint where) if (fTrackingMouse == NULL) return false; - if (fTrackingMouse->selectionRect.IsValid() - && fTrackingMouse->selectionRect.Contains(where)) + if (fTrackingMouse->selectionRect.IsValid()) Select(fTrackingMouse->clickOffset, fTrackingMouse->clickOffset); _StopMouseTracking(); @@ -4460,8 +4461,7 @@ BTextView::_PerformMouseMoved(BPoint where, uint32 code) return false; int32 currentOffset = OffsetAt(where); - if (fTrackingMouse->selectionRect.IsValid() - && fTrackingMouse->selectionRect.Contains(where)) { + if (fTrackingMouse->selectionRect.IsValid()) { // we are tracking the mouse for drag action, if the mouse has moved // from where it was clicked, we initiate a drag now: if (currentOffset != fTrackingMouse->clickOffset) {