* 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:
@@ -234,7 +234,6 @@ enum {
|
|||||||
AS_LAYER_CREATE,
|
AS_LAYER_CREATE,
|
||||||
AS_LAYER_DELETE,
|
AS_LAYER_DELETE,
|
||||||
AS_LAYER_CREATE_ROOT,
|
AS_LAYER_CREATE_ROOT,
|
||||||
AS_LAYER_DELETE_ROOT,
|
|
||||||
AS_LAYER_ADD_CHILD,
|
AS_LAYER_ADD_CHILD,
|
||||||
AS_LAYER_REMOVE_CHILD,
|
AS_LAYER_REMOVE_CHILD,
|
||||||
AS_LAYER_REMOVE_SELF,
|
AS_LAYER_REMOVE_SELF,
|
||||||
|
|||||||
+11
-11
@@ -3369,18 +3369,23 @@ BView::RemoveSelf()
|
|||||||
|
|
||||||
// Remove this child from its parent
|
// Remove this child from its parent
|
||||||
|
|
||||||
if (fOwner && fOwner->Lock()) {
|
BWindow* owner = fOwner;
|
||||||
BLooper* owner = fOwner;
|
check_lock_no_pick();
|
||||||
|
|
||||||
|
if (owner != NULL) {
|
||||||
_UpdateStateForRemove();
|
_UpdateStateForRemove();
|
||||||
_Detach();
|
_Detach();
|
||||||
|
|
||||||
owner->Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fParent || !fParent->_RemoveChildFromList(this))
|
if (!fParent || !fParent->_RemoveChildFromList(this))
|
||||||
return false;
|
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()));
|
STRACE(("DONE: BView(%s)::RemoveSelf()\n", Name()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -3974,7 +3979,7 @@ BView::_CreateSelf()
|
|||||||
fOwner->fLink->Attach<uint32>(Flags());
|
fOwner->fLink->Attach<uint32>(Flags());
|
||||||
fOwner->fLink->Attach<bool>(IsHidden(this));
|
fOwner->fLink->Attach<bool>(IsHidden(this));
|
||||||
fOwner->fLink->Attach<rgb_color>(fState->view_color);
|
fOwner->fLink->Attach<rgb_color>(fState->view_color);
|
||||||
if (fTopLevelView)
|
if (fTopLevelView)
|
||||||
fOwner->fLink->Attach<int32>(B_NULL_TOKEN);
|
fOwner->fLink->Attach<int32>(B_NULL_TOKEN);
|
||||||
else
|
else
|
||||||
fOwner->fLink->Attach<int32>(_get_object_token_(fParent));
|
fOwner->fLink->Attach<int32>(_get_object_token_(fParent));
|
||||||
@@ -4162,13 +4167,11 @@ BView::_Detach()
|
|||||||
if (fOwner->fLastViewToken == _get_object_token_(this))
|
if (fOwner->fLastViewToken == _get_object_token_(this))
|
||||||
fOwner->fLastViewToken = B_NULL_TOKEN;
|
fOwner->fLastViewToken = B_NULL_TOKEN;
|
||||||
|
|
||||||
BWindow *owner = fOwner;
|
|
||||||
_SetOwner(NULL);
|
_SetOwner(NULL);
|
||||||
|
|
||||||
owner->fLink->StartMessage(AS_LAYER_DELETE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::_Draw(BRect updateRectScreen)
|
BView::_Draw(BRect updateRectScreen)
|
||||||
{
|
{
|
||||||
@@ -4406,8 +4409,6 @@ void BView::_ReservedView5(){}
|
|||||||
void BView::_ReservedView6(){}
|
void BView::_ReservedView6(){}
|
||||||
void BView::_ReservedView7(){}
|
void BView::_ReservedView7(){}
|
||||||
void BView::_ReservedView8(){}
|
void BView::_ReservedView8(){}
|
||||||
|
|
||||||
#if !_PR3_COMPATIBLE_
|
|
||||||
void BView::_ReservedView9(){}
|
void BView::_ReservedView9(){}
|
||||||
void BView::_ReservedView10(){}
|
void BView::_ReservedView10(){}
|
||||||
void BView::_ReservedView11(){}
|
void BView::_ReservedView11(){}
|
||||||
@@ -4416,7 +4417,6 @@ void BView::_ReservedView13(){}
|
|||||||
void BView::_ReservedView14(){}
|
void BView::_ReservedView14(){}
|
||||||
void BView::_ReservedView15(){}
|
void BView::_ReservedView15(){}
|
||||||
void BView::_ReservedView16(){}
|
void BView::_ReservedView16(){}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
BView::BView(const BView &other)
|
BView::BView(const BView &other)
|
||||||
|
|||||||
@@ -900,15 +900,6 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
//fDesktop->UnlockSingleWindow();
|
//fDesktop->UnlockSingleWindow();
|
||||||
break;
|
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:
|
case AS_GET_MOUSE:
|
||||||
{
|
{
|
||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
@@ -956,7 +947,8 @@ fDesktop->LockSingleWindow();
|
|||||||
case AS_SET_CURRENT_LAYER:
|
case AS_SET_CURRENT_LAYER:
|
||||||
{
|
{
|
||||||
int32 token;
|
int32 token;
|
||||||
link.Read<int32>(&token);
|
if (link.Read<int32>(&token) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
ViewLayer *current;
|
ViewLayer *current;
|
||||||
if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN,
|
if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN,
|
||||||
@@ -1054,27 +1046,31 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
}
|
}
|
||||||
case AS_LAYER_DELETE:
|
case AS_LAYER_DELETE:
|
||||||
{
|
{
|
||||||
// Received when a view is detached from a window. This is definitely
|
// Received when a view is detached from a window
|
||||||
// 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();
|
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: AS_LAYER_DELETE view: %p, parent: %p\n", fTitle,
|
int32 token;
|
||||||
fCurrentLayer, parent));
|
if (link.Read<int32>(&token) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
if (parent != NULL) {
|
ViewLayer *view;
|
||||||
parent->RemoveChild(fCurrentLayer);
|
if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN,
|
||||||
|
(void**)&view) == B_OK
|
||||||
|
&& view->Window()->ServerWindow() != this) {
|
||||||
|
ViewLayer* parent = view->Parent();
|
||||||
|
|
||||||
if (fCurrentLayer->EventMask() != 0) {
|
STRACE(("ServerWindow %s: AS_LAYER_DELETE view: %p, parent: %p\n",
|
||||||
fDesktop->EventDispatcher().RemoveListener(EventTarget(),
|
fTitle, view, parent));
|
||||||
fCurrentLayer->Token());
|
|
||||||
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_SET_STATE:
|
case AS_LAYER_SET_STATE:
|
||||||
|
|||||||
Reference in New Issue
Block a user