diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 80678a5328..24a0e9d545 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -776,11 +776,15 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target) MessageQueue()->RemoveMessage(pendingMessage); } } - fFrame.right = fFrame.left + width; - fFrame.bottom = fFrame.top + height; - - _AdoptResize(); - FrameResized(width, height); + if (width != fFrame.Width() || height != fFrame.Height()) { + // NOTE: we might have already handled the resize + // in an _UPDATE_ message + fFrame.right = fFrame.left + width; + fFrame.bottom = fFrame.top + height; + + _AdoptResize(); + FrameResized(width, height); + } } break; } @@ -789,9 +793,13 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target) { BPoint origin; if (msg->FindPoint("where", &origin) == B_OK) { - fFrame.OffsetTo(origin); + if (fFrame.LeftTop() != origin) { + // NOTE: we might have already handled the move + // in an _UPDATE_ message + fFrame.OffsetTo(origin); - FrameMoved(origin); + FrameMoved(origin); + } } break; } @@ -953,7 +961,34 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target) int32 code; if (fLink->FlushWithReply(code) == B_OK && code == B_OK) { - // read culmulated update rect + // read current window position and size first, + // the update rect is in screen coordinates... + // so we need to be up to date + BPoint origin; + fLink->Read(&origin); + float width; + float height; + fLink->Read(&width); + fLink->Read(&height); + if (origin != fFrame.LeftTop()) { + // TODO: remove code duplicatation with + // B_WINDOW_MOVED case... +//printf("window position was not up to date\n"); + fFrame.OffsetTo(origin); + FrameMoved(origin); + } + if (width != fFrame.Width() || height != fFrame.Height()) { + // TODO: remove code duplicatation with + // B_WINDOW_RESIZED case... +//printf("window size was not up to date\n"); + fFrame.right = fFrame.left + width; + fFrame.bottom = fFrame.top + height; + + _AdoptResize(); + FrameResized(width, height); + } + + // read culmulated update rect (is in screen coords) fLink->Read(&updateRect); // read tokens for views that need to be drawn diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index 8fe7fd1eec..ad470d8c92 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -1596,7 +1596,7 @@ WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, if (common.CountRects() > 0) { // cut the common part from the region, // offset that to destination and include again -// region->Exclude(&common); + region->Exclude(&common); common.OffsetBy(xOffset, yOffset); region->Include(&common); } @@ -1751,10 +1751,18 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link) BRegion dirty(fCurrentUpdateSession.DirtyRegion()); dirty.IntersectWith(&VisibleContentRegion()); +//fDrawingEngine->FillRegion(dirty, RGBColor(255, 0, 0, 255)); + + link.StartMessage(B_OK); + // append the current window geometry to the + // message, the client will need it + link.Attach(fFrame.LeftTop()); + link.Attach(fFrame.Width()); + link.Attach(fFrame.Height()); + // append he update rect in screen coords + link.Attach(dirty.Frame()); // find and attach all views that intersect with // the dirty region - link.StartMessage(B_OK); - link.Attach(dirty.Frame()); fTopLayer->AddTokensForLayersInRegion(link, dirty, &fContentRegion); // mark the end of the token "list" link.Attach(B_NULL_TOKEN); @@ -1767,6 +1775,7 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link) &fContentRegion, true); #endif } else { +printf("BeginUpdate() but no update requested!!\n"); link.StartMessage(B_ERROR); link.Flush(); fprintf(stderr, "WindowLayer::BeginUpdate() - no update requested!\n");