* Works around a race condition/bug/design issue in our layout engine:

sometimes the size isn't set in AttachedToWindow() yet, and the first
  FrameResized() comes after the first Draw(). We now relayout in Draw()
  in case the size changed since last time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29748 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-03-27 19:35:32 +00:00
parent 16dc221d20
commit a6ad872b60
2 changed files with 11 additions and 4 deletions
+10 -4
View File
@@ -29,7 +29,8 @@ KeyboardLayoutView::KeyboardLayoutView(const char* name)
fModifiers(0),
fDeadKey(0),
fDragKey(NULL),
fDropTarget(NULL)
fDropTarget(NULL),
fOldSize(0, 0)
{
fLayout = new KeyboardLayout;
memset(fKeyState, 0, sizeof(fKeyState));
@@ -90,9 +91,6 @@ KeyboardLayoutView::AttachedToWindow()
SetFont(*be_plain_font);
fSpecialFont = *be_fixed_font;
fModifiers = modifiers();
_InitOffscreen();
_LayoutKeyboard();
}
@@ -230,6 +228,11 @@ KeyboardLayoutView::MouseMoved(BPoint point, uint32 transit,
void
KeyboardLayoutView::Draw(BRect updateRect)
{
if (fOldSize != BSize(Bounds().Width(), Bounds().Height())) {
_InitOffscreen();
_LayoutKeyboard();
}
BView* view;
if (fOffscreenBitmap != NULL) {
view = fOffscreenView;
@@ -396,6 +399,9 @@ KeyboardLayoutView::_LayoutKeyboard()
fGap = 1;
else
fGap = 2;
fOldSize.width = Bounds().Width();
fOldSize.height = Bounds().Height();
}
@@ -99,6 +99,7 @@ private:
Key* fDropTarget;
BPoint fDropPoint;
BSize fOldSize;
BFont fFont;
BFont fSpecialFont;
float fBaseFontHeight;