* Quitting a non-hidden window no longer deadlocks the app_server (_Hide() was called
without a lock). * Renamed private methods to start with the '_' symbol. * Removed superfluous SetLayer[Font]State() and moved back those one-liners into their AS_* handlers. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16535 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8c807cddbe
commit
f8d8085d7a
@ -277,7 +277,9 @@ ServerWindow::_PrepareQuit()
|
|||||||
{
|
{
|
||||||
if (fThread == find_thread(NULL)) {
|
if (fThread == find_thread(NULL)) {
|
||||||
// make sure we're hidden
|
// make sure we're hidden
|
||||||
Hide();
|
fDesktop->LockSingleWindow();
|
||||||
|
_Hide();
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
|
|
||||||
App()->RemoveWindow(this);
|
App()->RemoveWindow(this);
|
||||||
} else if (fThread >= B_OK)
|
} else if (fThread >= B_OK)
|
||||||
@ -310,10 +312,10 @@ ServerWindow::ReplaceDecorator()
|
|||||||
|
|
||||||
//! Shows the window's WindowLayer
|
//! Shows the window's WindowLayer
|
||||||
void
|
void
|
||||||
ServerWindow::Show()
|
ServerWindow::_Show()
|
||||||
{
|
{
|
||||||
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
||||||
STRACE(("ServerWindow %s: Show\n", Title()));
|
STRACE(("ServerWindow %s: _Show\n", Title()));
|
||||||
|
|
||||||
if (fQuitting || !fWindowLayer->IsHidden() || fWindowLayer->IsOffscreenWindow())
|
if (fQuitting || !fWindowLayer->IsHidden() || fWindowLayer->IsOffscreenWindow())
|
||||||
return;
|
return;
|
||||||
@ -331,10 +333,10 @@ fDesktop->LockSingleWindow();
|
|||||||
|
|
||||||
//! Hides the window's WindowLayer
|
//! Hides the window's WindowLayer
|
||||||
void
|
void
|
||||||
ServerWindow::Hide()
|
ServerWindow::_Hide()
|
||||||
{
|
{
|
||||||
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
||||||
STRACE(("ServerWindow %s: Hide\n", Title()));
|
STRACE(("ServerWindow %s: _Hide\n", Title()));
|
||||||
|
|
||||||
if (fWindowLayer->IsHidden() || fWindowLayer->IsOffscreenWindow())
|
if (fWindowLayer->IsHidden() || fWindowLayer->IsOffscreenWindow())
|
||||||
return;
|
return;
|
||||||
@ -449,36 +451,8 @@ ServerWindow::GetInfo(window_info& info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Sets the font state for a layer
|
|
||||||
\param layer The layer to set the font
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ServerWindow::SetLayerFontState(ViewLayer *layer, BPrivate::LinkReceiver &link)
|
|
||||||
{
|
|
||||||
STRACE(("ServerWindow %s: SetLayerFontStateMessage for layer %s\n",
|
|
||||||
fTitle, layer->Name()));
|
|
||||||
// NOTE: no need to check for a lock. This is a private method.
|
|
||||||
|
|
||||||
layer->CurrentState()->ReadFontFromLink(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ServerWindow::SetLayerState(ViewLayer *layer, BPrivate::LinkReceiver &link)
|
|
||||||
{
|
|
||||||
STRACE(("ServerWindow %s: SetLayerState for layer %s\n", Title(),
|
|
||||||
layer->Name()));
|
|
||||||
// NOTE: no need to check for a lock. This is a private method.
|
|
||||||
|
|
||||||
layer->CurrentState()->ReadFromLink(link);
|
|
||||||
// TODO: When is this used?!?
|
|
||||||
layer->RebuildClipping(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ViewLayer*
|
ViewLayer*
|
||||||
ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent)
|
ServerWindow::_CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent)
|
||||||
{
|
{
|
||||||
// NOTE: no need to check for a lock. This is a private method.
|
// NOTE: no need to check for a lock. This is a private method.
|
||||||
|
|
||||||
@ -504,7 +478,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent)
|
|||||||
link.Read<rgb_color>(&viewColor);
|
link.Read<rgb_color>(&viewColor);
|
||||||
link.Read<int32>(&parentToken);
|
link.Read<int32>(&parentToken);
|
||||||
|
|
||||||
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n",
|
STRACE(("ServerWindow(%s)::_CreateLayerTree()-> layer %s, token %ld\n",
|
||||||
fTitle, name, token));
|
fTitle, name, token));
|
||||||
|
|
||||||
ViewLayer* newLayer;
|
ViewLayer* newLayer;
|
||||||
@ -559,12 +533,12 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case AS_SHOW_WINDOW:
|
case AS_SHOW_WINDOW:
|
||||||
STRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title()));
|
STRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title()));
|
||||||
Show();
|
_Show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AS_HIDE_WINDOW:
|
case AS_HIDE_WINDOW:
|
||||||
STRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title()));
|
STRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title()));
|
||||||
Hide();
|
_Hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AS_MINIMIZE_WINDOW:
|
case AS_MINIMIZE_WINDOW:
|
||||||
@ -574,9 +548,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
if (link.Read<bool>(&minimize) == B_OK) {
|
if (link.Read<bool>(&minimize) == B_OK) {
|
||||||
// TODO: this actually needs to take the window's show/hide counter into account
|
// TODO: this actually needs to take the window's show/hide counter into account
|
||||||
if (minimize && !fWindowLayer->IsHidden())
|
if (minimize && !fWindowLayer->IsHidden())
|
||||||
Hide();
|
_Hide();
|
||||||
else if (!minimize && fWindowLayer->IsHidden())
|
else if (!minimize && fWindowLayer->IsHidden())
|
||||||
Show();
|
_Show();
|
||||||
|
|
||||||
fWindowLayer->SetMinimized(minimize);
|
fWindowLayer->SetMinimized(minimize);
|
||||||
}
|
}
|
||||||
@ -792,7 +766,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
#endif
|
#endif
|
||||||
case AS_GET_WORKSPACES:
|
case AS_GET_WORKSPACES:
|
||||||
{
|
{
|
||||||
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n", Title()));
|
STRACE(("ServerWindow %s: Message AS_GET_WORKSPACES\n", Title()));
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<uint32>(fWindowLayer->Workspaces());
|
fLink.Attach<uint32>(fWindowLayer->Workspaces());
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
@ -800,9 +774,12 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
}
|
}
|
||||||
case AS_SET_WORKSPACES:
|
case AS_SET_WORKSPACES:
|
||||||
{
|
{
|
||||||
STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n", Title()));
|
|
||||||
uint32 newWorkspaces;
|
uint32 newWorkspaces;
|
||||||
link.Read<uint32>(&newWorkspaces);
|
if (link.Read<uint32>(&newWorkspaces) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
STRACE(("ServerWindow %s: Message AS_SET_WORKSPACES %lx\n",
|
||||||
|
Title(), newWorkspaces));
|
||||||
|
|
||||||
fDesktop->SetWindowWorkspaces(fWindowLayer, newWorkspaces);
|
fDesktop->SetWindowWorkspaces(fWindowLayer, newWorkspaces);
|
||||||
break;
|
break;
|
||||||
@ -812,9 +789,11 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
float xResizeBy;
|
float xResizeBy;
|
||||||
float yResizeBy;
|
float yResizeBy;
|
||||||
link.Read<float>(&xResizeBy);
|
link.Read<float>(&xResizeBy);
|
||||||
link.Read<float>(&yResizeBy);
|
if (link.Read<float>(&yResizeBy) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
|
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n",
|
||||||
|
Title(), xResizeBy, yResizeBy));
|
||||||
|
|
||||||
fDesktop->ResizeWindowBy(fWindowLayer, xResizeBy, yResizeBy);
|
fDesktop->ResizeWindowBy(fWindowLayer, xResizeBy, yResizeBy);
|
||||||
break;
|
break;
|
||||||
@ -824,9 +803,11 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
float xMoveBy;
|
float xMoveBy;
|
||||||
float yMoveBy;
|
float yMoveBy;
|
||||||
link.Read<float>(&xMoveBy);
|
link.Read<float>(&xMoveBy);
|
||||||
link.Read<float>(&yMoveBy);
|
if (link.Read<float>(&yMoveBy) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
|
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n",
|
||||||
|
Title(), xMoveBy, yMoveBy));
|
||||||
|
|
||||||
fDesktop->MoveWindowBy(fWindowLayer, xMoveBy, yMoveBy);
|
fDesktop->MoveWindowBy(fWindowLayer, xMoveBy, yMoveBy);
|
||||||
break;
|
break;
|
||||||
@ -973,7 +954,7 @@ fDesktop->LockSingleWindow();
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SetCurrentLayer(CreateLayerTree(link, NULL));
|
_SetCurrentLayer(_CreateLayerTree(link, NULL));
|
||||||
fWindowLayer->SetTopLayer(fCurrentLayer);
|
fWindowLayer->SetTopLayer(fCurrentLayer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -983,7 +964,7 @@ fDesktop->LockSingleWindow();
|
|||||||
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
||||||
|
|
||||||
ViewLayer* parent = NULL;
|
ViewLayer* parent = NULL;
|
||||||
ViewLayer* newLayer = CreateLayerTree(link, &parent);
|
ViewLayer* newLayer = _CreateLayerTree(link, &parent);
|
||||||
if (parent != NULL && newLayer != NULL)
|
if (parent != NULL && newLayer != NULL)
|
||||||
parent->AddChild(newLayer);
|
parent->AddChild(newLayer);
|
||||||
else
|
else
|
||||||
@ -1074,13 +1055,16 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
case AS_LAYER_SET_STATE:
|
case AS_LAYER_SET_STATE:
|
||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
||||||
SetLayerState(fCurrentLayer, link);
|
|
||||||
|
fCurrentLayer->CurrentState()->ReadFromLink(link);
|
||||||
|
// TODO: When is this used?!?
|
||||||
|
fCurrentLayer->RebuildClipping(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_SET_FONT_STATE:
|
case AS_LAYER_SET_FONT_STATE:
|
||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
||||||
SetLayerFontState(fCurrentLayer, link);
|
fCurrentLayer->CurrentState()->ReadFontFromLink(link);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_GET_STATE:
|
case AS_LAYER_GET_STATE:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2006, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@ -62,8 +62,6 @@ public:
|
|||||||
::EventTarget& EventTarget() { return fEventTarget; }
|
::EventTarget& EventTarget() { return fEventTarget; }
|
||||||
|
|
||||||
void ReplaceDecorator();
|
void ReplaceDecorator();
|
||||||
void Show();
|
|
||||||
void Hide();
|
|
||||||
|
|
||||||
// methods for sending various messages to client.
|
// methods for sending various messages to client.
|
||||||
void NotifyQuitRequested();
|
void NotifyQuitRequested();
|
||||||
@ -103,13 +101,11 @@ public:
|
|||||||
void GetInfo(window_info& info);
|
void GetInfo(window_info& info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// methods for retrieving and creating a tree strcture of Layers.
|
ViewLayer* _CreateLayerTree(BPrivate::LinkReceiver &link,
|
||||||
ViewLayer* CreateLayerTree(BPrivate::LinkReceiver &link,
|
|
||||||
ViewLayer **_parent);
|
ViewLayer **_parent);
|
||||||
void SetLayerState(ViewLayer *layer,
|
|
||||||
BPrivate::LinkReceiver &link);
|
void _Show();
|
||||||
void SetLayerFontState(ViewLayer *layer,
|
void _Hide();
|
||||||
BPrivate::LinkReceiver &link);
|
|
||||||
|
|
||||||
// message handling methods.
|
// message handling methods.
|
||||||
void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
||||||
|
Loading…
Reference in New Issue
Block a user