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: private:
CardView* fView; CardView* fView;
BMessageRunner* fUpdateRunner;
BRegion fUpdateRegion; BRegion fUpdateRegion;
BLocker fUpdateLock; BLocker fUpdateLock;
}; };
@@ -276,6 +275,9 @@ CardMessageFilter::Filter(BMessage* message, BHandler** target)
case B_MOUSE_DOWN: case B_MOUSE_DOWN:
case B_MOUSE_UP: case B_MOUSE_UP:
case B_MOUSE_WHEEL_CHANGED: case B_MOUSE_WHEEL_CHANGED:
if (message->what == B_MOUSE_DOWN)
fView->SetMouseEventMask(B_POINTER_EVENTS);
fView->ForwardMessage(message); fView->ForwardMessage(message);
return B_SKIP_MESSAGE; return B_SKIP_MESSAGE;
@@ -305,7 +307,6 @@ CardWindow::CardWindow(BRect frame)
: :
BWindow(frame, "Haiku App Server", B_TITLED_WINDOW, BWindow(frame, "Haiku App Server", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NO_SERVER_SIDE_WINDOW_MODIFIERS), B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NO_SERVER_SIDE_WINDOW_MODIFIERS),
fUpdateRunner(NULL),
fUpdateRegion(), fUpdateRegion(),
fUpdateLock("update lock") fUpdateLock("update lock")
{ {
@@ -318,7 +319,6 @@ CardWindow::CardWindow(BRect frame)
CardWindow::~CardWindow() CardWindow::~CardWindow()
{ {
delete fUpdateRunner;
} }
@@ -381,14 +381,9 @@ CardWindow::SetBitmap(const BBitmap* bitmap)
void void
CardWindow::Invalidate(const BRect& frame) CardWindow::Invalidate(const BRect& frame)
{ {
if (fUpdateLock.Lock()) { if (LockWithTimeout(1000000) >= B_OK) {
if (!fUpdateRunner) { fView->Invalidate(frame);
BMessage message(MSG_UPDATE); Unlock();
fUpdateRunner = new BMessageRunner(BMessenger(this, this), &message,
20000);
}
fUpdateRegion.Include(frame);
fUpdateLock.Unlock();
} }
} }