Skip to content

Commit

Permalink
Fixed|libappfw: LogWidget's rewrapping behavior after refactoring
Browse files Browse the repository at this point in the history
Every call to TextDrawable::update() potentially changes the visible
contents of the drawable, so its return value always should be
acted upon.
  • Loading branch information
skyjake committed Jun 8, 2014
1 parent 51acadd commit 0734577
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doomsday/libappfw/src/widgets/logwidget.cpp
Expand Up @@ -149,7 +149,7 @@ public Font::RichFormat::IStyle

void update(int yBottom, Rangei const &visiblePixels)
{
if(!_height) return;
if(!_height || drawable.isBeingWrapped()) return;

// Determine which lines might be visible.
int const lineSpacing = drawable.font().lineSpacing().value();
Expand Down Expand Up @@ -197,7 +197,7 @@ public Font::RichFormat::IStyle
//int const oldHeight = _height;

// Prepare the visible lines for drawing.
drawable.update();
//drawable.update();

/*{
//_dirty = false;
Expand Down Expand Up @@ -812,20 +812,26 @@ public Font::RichFormat::IStyle
void updateEntries()
{
int oldHeight = self.contentHeight();
bool needNotify = false;

for(int idx = cache.size() - 1; idx >= 0; --idx)
{
CacheEntry *entry = cache[idx];

int prevHeight = entry->height();

int delta = entry->updateHeightOnly();
if(delta)
{
// We won't notify when content height changes because of rewrapping.
if(!prevHeight) needNotify = true;

// The new height will be effective on the next frame.
modifyContentHeight(delta);
}
}

if(self.contentHeight() > oldHeight)
if(needNotify && self.contentHeight() > oldHeight)
{
emit self.contentHeightIncreased(self.contentHeight() - oldHeight);
}
Expand Down

0 comments on commit 0734577

Please sign in to comment.