From e07ebdeb7117ae77c2bcba93f8c1fa9c8ffdab81 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 18 Jul 2010 01:35:45 +0000 Subject: [PATCH] Fix SetTitle (bug #6321). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37559 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Decorator.cpp | 10 +----- src/servers/app/Decorator.h | 2 +- src/servers/app/DefaultDecorator.cpp | 50 ++++++++++++++-------------- src/servers/app/DefaultDecorator.h | 6 ++-- 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/servers/app/Decorator.cpp b/src/servers/app/Decorator.cpp index cc1daaa34c..6f74281cea 100644 --- a/src/servers/app/Decorator.cpp +++ b/src/servers/app/Decorator.cpp @@ -187,12 +187,10 @@ Decorator::SetZoom(bool pressed) void Decorator::SetTitle(const char* string, BRegion* updateRegion) { - fTitle.SetTo(string); - _DoLayout(); - fFootprintValid = false; // the border very likely changed + fTitle.SetTo(string); _SetTitle(string, updateRegion); // TODO: redraw? @@ -639,12 +637,6 @@ Decorator::_SetFlags(uint32 flags, BRegion* updateRegion) } -void -Decorator::_SetTitle(const char* string, BRegion* updateRegion) -{ -} - - void Decorator::_MoveBy(BPoint offset) { diff --git a/src/servers/app/Decorator.h b/src/servers/app/Decorator.h index d5f975cc6a..44d113b500 100644 --- a/src/servers/app/Decorator.h +++ b/src/servers/app/Decorator.h @@ -144,7 +144,7 @@ protected: BRegion* updateRegion = NULL); virtual void _SetTitle(const char* string, - BRegion* updateRegion = NULL); + BRegion* updateRegion = NULL) = 0; virtual void _SetFocus(); virtual void _MoveBy(BPoint offset); diff --git a/src/servers/app/DefaultDecorator.cpp b/src/servers/app/DefaultDecorator.cpp index efcc70cb9d..1fe54f63b2 100644 --- a/src/servers/app/DefaultDecorator.cpp +++ b/src/servers/app/DefaultDecorator.cpp @@ -120,31 +120,6 @@ DefaultDecorator::~DefaultDecorator() } -void -DefaultDecorator::SetTitle(const char* string, BRegion* updateRegion) -{ - // TODO: we could be much smarter about the update region - - BRect rect = TabRect(); - - Decorator::SetTitle(string); - - if (updateRegion == NULL) - return; - - BRect updatedRect = TabRect(); - if (rect.left > updatedRect.left) - rect.left = updatedRect.left; - if (rect.right < updatedRect.right) - rect.right = updatedRect.right; - - rect.bottom++; - // the border will look differently when the title is adjacent - - updateRegion->Include(rect); -} - - bool DefaultDecorator::GetSettings(BMessage* settings) const { @@ -767,6 +742,31 @@ DefaultDecorator::_DrawZoom(BRect rect) } +void +DefaultDecorator::_SetTitle(const char* string, BRegion* updateRegion) +{ + // TODO: we could be much smarter about the update region + + BRect rect = TabRect(); + + _DoLayout(); + + if (updateRegion == NULL) + return; + + BRect updatedRect = TabRect(); + if (rect.left > updatedRect.left) + rect.left = updatedRect.left; + if (rect.right < updatedRect.right) + rect.right = updatedRect.right; + + rect.bottom++; + // the border will look differently when the title is adjacent + + updateRegion->Include(rect); +} + + void DefaultDecorator::_FontsChanged(DesktopSettings& settings, BRegion* updateRegion) diff --git a/src/servers/app/DefaultDecorator.h b/src/servers/app/DefaultDecorator.h index 08a9071981..b682665fd7 100644 --- a/src/servers/app/DefaultDecorator.h +++ b/src/servers/app/DefaultDecorator.h @@ -27,9 +27,6 @@ public: uint32 flags); virtual ~DefaultDecorator(); - virtual void SetTitle(const char* string, - BRegion* updateRegion = NULL); - virtual float TabLocation() const { return (float)fTabOffset; } @@ -54,6 +51,9 @@ protected: virtual void _DrawTitle(BRect r); virtual void _DrawZoom(BRect r); + virtual void _SetTitle(const char* string, + BRegion* updateRegion = NULL); + virtual void _FontsChanged(DesktopSettings& settings, BRegion* updateRegion); virtual void _SetLook(DesktopSettings& settings,