Scrolling didn't work correctly if the user didn't move the mouse all

the time. Fixed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21868 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-08-09 09:38:19 +00:00
parent 05357ae700
commit 98eadf4b9d

View File

@ -90,23 +90,10 @@ enum {
class _BTextTrackState_ {
public:
_BTextTrackState_(BMessenger messenger)
:
clickOffset(0),
shiftDown(false),
anchor(0),
selStart(0),
selEnd(0),
fRunner(NULL)
{
BMessage message(_PING_);
fRunner = new (nothrow) BMessageRunner(messenger, &message, 300000);
}
_BTextTrackState_(BMessenger messenger);
~_BTextTrackState_();
~_BTextTrackState_()
{
delete fRunner;
}
void SimulateMouseMovement(BTextView *view);
int32 clickOffset;
bool shiftDown;
@ -906,8 +893,10 @@ BTextView::MessageReceived(BMessage *message)
delete fClickRunner;
fClickRunner = NULL;
}
} else
} else if (fTrackingMouse) {
fTrackingMouse->SimulateMouseMovement(this);
PerformAutoScrolling();
}
break;
}
@ -4539,3 +4528,39 @@ BTextView::UnlockWidthBuffer()
if (atomic_add(&sWidthAtom, -1) > 1)
release_sem(sWidthSem);
}
// _BTextTrackState_
_BTextTrackState_::_BTextTrackState_(BMessenger messenger)
:
clickOffset(0),
shiftDown(false),
anchor(0),
selStart(0),
selEnd(0),
fRunner(NULL)
{
BMessage message(_PING_);
fRunner = new (nothrow) BMessageRunner(messenger, &message, 300000);
}
_BTextTrackState_::~_BTextTrackState_()
{
delete fRunner;
}
void
_BTextTrackState_::SimulateMouseMovement(BTextView *textView)
{
BPoint where;
ulong buttons;
// When the mouse cursor is still and outside the textview,
// no B_MOUSE_MOVED message are sent, obviously. But scrolling
// has to work neverthless, so we "fake" a MouseMoved() call here.
textView->GetMouse(&where, &buttons);
textView->PerformMouseMoved(where, B_INSIDE_VIEW);
}