ViewHWInterface: make updating faster, capture pointer on mouse down

Change-Id: I14551e9db2ddb47e8aab492c2d241df1001f6d79
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2830
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
X512
2020-05-28 14:23:26 +00:00
committed by waddlesplash
parent 8c6ebdec76
commit 4b5b437427
+6 -11
View File
@@ -146,7 +146,6 @@ public:
private:
CardView* fView;
BMessageRunner* fUpdateRunner;
BRegion fUpdateRegion;
BLocker fUpdateLock;
};
@@ -276,6 +275,9 @@ CardMessageFilter::Filter(BMessage* message, BHandler** target)
case B_MOUSE_DOWN:
case B_MOUSE_UP:
case B_MOUSE_WHEEL_CHANGED:
if (message->what == B_MOUSE_DOWN)
fView->SetMouseEventMask(B_POINTER_EVENTS);
fView->ForwardMessage(message);
return B_SKIP_MESSAGE;
@@ -305,7 +307,6 @@ CardWindow::CardWindow(BRect frame)
:
BWindow(frame, "Haiku App Server", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NO_SERVER_SIDE_WINDOW_MODIFIERS),
fUpdateRunner(NULL),
fUpdateRegion(),
fUpdateLock("update lock")
{
@@ -318,7 +319,6 @@ CardWindow::CardWindow(BRect frame)
CardWindow::~CardWindow()
{
delete fUpdateRunner;
}
@@ -381,14 +381,9 @@ CardWindow::SetBitmap(const BBitmap* bitmap)
void
CardWindow::Invalidate(const BRect& frame)
{
if (fUpdateLock.Lock()) {
if (!fUpdateRunner) {
BMessage message(MSG_UPDATE);
fUpdateRunner = new BMessageRunner(BMessenger(this, this), &message,
20000);
}
fUpdateRegion.Include(frame);
fUpdateLock.Unlock();
if (LockWithTimeout(1000000) >= B_OK) {
fView->Invalidate(frame);
Unlock();
}
}