From 09749e95dc8747b3850cb5d1a3bded774d0880cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 18 Nov 2009 10:48:44 +0000 Subject: [PATCH] * Added a BWindow::InViewTransaction() that determines whether or not the window is currently updating its drawings as suggested by Stippi. * Add this method to decide whether to call _FontChanged() in BListView::SetFont(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34109 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/Window.h | 1 + src/kits/interface/ListView.cpp | 7 +++---- src/kits/interface/Window.cpp | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index 50841fef2c..92e40b4881 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -185,6 +185,7 @@ public: void EndViewTransaction(); // referred as CommitViewTransaction() // in BeBook + bool InViewTransaction() const; BRect Bounds() const; BRect Frame() const; diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 57c89fe2b1..faa653e7d3 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -655,10 +655,9 @@ void BListView::SetFont(const BFont* font, uint32 mask) { BView::SetFont(font, mask); - //_FontChanged(); - // TODO: this absolutely kills the performance, if a BListItem - // changes the font when drawing - if this should be called at all, - // it should only be done outside any updates! + + if (Window() != NULL && !Window()->InViewTransaction()) + _FontChanged(); } diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 323c3e5452..999a146fb2 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -682,6 +682,14 @@ BWindow::EndViewTransaction() } +bool +BWindow::InViewTransaction() const +{ + BAutolock locker(const_cast(this)); + return fInTransaction; +} + + bool BWindow::IsFront() const {