* BeDecorator : use _InvalidateFootprint as in the default decorator.

* MacDecorator : use _InvalidateFootprint and implement _MoveBy. This makes the MacDecorator work fine again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37615 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-07-20 10:47:11 +00:00
parent c6bc0bdd73
commit 75e29683b2
2 changed files with 26 additions and 13 deletions

View File

@ -13,6 +13,8 @@
#include "BeDecorator.h"
#include <stdio.h>
#include "DesktopSettings.h"
#include "DrawingEngine.h"
#include "DrawState.h"
@ -28,7 +30,6 @@
//#define DEBUG_DECORATOR
#ifdef DEBUG_DECORATOR
# include <stdio.h>
# define STRACE(x) printf x
#else
# define STRACE(x) ;
@ -114,7 +115,7 @@ BeDecorator::BeDecorator(DesktopSettings& settings, BRect rect,
// resize itself!
STRACE(("BeDecorator:\n"));
STRACE(("\tFrame(%.1f,%.1f,%.1f,%.1f)\n",
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",
rect.left, rect.top, rect.right, rect.bottom));
}
@ -754,11 +755,7 @@ BeDecorator::_SetTitle(const char* string, BRegion* updateRegion)
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 = rect | TabRect();
rect.bottom++;
// the border will look differently when the title is adjacent
@ -778,6 +775,7 @@ BeDecorator::_FontsChanged(DesktopSettings& settings,
_UpdateFont(settings);
_DoLayout();
_InvalidateFootprint();
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
}
@ -793,10 +791,12 @@ BeDecorator::_SetLook(DesktopSettings& settings, window_look look,
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
_UpdateFont(settings);
fLook = look;
_UpdateFont(settings);
_DoLayout();
_InvalidateFootprint();
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
}
@ -811,8 +811,10 @@ BeDecorator::_SetFlags(uint32 flags, BRegion* updateRegion)
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
fFlags = flags;
_DoLayout();
_InvalidateFootprint();
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
}

View File

@ -9,6 +9,8 @@
#include "MacDecorator.h"
#include <stdio.h>
#include <GradientLinear.h>
#include <Point.h>
#include <View.h>
@ -21,8 +23,7 @@
//#define DEBUG_DECORATOR
#ifdef DEBUG_DECORATOR
# include <stdio.h>
# define STRACE(x) printf x ;
# define STRACE(x) printf x
#else
# define STRACE(x) ;
#endif
@ -134,8 +135,10 @@ MacDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
void
MacDecorator::_DoLayout()
{
int32 kDefaultBorderWidth = 6;
const int32 kDefaultBorderWidth = 6;
STRACE(("MacDecorator: Do Layout\n"));
// Here we determine the size of every rectangle that we use
// internally when we are given the size of the client rectangle.
bool hasTab = false;
@ -162,10 +165,10 @@ MacDecorator::_DoLayout()
fBorderWidth = 0;
}
fBorderRect=fFrame;
fBorderRect.InsetBy(-fBorderWidth, -fBorderWidth);
// calculate our tab rect
if (hasTab) {
fBorderRect.InsetBy(-kDefaultBorderWidth, -kDefaultBorderWidth);
fBorderRect.top +=3;
font_height fontHeight;
@ -645,6 +648,7 @@ MacDecorator::_FontsChanged(DesktopSettings& settings,
_UpdateFont(settings);
_DoLayout();
_InvalidateFootprint();
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
}
@ -665,6 +669,7 @@ MacDecorator::_SetLook(DesktopSettings& settings, window_look look,
_UpdateFont(settings);
_DoLayout();
_InvalidateFootprint();
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
}
@ -681,6 +686,7 @@ MacDecorator::_SetFlags(uint32 flags, BRegion* updateRegion)
_DoLayout();
_InvalidateFootprint();
if (updateRegion != NULL)
updateRegion->Include(&GetFootprint());
}
@ -699,7 +705,12 @@ MacDecorator::_SetColors()
void
MacDecorator::_MoveBy(BPoint offset)
{
// TODO ?
fFrame.OffsetBy(offset);
fCloseRect.OffsetBy(offset);
fTabRect.OffsetBy(offset);
fResizeRect.OffsetBy(offset);
fZoomRect.OffsetBy(offset);
fBorderRect.OffsetBy(offset);
}