Fixed two bug(let)s in BTextView that I encountered when working on the

Keymap preflet:
* obscure the cursor only if the textview has the focus
* initiate a drag not only if the cursor has moved to another index, but also
  when the cursor has moved more than three pixels, since otherwise it was
  impossible to drag the first character to the left or top of the view
  (as the corresponding index was always zero)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30698 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2009-05-10 13:09:41 +00:00
parent b4dce77e73
commit 6f260d075b
+11 -4
View File
@@ -117,6 +117,7 @@ public:
int32 clickOffset;
bool shiftDown;
BRect selectionRect;
BPoint where;
int32 anchor;
int32 selStart;
@@ -552,6 +553,7 @@ BTextView::MouseDown(BPoint where)
fTrackingMouse->clickOffset = OffsetAt(where);
fTrackingMouse->shiftDown = modifiers & B_SHIFT_KEY;
fTrackingMouse->where = where;
bigtime_t clickTime = system_time();
bigtime_t clickSpeed = 0;
@@ -738,7 +740,8 @@ BTextView::KeyDown(const char *bytes, int32 numBytes)
}
// hide the cursor and caret
be_app->ObscureCursor();
if (IsFocus())
be_app->ObscureCursor();
_HideCaret();
switch (keyPressed) {
@@ -4458,8 +4461,11 @@ BTextView::_PerformMouseMoved(BPoint where, uint32 code)
int32 currentOffset = OffsetAt(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) {
// to another index or more than three pixels from where it was clicked,
// we initiate a drag now:
if (currentOffset != fTrackingMouse->clickOffset
|| fabs(fTrackingMouse->where.x - where.x) > 3
|| fabs(fTrackingMouse->where.y - where.y) > 3) {
_StopMouseTracking();
_InitiateDrag();
return true;
@@ -5126,7 +5132,8 @@ BTextView::_HandleInputMethodChanged(BMessage *message)
_HideCaret();
be_app->ObscureCursor();
if (IsFocus())
be_app->ObscureCursor();
// If we find the "be:confirmed" boolean (and the boolean is true),
// it means it's over for now, so the current InlineInput object