Removed the locking from RootLayer::Buttons -- caused a hang in the one place it is called. (doh!)

Implemented ServerApp handler for BFont::CountTuned and added a standby handler for BFont::Direction
Tweaked the ServerWindow debug output


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11457 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2005-02-23 01:45:48 +00:00
parent 135c6d41e1
commit 348f28e773
3 changed files with 77 additions and 23 deletions

View File

@ -881,11 +881,7 @@ void RootLayer::SetBGColor(const RGBColor &col)
int32 RootLayer::Buttons(void)
{
Lock();
int32 value=fButtons;
Unlock();
return value;
return fButtons;
}
RGBColor RootLayer::BGColor(void) const

View File

@ -1169,7 +1169,12 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// Returns:
// 1) font_direction direction of font
/* int32 famid, styid;
// NOTE: While this may be unimplemented, we can safely return
// SERVER_FALSE. This will force the BFont code to default to
// B_LEFT_TO_RIGHT, which is what the vast majority of fonts will be.
// This will be fixed later.
int32 famid, styid;
port_id replyport;
msg.Read<int32>(&famid);
@ -1178,7 +1183,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
replylink.SetSendPort(replyport);
fontserver->Lock();
/* fontserver->Lock();
FontStyle *fstyle=fontserver->GetStyle(famid,styid);
if(fstyle)
{
@ -1190,12 +1195,11 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
}
else
{
replylink.StartMessage(SERVER_FALSE);
*/ replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
}
// }
fontserver->Unlock();
*/
// fontserver->Unlock();
break;
}
case AS_GET_STRING_WIDTH:
@ -1267,7 +1271,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
}
case AS_GET_TUNED_COUNT:
{
FTRACE(("ServerApp %s: AS_GET_TUNED_COUNT unimplmemented\n",fSignature.String()));
FTRACE(("ServerApp %s: AS_GET_TUNED_COUNT\n",fSignature.String()));
// Attached Data:
// 1) uint16 - family ID
// 2) uint16 - style ID
@ -1275,6 +1279,30 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// Returns:
// 1) int32 - number of font strikes available
int32 famid, styid;
port_id replyport;
msg.Read<int32>(&famid);
msg.Read<int32>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
fontserver->Lock();
FontStyle *fstyle=fontserver->GetStyle(famid,styid);
if(fstyle)
{
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<int32>(fstyle->TunedCount());
replylink.Flush();
}
else
{
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
}
fontserver->Unlock();
break;
}
case AS_GET_TUNED_INFO:
@ -1300,6 +1328,30 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
// Returns:
// 1) bool - font is/is not fixed
int32 famid, styid;
port_id replyport;
msg.Read<int32>(&famid);
msg.Read<int32>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
fontserver->Lock();
FontStyle *fstyle=fontserver->GetStyle(famid,styid);
if(fstyle)
{
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<bool>(fstyle->IsFixedWidth());
replylink.Flush();
}
else
{
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
}
fontserver->Unlock();
break;
}
case AS_SET_FAMILY_NAME:

View File

@ -53,7 +53,7 @@
#include "Workspace.h"
#include "MessagePrivate.h"
//#define DEBUG_SERVERWINDOW
#define DEBUG_SERVERWINDOW
//#define DEBUG_SERVERWINDOW_MOUSE
//#define DEBUG_SERVERWINDOW_KEYBOARD
#define DEBUG_SERVERWINDOW_GRAPHICS
@ -396,7 +396,7 @@ void ServerWindow::ScreenModeChanged(const BRect frame, const color_space cspace
*/
status_t ServerWindow::Lock(void)
{
STRACE(("ServerWindow %s: Lock\n",fTitle.String()));
STRACE(("\nServerWindow %s: Lock\n",fTitle.String()));
return (fLocker.Lock())?B_OK:B_ERROR;
}
@ -404,7 +404,7 @@ status_t ServerWindow::Lock(void)
//! Unlocks the window
void ServerWindow::Unlock(void)
{
STRACE(("ServerWindow %s: Unlock\n",fTitle.String()));
STRACE(("ServerWindow %s: Unlock\n\n",fTitle.String()));
fLocker.Unlock();
}
@ -424,6 +424,8 @@ bool ServerWindow::IsLocked(void) const
*/
void ServerWindow::SetLayerFontState(Layer *layer, LinkMsgReader &link)
{
STRACE(("ServerWindow %s: SetLayerFontStateMessage for layer %s\n",
fTitle.String(), layer->fName->String()));
// NOTE: no need to check for a lock. This is a private method.
uint16 mask;
@ -484,12 +486,12 @@ void ServerWindow::SetLayerFontState(Layer *layer, LinkMsgReader &link)
link.Read<uint32>(&flags);
layer->fLayerData->font.SetFlags(flags);
}
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer: %s\n",
fTitle.String(), layer->fName->String()));
}
//------------------------------------------------------------------------------
void ServerWindow::SetLayerState(Layer *layer, LinkMsgReader &link)
{
STRACE(("ServerWindow %s: SetLayerState for layer %s\n",fTitle.String(),
layer->fName->String()));
// NOTE: no need to check for a lock. This is a private method.
rgb_color highColor, lowColor, viewColor;
pattern patt;
@ -540,14 +542,11 @@ void ServerWindow::SetLayerState(Layer *layer, LinkMsgReader &link)
layer->fLayerData->clipReg = NULL;
}
}
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",fTitle.String(),
layer->fName->String()));
}
//------------------------------------------------------------------------------
Layer * ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
{
// NOTE: no need to check for a lock. This is a private method.
STRACE(("ServerWindow(%s)::CreateLayerTree()\n", fTitle.String()));
int32 token;
BRect frame;
@ -565,6 +564,8 @@ Layer * ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
link.Read<bool>(&hidden);
link.Read<int32>(&childCount);
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n", fTitle.String(),name,token));
Layer *newLayer;
newLayer = new Layer(frame, name, token, resizeMask,
flags, desktop->GetDisplayDriver());
@ -578,9 +579,6 @@ Layer * ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
if(localRoot)
localRoot->AddChild(newLayer, NULL);
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_CREATE: Parent: %s, Child: %s\n", fTitle.String(),
localRoot? localRoot->fName->String(): "NULL", newLayer->fName->String()));
return newLayer;
}
//------------------------------------------------------------------------------
@ -702,6 +700,14 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
link.Read<int32>(&token);
Layer *current = FindLayer(fWinBorder->fTopLayer, token);
if(current)
{
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle.String(), current->fName->String(), token));
}
else
{
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: layer not found, token %ld\n", fTitle.String(), token));
}
if (current)
cl=current;