* Fixed view deletion: _CreateSelf() and RemoveSelf() are now symmetrical, removing
all those error output from the app_server. * AS_LAYER_DELETE now gets a token, no longer frightening choice of parent. * Removed locking in RemoveChild(); it has to be called locked now. * Removed AS_LAYER_DELETE_ROOT as it's no longer needed. * Removed support from BView for being PR3 compatible. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16424 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bd3d31b0ab
commit
62b5f42b35
@ -234,7 +234,6 @@ enum {
|
||||
AS_LAYER_CREATE,
|
||||
AS_LAYER_DELETE,
|
||||
AS_LAYER_CREATE_ROOT,
|
||||
AS_LAYER_DELETE_ROOT,
|
||||
AS_LAYER_ADD_CHILD,
|
||||
AS_LAYER_REMOVE_CHILD,
|
||||
AS_LAYER_REMOVE_SELF,
|
||||
|
@ -3369,18 +3369,23 @@ BView::RemoveSelf()
|
||||
|
||||
// Remove this child from its parent
|
||||
|
||||
if (fOwner && fOwner->Lock()) {
|
||||
BLooper* owner = fOwner;
|
||||
BWindow* owner = fOwner;
|
||||
check_lock_no_pick();
|
||||
|
||||
if (owner != NULL) {
|
||||
_UpdateStateForRemove();
|
||||
_Detach();
|
||||
|
||||
owner->Unlock();
|
||||
}
|
||||
|
||||
if (!fParent || !fParent->_RemoveChildFromList(this))
|
||||
return false;
|
||||
|
||||
if (owner != NULL && fTopLevelView) {
|
||||
// the top level view is deleted by the app_server automatically
|
||||
owner->fLink->StartMessage(AS_LAYER_DELETE);
|
||||
owner->fLink->Attach<int32>(_get_object_token_(fParent));
|
||||
}
|
||||
|
||||
STRACE(("DONE: BView(%s)::RemoveSelf()\n", Name()));
|
||||
|
||||
return true;
|
||||
@ -3974,7 +3979,7 @@ BView::_CreateSelf()
|
||||
fOwner->fLink->Attach<uint32>(Flags());
|
||||
fOwner->fLink->Attach<bool>(IsHidden(this));
|
||||
fOwner->fLink->Attach<rgb_color>(fState->view_color);
|
||||
if (fTopLevelView)
|
||||
if (fTopLevelView)
|
||||
fOwner->fLink->Attach<int32>(B_NULL_TOKEN);
|
||||
else
|
||||
fOwner->fLink->Attach<int32>(_get_object_token_(fParent));
|
||||
@ -4162,13 +4167,11 @@ BView::_Detach()
|
||||
if (fOwner->fLastViewToken == _get_object_token_(this))
|
||||
fOwner->fLastViewToken = B_NULL_TOKEN;
|
||||
|
||||
BWindow *owner = fOwner;
|
||||
_SetOwner(NULL);
|
||||
|
||||
owner->fLink->StartMessage(AS_LAYER_DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BView::_Draw(BRect updateRectScreen)
|
||||
{
|
||||
@ -4406,8 +4409,6 @@ void BView::_ReservedView5(){}
|
||||
void BView::_ReservedView6(){}
|
||||
void BView::_ReservedView7(){}
|
||||
void BView::_ReservedView8(){}
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
void BView::_ReservedView9(){}
|
||||
void BView::_ReservedView10(){}
|
||||
void BView::_ReservedView11(){}
|
||||
@ -4416,7 +4417,6 @@ void BView::_ReservedView13(){}
|
||||
void BView::_ReservedView14(){}
|
||||
void BView::_ReservedView15(){}
|
||||
void BView::_ReservedView16(){}
|
||||
#endif
|
||||
|
||||
|
||||
BView::BView(const BView &other)
|
||||
|
@ -900,15 +900,6 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
//fDesktop->UnlockSingleWindow();
|
||||
break;
|
||||
|
||||
case AS_LAYER_DELETE_ROOT:
|
||||
{
|
||||
// Received when a window deletes its internal top view
|
||||
printf("AS_LAYER_DELETE_ROOT\n");
|
||||
// TODO: Implement AS_LAYER_DELETE_ROOT
|
||||
STRACE(("ServerWindow %s: Message Delete_Layer_Root unimplemented\n", Title()));
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_GET_MOUSE:
|
||||
{
|
||||
fDesktop->UnlockSingleWindow();
|
||||
@ -956,7 +947,8 @@ fDesktop->LockSingleWindow();
|
||||
case AS_SET_CURRENT_LAYER:
|
||||
{
|
||||
int32 token;
|
||||
link.Read<int32>(&token);
|
||||
if (link.Read<int32>(&token) != B_OK)
|
||||
break;
|
||||
|
||||
ViewLayer *current;
|
||||
if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN,
|
||||
@ -1054,27 +1046,31 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
}
|
||||
case AS_LAYER_DELETE:
|
||||
{
|
||||
// Received when a view is detached from a window. This is definitely
|
||||
// the less taxing operation - we call PruneTree() on the removed
|
||||
// layer, detach the layer itself, delete it, and invalidate the
|
||||
// area assuming that the view was visible when removed
|
||||
ViewLayer *parent = fCurrentLayer->Parent();
|
||||
// Received when a view is detached from a window
|
||||
|
||||
STRACE(("ServerWindow %s: AS_LAYER_DELETE view: %p, parent: %p\n", fTitle,
|
||||
fCurrentLayer, parent));
|
||||
int32 token;
|
||||
if (link.Read<int32>(&token) != B_OK)
|
||||
break;
|
||||
|
||||
if (parent != NULL) {
|
||||
parent->RemoveChild(fCurrentLayer);
|
||||
ViewLayer *view;
|
||||
if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN,
|
||||
(void**)&view) == B_OK
|
||||
&& view->Window()->ServerWindow() != this) {
|
||||
ViewLayer* parent = view->Parent();
|
||||
|
||||
if (fCurrentLayer->EventMask() != 0) {
|
||||
fDesktop->EventDispatcher().RemoveListener(EventTarget(),
|
||||
fCurrentLayer->Token());
|
||||
STRACE(("ServerWindow %s: AS_LAYER_DELETE view: %p, parent: %p\n",
|
||||
fTitle, view, parent));
|
||||
|
||||
if (parent != NULL) {
|
||||
parent->RemoveChild(view);
|
||||
|
||||
if (view->EventMask() != 0) {
|
||||
fDesktop->EventDispatcher().RemoveListener(EventTarget(),
|
||||
token);
|
||||
}
|
||||
delete view;
|
||||
}
|
||||
|
||||
delete fCurrentLayer;
|
||||
}
|
||||
// TODO: It is necessary to do this, but I find it very obscure.
|
||||
_SetCurrentLayer(parent);
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_SET_STATE:
|
||||
|
Loading…
Reference in New Issue
Block a user