From ac89958f6ebac3a2f6500927a82f16ae98c10665 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Sun, 30 Oct 2005 11:33:31 +0000 Subject: [PATCH] Removed RootLayer::EnqueueMessage(). Added support for BWindow's EnableUpdates(), DisableUpdates(), NeedsUpdate() and SendBehind(). The last one does not work as expected, for the moment it sends the window to back, just as Activate(false) does. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14577 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Layer.cpp | 2 +- src/servers/app/RootLayer.cpp | 14 ------------- src/servers/app/RootLayer.h | 1 - src/servers/app/ServerWindow.cpp | 35 ++++++++++++++++++++++++++------ src/servers/app/WinBorder.cpp | 7 ++----- src/servers/app/WinBorder.h | 13 +++++++----- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/servers/app/Layer.cpp b/src/servers/app/Layer.cpp index aad9c426de..ff36fbaa8f 100644 --- a/src/servers/app/Layer.cpp +++ b/src/servers/app/Layer.cpp @@ -1609,7 +1609,7 @@ if (fOwner->cnt != 1) if (updateReg.CountRects() > 0) { fOwner->fCumulativeRegion.Include(&updateReg); - if (!fOwner->InUpdate() && !fOwner->fRequestSent) { + if (fOwner->fUpdateRequestsEnabled && !fOwner->InUpdate() && !fOwner->fRequestSent) { fOwner->fInUpdateRegion = fOwner->fCumulativeRegion; fOwner->cnt++; if (fOwner->cnt != 1) diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 05e71fcfef..790dffa369 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -309,15 +309,6 @@ RootLayer::GoInvalidate(Layer *layer, const BRegion ®ion) Unlock(); } -status_t -RootLayer::EnqueueMessage(BPrivate::PortLink &message) -{ - message.SetSenderPort(fListenPort); - message.Flush(); - return B_OK; -} - - void RootLayer::GoRedraw(Layer *layer, const BRegion ®ion) { @@ -1137,11 +1128,6 @@ RootLayer::MouseEventHandler(BMessage *msg) } case B_MOUSE_MOVED: { //printf("RootLayer::MouseEventHandler(B_MOUSE_MOVED)\n"); - // Attached data: - // 1) int64 - time of mouse click - // 2) float - x coordinate of mouse click - // 3) float - y coordinate of mouse click - // 4) int32 - buttons down BPoint where(0,0); diff --git a/src/servers/app/RootLayer.h b/src/servers/app/RootLayer.h index 2a7f9f5a1b..1c2c06a942 100644 --- a/src/servers/app/RootLayer.h +++ b/src/servers/app/RootLayer.h @@ -130,7 +130,6 @@ public: void Unlock() { fAllRegionsLock.Unlock(); } bool IsLocked() { return fAllRegionsLock.IsLocked(); } void RunThread(); - status_t EnqueueMessage(BPrivate::PortLink &message); void GoInvalidate(Layer *layer, const BRegion ®ion); void GoRedraw(Layer *layer, const BRegion ®ion); void GoChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel); diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index dc57efc1fd..9e9889ec47 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -1268,32 +1268,55 @@ myRootLayer->Unlock(); Hide(); break; } -#if 0 case AS_SEND_BEHIND: { - // TODO: Implement AS_SEND_BEHIND STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n", Title())); + int32 token; + team_id teamID; + WinBorder *behindOf; + status_t status = B_NAME_NOT_FOUND; + + link.Read(&token); + link.Read(&teamID); + + if ((behindOf = gDesktop->FindWinBorderByClientToken(token, teamID))) { + fWinBorder->GetRootLayer()->Lock(); + // TODO: move to back ATM. Fix this later! + fWinBorder->GetRootLayer()->SetActive(fWinBorder, false); + fWinBorder->GetRootLayer()->Unlock(); + status = B_OK; + } + + fLink.StartMessage(status); + fLink.Flush(); break; } case AS_ENABLE_UPDATES: { - // TODO: Implement AS_ENABLE_UPDATES STRACE(("ServerWindow %s: Message Enable_Updates unimplemented\n", Title())); + fWinBorder->EnableUpdateRequests(); + if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid()) { + BRegion reg(fWinBorder->CulmulatedUpdateRegion()); + fWinBorder->RequestDraw(reg, NULL); + } break; } case AS_DISABLE_UPDATES: { - // TODO: Implement AS_DISABLE_UPDATES STRACE(("ServerWindow %s: Message Disable_Updates unimplemented\n", Title())); + fWinBorder->DisableUpdateRequests(); break; } case AS_NEEDS_UPDATE: { - // TODO: Implement AS_NEEDS_UPDATE STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title())); + if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid()) + fLink.StartMessage(B_OK); + else + fLink.StartMessage(B_ERROR); + fLink.Flush(); break; } -#endif case AS_SET_WINDOW_TITLE: { char* newTitle; diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index 9d66cfe135..ede232d02d 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -79,14 +79,11 @@ WinBorder::WinBorder(const BRect &frame, fIsClosing(false), fIsMinimizing(false), fIsZooming(false), - - fIsDragging(false), - fBringToFrontOnRelease(false), - fIsResizing(false), - fIsSlidingTab(false), + fIsDragging(false), + fUpdateRequestsEnabled(true), fInUpdate(false), fRequestSent(false), diff --git a/src/servers/app/WinBorder.h b/src/servers/app/WinBorder.h index 68cda3d4c6..ceb1be70eb 100644 --- a/src/servers/app/WinBorder.h +++ b/src/servers/app/WinBorder.h @@ -70,6 +70,10 @@ class WinBorder : public Layer { { return fInUpdateRegion; } inline const BRegion& CulmulatedUpdateRegion() const { return fCumulativeRegion; } + inline void EnableUpdateRequests() + { fUpdateRequestsEnabled = true; } + inline void DisableUpdateRequests() + { fUpdateRequestsEnabled = false; } void SetSizeLimits(float minWidth, float maxWidth, @@ -157,14 +161,13 @@ class WinBorder : public Layer { bool fIsClosing; bool fIsMinimizing; bool fIsZooming; - + bool fIsResizing; + bool fIsSlidingTab; bool fIsDragging; + bool fBringToFrontOnRelease; - bool fIsResizing; - - bool fIsSlidingTab; - + bool fUpdateRequestsEnabled; bool fInUpdate; bool fRequestSent;