diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index b954db1291..05cf1795ab 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -317,7 +317,7 @@ public: const BGradient& gradient); void FillPolygon(const BPoint* ptArray, int32 numPts, BRect bounds, const BGradient& gradient); - + void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds, pattern p = B_SOLID_HIGH); void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, @@ -356,7 +356,7 @@ public: void FillEllipse(BPoint center, float xRadius, float yRadius, const BGradient& gradient); void FillEllipse(BRect r, const BGradient& gradient); - + void StrokeArc(BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, pattern p = B_SOLID_HIGH); @@ -372,14 +372,14 @@ public: const BGradient& gradient); void FillArc(BRect r, float startAngle, float arcAngle, const BGradient& gradient); - + void StrokeBezier(BPoint* controlPoints, pattern p = B_SOLID_HIGH); void FillBezier(BPoint* controlPoints, pattern p = B_SOLID_HIGH); void FillBezier(BPoint* controlPoints, const BGradient& gradient); - + void StrokeShape(BShape* shape, pattern p = B_SOLID_HIGH); void FillShape(BShape* shape, pattern p = B_SOLID_HIGH); @@ -622,7 +622,7 @@ private: void _PrintToStream(); void _PrintTree(); - int32 server_token; + int32 fServerToken; uint32 fFlags; BPoint fParentOffset; BWindow* fOwner; diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 9e4b93f744..6e97e9f0c8 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1000,7 +1000,7 @@ BView::SetViewCursor(const BCursor *cursor, bool sync) ViewSetViewCursorInfo info; info.cursorToken = cursor->fServerToken; - info.viewToken = _get_object_token_(this); // TODO: Use server_token! + info.viewToken = fServerToken; info.sync = sync; BPrivate::AppServerLink link; @@ -3906,8 +3906,7 @@ BView::_RemoveSelf() if (owner != NULL && !fTopLevelView) { // the top level view is deleted by the app_server automatically owner->fLink->StartMessage(AS_VIEW_DELETE); - // TODO: Use server_token - owner->fLink->Attach(_get_object_token_(this)); + owner->fLink->Attach(fServerToken); } parent->InvalidateLayout(); @@ -4646,6 +4645,7 @@ BView::_InitData(BRect frame, const char *name, uint32 resizingMode, fParentOffset.Set(frame.left, frame.top); + fServerToken = _get_object_token_(this); fOwner = NULL; fParent = NULL; fNextSibling = NULL; @@ -4902,8 +4902,7 @@ BView::_CreateSelf() else fOwner->fLink->StartMessage(AS_VIEW_CREATE); - // TODO: Use server_token - fOwner->fLink->Attach(_get_object_token_(this)); + fOwner->fLink->Attach(fServerToken); fOwner->fLink->AttachString(Name()); fOwner->fLink->Attach(Frame()); fOwner->fLink->Attach(LeftTop()); @@ -4916,8 +4915,7 @@ BView::_CreateSelf() if (fTopLevelView) fOwner->fLink->Attach(B_NULL_TOKEN); else - // TODO: Use server_token - fOwner->fLink->Attach(_get_object_token_(fParent)); + fOwner->fLink->Attach(fParent->fServerToken); fOwner->fLink->Flush(); _CheckOwnerLockAndSwitchCurrent(); @@ -5125,8 +5123,7 @@ BView::_Detach() if (fOwner->fLastMouseMovedView == this) fOwner->fLastMouseMovedView = NULL; - // TODO: Use server_token - if (fOwner->fLastViewToken == _get_object_token_(this)) + if (fOwner->fLastViewToken == fServerToken) fOwner->fLastViewToken = B_NULL_TOKEN; _SetOwner(NULL); @@ -5343,15 +5340,12 @@ BView::_CheckLock() const void BView::_SwitchServerCurrentView() const { - // TODO: Use server_token - int32 serverToken = _get_object_token_(this); - - if (fOwner->fLastViewToken != serverToken) { - STRACE(("contacting app_server... sending token: %ld\n", serverToken)); + if (fOwner->fLastViewToken != fServerToken) { + STRACE(("contacting app_server... sending token: %ld\n", fServerToken)); fOwner->fLink->StartMessage(AS_SET_CURRENT_VIEW); - fOwner->fLink->Attach(serverToken); + fOwner->fLink->Attach(fServerToken); - fOwner->fLastViewToken = serverToken; + fOwner->fLastViewToken = fServerToken; } else { STRACE(("quiet2\n")); } @@ -5510,7 +5504,7 @@ BView::_PrintToStream() fNextSibling ? fNextSibling->Name() : "NULL", fPreviousSibling ? fPreviousSibling->Name() : "NULL", fOwner ? fOwner->Name() : "NULL", - _get_object_token_(this), + fServerToken, fFlags, fParentOffset.x, fParentOffset.y, fBounds.left, fBounds.top, fBounds.right, fBounds.bottom, diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 54c183c99b..0f98da4062 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2905,7 +2905,7 @@ BWindow::_CreateTopView() fTopView->fTopLevelView = true; //inhibit check_lock() - fLastViewToken = _get_object_token_(fTopView); + fLastViewToken = fTopView->fServerToken; // set fTopView's owner, add it to window's eligible handler list // and also set its next handler to be this window. @@ -3089,7 +3089,7 @@ BWindow::_UnpackMessage(unpack_cookie& cookie, BMessage** _message, cookie.focus_token = _get_object_token_(*_target); if (fLastMouseMovedView != NULL && cookie.message->what == B_MOUSE_MOVED) - cookie.last_view_token = _get_object_token_(fLastMouseMovedView); + cookie.last_view_token = fLastMouseMovedView->fServerToken; *_usePreferred = false; } @@ -3553,8 +3553,10 @@ BView * BWindow::_FindView(int32 token) { BHandler* handler; - if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN, (void**)&handler) != B_OK) + if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN, + (void**)&handler) != B_OK) { return NULL; + } // the view must belong to us in order to be found by this method BView* view = dynamic_cast(handler);