Some minor cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15127 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-24 17:12:32 +00:00
parent 0a9634a6f4
commit 2430abdd9a
+28 -34
View File
@@ -148,7 +148,7 @@ WinBorder::~WinBorder()
//! redraws a certain section of the window border //! redraws a certain section of the window border
void void
WinBorder::Draw(const BRect &r) WinBorder::Draw(const BRect& updateRect)
{ {
#ifdef DEBUG_WINBORDER #ifdef DEBUG_WINBORDER
printf("WinBorder(%s)::Draw() : ", Name()); printf("WinBorder(%s)::Draw() : ", Name());
@@ -157,12 +157,8 @@ WinBorder::Draw(const BRect &r)
// if we have a visible region, it is decorator's one. // if we have a visible region, it is decorator's one.
if (fDecorator) { if (fDecorator) {
if (GetRootLayer()->Focus() == this) fDecorator->SetFocus(GetRootLayer()->Focus() == this);
fDecorator->SetFocus(true); fDecorator->Draw(updateRect);
else
fDecorator->SetFocus(false);
fDecorator->Draw(r);
} }
} }
@@ -201,8 +197,7 @@ WinBorder::MoveBy(float x, float y)
GetRootLayer()->Unlock(); GetRootLayer()->Unlock();
} }
Window()->HandleDirectConnection(B_DIRECT_START|B_BUFFER_MOVED); Window()->HandleDirectConnection(B_DIRECT_START | B_BUFFER_MOVED);
} else { } else {
// just offset to the new position // just offset to the new position
if (fDecorator) if (fDecorator)
@@ -215,7 +210,7 @@ WinBorder::MoveBy(float x, float y)
BMessage msg(B_WINDOW_MOVED); BMessage msg(B_WINDOW_MOVED);
msg.AddInt64("when", system_time()); msg.AddInt64("when", system_time());
msg.AddPoint("where", Frame().LeftTop()); msg.AddPoint("where", Frame().LeftTop());
Window()->SendMessageToClient(&msg, B_NULL_TOKEN); Window()->SendMessageToClient(&msg);
} }
@@ -258,7 +253,7 @@ WinBorder::ResizeBy(float x, float y)
GetRootLayer()->Unlock(); GetRootLayer()->Unlock();
} }
Window()->HandleDirectConnection(B_DIRECT_START|B_BUFFER_RESIZED); Window()->HandleDirectConnection(B_DIRECT_START | B_BUFFER_RESIZED);
} else { } else {
if (fDecorator) if (fDecorator)
fDecorator->ResizeBy(x, y); fDecorator->ResizeBy(x, y);
@@ -272,7 +267,7 @@ WinBorder::ResizeBy(float x, float y)
msg.AddInt64("when", system_time()); msg.AddInt64("when", system_time());
msg.AddInt32("width", frame.IntegerWidth()); msg.AddInt32("width", frame.IntegerWidth());
msg.AddInt32("height", frame.IntegerHeight()); msg.AddInt32("height", frame.IntegerHeight());
Window()->SendMessageToClient(&msg, B_NULL_TOKEN); Window()->SendMessageToClient(&msg);
} }
@@ -597,7 +592,7 @@ WinBorder::WorkspaceActivated(int32 index, bool active)
activatedMsg.AddInt32("workspace", index); activatedMsg.AddInt32("workspace", index);
activatedMsg.AddBool("active", active); activatedMsg.AddBool("active", active);
Window()->SendMessageToClient(&activatedMsg, B_NULL_TOKEN); Window()->SendMessageToClient(&activatedMsg);
} }
@@ -611,7 +606,7 @@ WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
changedMsg.AddInt32("old", oldWorkspaces); changedMsg.AddInt32("old", oldWorkspaces);
changedMsg.AddInt32("new", newWorkspaces); changedMsg.AddInt32("new", newWorkspaces);
Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN); Window()->SendMessageToClient(&changedMsg);
} }
@@ -620,7 +615,7 @@ WinBorder::Activated(bool active)
{ {
BMessage msg(B_WINDOW_ACTIVATED); BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", active); msg.AddBool("active", active);
Window()->SendMessageToClient(&msg, B_NULL_TOKEN); Window()->SendMessageToClient(&msg);
} }
@@ -811,30 +806,29 @@ void
WinBorder::RequestClientRedraw(const BRegion &invalid) WinBorder::RequestClientRedraw(const BRegion &invalid)
{ {
BRegion updateReg(fTopLayer->FullVisible()); BRegion updateReg(fTopLayer->FullVisible());
updateReg.IntersectWith(&invalid); updateReg.IntersectWith(&invalid);
if (updateReg.CountRects() > 0) { if (updateReg.CountRects() == 0)
fCumulativeRegion.Include(&updateReg); return;
if (fUpdateRequestsEnabled && !InUpdate() && !fRequestSent) {
fInUpdateRegion = fCumulativeRegion;
fRequestSent = true; // this is here to avoid a possible de-synchronization
BMessage msg; fCumulativeRegion.Include(&updateReg);
msg.what = _UPDATE_;
BRect rect(fInUpdateRegion.Frame()); if (fUpdateRequestsEnabled && !InUpdate() && !fRequestSent) {
ConvertFromScreen(&rect); fInUpdateRegion = fCumulativeRegion;
msg.AddRect("_rect", rect ); fRequestSent = true; // this is here to avoid a possible de-synchronization
msg.AddRect("debug_rect", fInUpdateRegion.Frame());
if (Window()->SendMessageToClient(&msg) == B_OK) { BRect rect(fInUpdateRegion.Frame());
fCumulativeRegion.MakeEmpty(); ConvertFromScreen(&rect);
}
else { BMessage msg(_UPDATE_);
fRequestSent = false; msg.AddRect("_rect", rect);
fInUpdateRegion.MakeEmpty(); msg.AddRect("debug_rect", fInUpdateRegion.Frame());
}
if (Window()->SendMessageToClient(&msg) == B_OK) {
fCumulativeRegion.MakeEmpty();
} else {
fRequestSent = false;
fInUpdateRegion.MakeEmpty();
} }
} }
} }