Some cleanup in the communication code.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15197 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-28 15:47:41 +00:00
parent 2ae568931f
commit 349837d9c9
+26 -44
View File
@@ -487,12 +487,12 @@ BWindow::SendBehind(const BWindow *window)
fLink->Attach<int32>(_get_object_token_(window)); fLink->Attach<int32>(_get_object_token_(window));
fLink->Attach<team_id>(Team()); fLink->Attach<team_id>(Team());
int32 code = B_OK; status_t status = B_ERROR;
fLink->FlushWithReply(code); fLink->FlushWithReply(status);
Unlock(); Unlock();
return code; return status;
} }
@@ -1047,7 +1047,7 @@ BWindow::SetSizeLimits(float minWidth, float maxWidth,
int32 code; int32 code;
if (fLink->FlushWithReply(code) == B_OK if (fLink->FlushWithReply(code) == B_OK
&& code == SERVER_TRUE) { && code == B_OK) {
// read the values that were really enforced on // read the values that were really enforced on
// the server side (the window frame could have // the server side (the window frame could have
// been changed, too) // been changed, too)
@@ -1548,12 +1548,12 @@ BWindow::AddToSubset(BWindow *window)
fLink->Attach<int32>(_get_object_token_(window)); fLink->Attach<int32>(_get_object_token_(window));
fLink->Attach<team_id>(team); fLink->Attach<team_id>(team);
int32 code = SERVER_FALSE; status_t status = B_ERROR;
fLink->FlushWithReply(code); fLink->FlushWithReply(status);
Unlock(); Unlock();
return code == SERVER_TRUE ? B_OK : B_ERROR; return status;
} }
@@ -1572,11 +1572,11 @@ BWindow::RemoveFromSubset(BWindow *window)
fLink->Attach<int32>(_get_object_token_(window)); fLink->Attach<int32>(_get_object_token_(window));
fLink->Attach<team_id>(team); fLink->Attach<team_id>(team);
int32 code; status_t status = B_ERROR;
fLink->FlushWithReply(code); fLink->FlushWithReply(status);
Unlock(); Unlock();
return code == SERVER_TRUE ? B_OK : B_ERROR; return status;
} }
@@ -1617,16 +1617,13 @@ BWindow::SetLook(window_look look)
fLink->StartMessage(AS_SET_LOOK); fLink->StartMessage(AS_SET_LOOK);
fLink->Attach<int32>((int32)look); fLink->Attach<int32>((int32)look);
int32 code; status_t status = B_ERROR;
status_t status = fLink->FlushWithReply(code); if (fLink->FlushWithReply(status) == B_OK && status == B_OK) {
// ToDo: the server should probably return something more meaningful, anyway
if (status == B_OK && code == SERVER_TRUE) {
fLook = look; fLook = look;
return B_OK; return B_OK;
} }
return B_ERROR; return status;
} }
@@ -1673,22 +1670,18 @@ BWindow::Feel() const
status_t status_t
BWindow::SetFlags(uint32 flags) BWindow::SetFlags(uint32 flags)
{ {
Lock(); Lock();
fLink->StartMessage(AS_SET_FLAGS); fLink->StartMessage(AS_SET_FLAGS);
fLink->Attach<uint32>(flags); fLink->Attach<uint32>(flags);
int32 code = SERVER_FALSE; int32 status = B_ERROR;
fLink->FlushWithReply(code); if (fLink->FlushWithReply(status) == B_OK && status == B_OK)
fFlags = flags;
Unlock(); Unlock();
if (code == SERVER_TRUE) { return status;
fFlags = flags;
return B_OK;
}
return B_ERROR;
} }
@@ -1725,15 +1718,12 @@ BWindow::SetWindowAlignment(window_alignment mode,
fLink->Attach<int32>(height); fLink->Attach<int32>(height);
fLink->Attach<int32>(heightOffset); fLink->Attach<int32>(heightOffset);
int32 code = SERVER_FALSE; status_t status = B_ERROR;
fLink->FlushWithReply(code); fLink->FlushWithReply(status);
Unlock(); Unlock();
if (code == SERVER_TRUE) return status;
return B_OK;
return B_ERROR;
} }
@@ -1745,9 +1735,8 @@ BWindow::GetWindowAlignment(window_alignment *mode,
const_cast<BWindow *>(this)->Lock(); const_cast<BWindow *>(this)->Lock();
fLink->StartMessage(AS_GET_ALIGNMENT); fLink->StartMessage(AS_GET_ALIGNMENT);
int32 code = SERVER_FALSE; status_t status = B_ERROR;
if (fLink->FlushWithReply(code) == B_OK if (fLink->FlushWithReply(status) == B_OK && status == B_OK) {
&& code == SERVER_TRUE) {
fLink->Read<int32>((int32 *)mode); fLink->Read<int32>((int32 *)mode);
fLink->Read<int32>(h); fLink->Read<int32>(h);
fLink->Read<int32>(hOffset); fLink->Read<int32>(hOffset);
@@ -1760,11 +1749,7 @@ BWindow::GetWindowAlignment(window_alignment *mode,
} }
const_cast<BWindow *>(this)->Unlock(); const_cast<BWindow *>(this)->Unlock();
return status;
if (code != SERVER_TRUE)
return B_ERROR;
return B_OK;
} }
@@ -1776,14 +1761,11 @@ BWindow::Workspaces() const
const_cast<BWindow *>(this)->Lock(); const_cast<BWindow *>(this)->Lock();
fLink->StartMessage(AS_GET_WORKSPACES); fLink->StartMessage(AS_GET_WORKSPACES);
int32 code; status_t status;
if (fLink->FlushWithReply(code) == B_OK if (fLink->FlushWithReply(status) == B_OK && status == B_OK)
&& code == SERVER_TRUE)
fLink->Read<uint32>(&workspaces); fLink->Read<uint32>(&workspaces);
const_cast<BWindow *>(this)->Unlock(); const_cast<BWindow *>(this)->Unlock();
// TODO: shouldn't we cache?
return workspaces; return workspaces;
} }