BPortLink now has a FlushWithReply() method itself.
BPortLink::AttachString() now accepts a length argument, and will no longer send a terminating null byte; LinkMsgReader::ReadString(), however, will make sure the string read is null terminated. Changed client communication code to use FlushWithReply() instead of Flush() and GetNextReply() - there were many bugs and shortcomings in the code, I hope I've fixed them all. Converted ClientFontList.cpp to our coding style (but not completely, the class members are missing). Some more cleanup - I hope Adi will adopt our coding style one day! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12998 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
750b92faf3
commit
75936a02e4
@ -22,7 +22,7 @@ class LinkMsgReader {
|
||||
void SetPort(port_id port);
|
||||
port_id Port(void) { return fReceivePort; }
|
||||
|
||||
status_t GetNextMessage(int32 *code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
template <class Type> status_t Read(Type *data)
|
||||
|
@ -34,7 +34,7 @@ class LinkMsgSender {
|
||||
//status_t FlushWithReply(int32 *code);
|
||||
|
||||
status_t Attach(const void *data, size_t size);
|
||||
status_t AttachString(const char *string);
|
||||
status_t AttachString(const char *string, int32 length = -1);
|
||||
template <class Type> status_t Attach(const Type& data)
|
||||
{
|
||||
return Attach(&data, sizeof(Type));
|
||||
|
@ -51,7 +51,7 @@ class BPortLink {
|
||||
|
||||
status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false);
|
||||
status_t Attach(const void *data, ssize_t size);
|
||||
status_t AttachString(const char *string);
|
||||
status_t AttachString(const char *string, int32 length = -1);
|
||||
status_t AttachRegion(const BRegion ®ion);
|
||||
status_t AttachShape(BShape &shape);
|
||||
template <class Type> status_t Attach(const Type& data);
|
||||
@ -61,13 +61,17 @@ class BPortLink {
|
||||
void SetReplyPort(port_id port);
|
||||
port_id ReplyPort();
|
||||
|
||||
status_t GetNextReply(int32 *code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t GetNextReply(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
status_t ReadRegion(BRegion *region);
|
||||
status_t ReadShape(BShape *shape);
|
||||
template <class Type> status_t Read(Type *data);
|
||||
|
||||
// convenience methods
|
||||
|
||||
status_t FlushWithReply(int32 &code);
|
||||
|
||||
protected:
|
||||
LinkMsgReader *fReader;
|
||||
LinkMsgSender *fSender;
|
||||
@ -118,9 +122,9 @@ BPortLink::Attach(const void *data, ssize_t size)
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::AttachString(const char *string)
|
||||
BPortLink::AttachString(const char *string, int32 length)
|
||||
{
|
||||
return fSender->AttachString(string);
|
||||
return fSender->AttachString(string, length);
|
||||
}
|
||||
|
||||
template<class Type> status_t
|
||||
@ -144,7 +148,7 @@ BPortLink::ReplyPort()
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::GetNextReply(int32 *code, bigtime_t timeout)
|
||||
BPortLink::GetNextReply(int32 &code, bigtime_t timeout)
|
||||
{
|
||||
return fReader->GetNextMessage(code, timeout);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ BAppServerLink::FlushWithReply(int32 *code)
|
||||
if (err < B_OK)
|
||||
return err;
|
||||
|
||||
return GetNextReply(code);
|
||||
return GetNextReply(*code);
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
@ -1109,7 +1109,7 @@ BApplication::connect_to_app_server()
|
||||
// 4) int32 - handler ID token of the app
|
||||
// 5) char * - signature of the regular app
|
||||
BPortLink link(fServerFrom, fServerTo);
|
||||
int32 code = SERVER_FALSE;
|
||||
int32 code;
|
||||
|
||||
link.StartMessage(AS_CREATE_APP);
|
||||
link.Attach<port_id>(fServerTo);
|
||||
@ -1117,13 +1117,9 @@ BApplication::connect_to_app_server()
|
||||
link.Attach<team_id>(Team());
|
||||
link.Attach<int32>(_get_object_token_(this));
|
||||
link.AttachString(fAppName);
|
||||
link.Flush();
|
||||
link.GetNextReply(&code);
|
||||
|
||||
// Reply code: SERVER_TRUE
|
||||
// Reply data:
|
||||
// 1) port_id server-side application port (fServerFrom value)
|
||||
if (code == SERVER_TRUE)
|
||||
if (link.FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
link.Read<port_id>(&fServerFrom);
|
||||
else
|
||||
debugger("BApplication: couldn't obtain new app_server comm port");
|
||||
|
@ -54,7 +54,7 @@ LinkMsgReader::SetPort(port_id port)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgReader::GetNextMessage(int32 *code, bigtime_t timeout)
|
||||
LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
{
|
||||
int32 remaining;
|
||||
|
||||
@ -92,7 +92,7 @@ LinkMsgReader::GetNextMessage(int32 *code, bigtime_t timeout)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
*code = header->code;
|
||||
code = header->code;
|
||||
fRecvPosition += sizeof(message_header);
|
||||
|
||||
STRACE(("info: LinkMsgReader got header %s [%ld %ld %ld] from port %ld.\n",
|
||||
@ -247,8 +247,8 @@ LinkMsgReader::ReadString(char **_string)
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
if (length > 0) {
|
||||
char *string = (char *)malloc(length);
|
||||
if (length >= 0) {
|
||||
char *string = (char *)malloc(length + 1);
|
||||
if (string == NULL) {
|
||||
fRecvPosition -= sizeof(int32); // rewind the transaction
|
||||
return B_NO_MEMORY;
|
||||
@ -261,8 +261,8 @@ LinkMsgReader::ReadString(char **_string)
|
||||
return status;
|
||||
}
|
||||
|
||||
// make sure the string is null terminated (although it already should be)
|
||||
string[length - 1] = '\0';
|
||||
// make sure the string is null terminated
|
||||
string[length] = '\0';
|
||||
|
||||
*_string = string;
|
||||
return B_OK;
|
||||
|
@ -156,19 +156,23 @@ LinkMsgSender::Attach(const void *data, size_t size)
|
||||
|
||||
|
||||
status_t
|
||||
LinkMsgSender::AttachString(const char *string)
|
||||
LinkMsgSender::AttachString(const char *string, int32 length)
|
||||
{
|
||||
if (string == NULL)
|
||||
string = "";
|
||||
|
||||
int32 length = strlen(string) + 1;
|
||||
if (length == -1)
|
||||
length = strlen(string);
|
||||
|
||||
status_t status = Attach<int32>(length);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
status = Attach(string, length);
|
||||
if (status < B_OK)
|
||||
fCurrentEnd -= sizeof(int32); // rewind the transaction
|
||||
if (length > 0) {
|
||||
status = Attach(string, length);
|
||||
if (status < B_OK)
|
||||
fCurrentEnd -= sizeof(int32); // rewind the transaction
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -87,3 +87,14 @@ BPortLink::AttachShape(BShape &shape)
|
||||
fSender->Attach(opList, opCount * sizeof(uint32));
|
||||
return fSender->Attach(ptList, ptCount * sizeof(BPoint));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BPortLink::FlushWithReply(int32 &code)
|
||||
{
|
||||
status_t status = Flush();
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
return GetNextReply(code);
|
||||
}
|
||||
|
@ -39,42 +39,36 @@
|
||||
#include <ServerProtocol.h>
|
||||
#include "ServerMemIO.h"
|
||||
|
||||
|
||||
ServerMemIO::ServerMemIO(size_t size)
|
||||
: fLen(0),
|
||||
fPhys(0),
|
||||
fPos(0)
|
||||
{
|
||||
if(size>0)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
link.StartMessage(AS_ACQUIRE_SERVERMEM);
|
||||
link.Attach<size_t>(size);
|
||||
link.Attach<port_id>(link.ReplyPort());
|
||||
link.Flush();
|
||||
|
||||
int32 code;
|
||||
link.GetNextReply(&code);
|
||||
|
||||
if(code==SERVER_TRUE)
|
||||
{
|
||||
area_info ai;
|
||||
|
||||
link.Read<area_id>(&fSourceArea);
|
||||
link.Read<size_t>(&fOffset);
|
||||
|
||||
if(fSourceArea>0 && get_area_info(fSourceArea,&ai)==B_OK)
|
||||
{
|
||||
fPhys=size;
|
||||
|
||||
fArea=clone_area("ServerMemIO area",(void**)&fBuf,B_CLONE_ADDRESS,
|
||||
B_READ_AREA|B_WRITE_AREA,fSourceArea);
|
||||
|
||||
fBuf+=fOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
debugger("PANIC: bad data or something in ServerMemIO constructor");
|
||||
}
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
link.StartMessage(AS_ACQUIRE_SERVERMEM);
|
||||
link.Attach<size_t>(size);
|
||||
link.Attach<port_id>(link.ReplyPort());
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(&code) == B_OK
|
||||
&& code == SERVER_TRUE) {
|
||||
area_info info;
|
||||
|
||||
link.Read<area_id>(&fSourceArea);
|
||||
link.Read<size_t>(&fOffset);
|
||||
|
||||
if (fSourceArea >= B_OK && get_area_info(fSourceArea, &info) == B_OK) {
|
||||
fPhys = size;
|
||||
fArea = clone_area("ServerMemIO area", (void **)&fBuf, B_CLONE_ADDRESS,
|
||||
B_READ_AREA|B_WRITE_AREA, fSourceArea);
|
||||
|
||||
fBuf += fOffset;
|
||||
} else {
|
||||
debugger("PANIC: bad data or something in ServerMemIO constructor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@ -44,312 +44,274 @@
|
||||
# define STRACE(x) ;
|
||||
#endif
|
||||
|
||||
class FontListFamily
|
||||
{
|
||||
public:
|
||||
FontListFamily(void);
|
||||
~FontListFamily(void);
|
||||
BString name;
|
||||
BList *styles;
|
||||
int32 flags;
|
||||
|
||||
class FontListFamily {
|
||||
public:
|
||||
FontListFamily(void);
|
||||
~FontListFamily(void);
|
||||
|
||||
BString name;
|
||||
BList *styles;
|
||||
int32 flags;
|
||||
};
|
||||
|
||||
|
||||
FontListFamily::FontListFamily(void)
|
||||
{
|
||||
styles=new BList(0);
|
||||
flags=0;
|
||||
styles = new BList(0);
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
|
||||
FontListFamily::~FontListFamily(void)
|
||||
{
|
||||
BString *s;
|
||||
s=(BString*)styles->RemoveItem(0L);
|
||||
while(s)
|
||||
{
|
||||
delete s;
|
||||
s=(BString*)styles->RemoveItem(0L);
|
||||
for (int32 i = styles->CountItems(); i-- > 0; ) {
|
||||
delete (BString *)styles->ItemAt(i);
|
||||
}
|
||||
|
||||
delete styles;
|
||||
}
|
||||
|
||||
|
||||
ClientFontList::ClientFontList(void)
|
||||
{
|
||||
STRACE(("ClientFontList()\n"));
|
||||
familylist=new BList(0);
|
||||
fontlock=create_sem(1,"fontlist_sem");
|
||||
familylist = new BList(0);
|
||||
fontlock = create_sem(1,"fontlist_sem");
|
||||
}
|
||||
|
||||
|
||||
ClientFontList::~ClientFontList(void)
|
||||
{
|
||||
STRACE(("~ClientFontList()\n"));
|
||||
|
||||
acquire_sem(fontlock);
|
||||
|
||||
font_family *fam;
|
||||
while(familylist->ItemAt(0L)!=NULL)
|
||||
{
|
||||
fam=(font_family *)familylist->RemoveItem(0L);
|
||||
delete fam;
|
||||
for (int32 i = familylist->CountItems(); i-- > 0; ) {
|
||||
delete (font_family *)familylist->ItemAt(i);
|
||||
}
|
||||
familylist->MakeEmpty();
|
||||
|
||||
delete familylist;
|
||||
delete_sem(fontlock);
|
||||
}
|
||||
|
||||
bool ClientFontList::Update(bool check_only)
|
||||
|
||||
bool
|
||||
ClientFontList::Update(bool checkOnly)
|
||||
{
|
||||
STRACE(("ClientFontList::Update(%s) - %s\n", (check_only)?"true":"false",SERVER_FONT_LIST));
|
||||
|
||||
STRACE(("ClientFontList::Update(%s) - %s\n", checkOnly ? "true" : "false",
|
||||
SERVER_FONT_LIST));
|
||||
|
||||
// Open the font list kept in font list
|
||||
acquire_sem(fontlock);
|
||||
|
||||
// We're going to ask the server whether the list has changed
|
||||
port_id serverport;
|
||||
serverport=find_port(SERVER_PORT_NAME);
|
||||
|
||||
bool needs_update=true;
|
||||
BPortLink serverlink(serverport);
|
||||
port_id port = find_port(SERVER_PORT_NAME);
|
||||
|
||||
if(serverport!=B_NAME_NOT_FOUND)
|
||||
{
|
||||
int32 code=SERVER_FALSE;
|
||||
serverlink.StartMessage(AS_QUERY_FONTS_CHANGED);
|
||||
serverlink.Flush();
|
||||
serverlink.GetNextReply(&code);
|
||||
|
||||
// Attached Data: none
|
||||
// Reply: SERVER_TRUE if fonts have changed, SERVER_FALSE if not
|
||||
|
||||
needs_update=(code==SERVER_TRUE)?true:false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool needsUpdate = true;
|
||||
BPortLink link(port);
|
||||
|
||||
if (port >= B_OK) {
|
||||
link.StartMessage(AS_QUERY_FONTS_CHANGED);
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK)
|
||||
needsUpdate = code == SERVER_TRUE;
|
||||
} else {
|
||||
STRACE(("ClientFontList::Update(): Couldn't find app_server port\n"));
|
||||
}
|
||||
|
||||
if(check_only)
|
||||
{
|
||||
if (checkOnly || !needsUpdate) {
|
||||
release_sem(fontlock);
|
||||
return needs_update;
|
||||
return needsUpdate;
|
||||
}
|
||||
|
||||
// Don't update the list if nothing has changed
|
||||
if(needs_update)
|
||||
{
|
||||
BFile file(SERVER_FONT_LIST,B_READ_ONLY);
|
||||
BMessage fontmsg, familymsg;
|
||||
|
||||
if(file.InitCheck()==B_OK)
|
||||
{
|
||||
if(fontmsg.Unflatten(&file)==B_OK)
|
||||
{
|
||||
#ifdef DEBUG_CLIENT_FONT_LIST
|
||||
printf("Font message contents:\n");
|
||||
fontmsg.PrintToStream();
|
||||
#endif
|
||||
BFile file(SERVER_FONT_LIST,B_READ_ONLY);
|
||||
BMessage fontMessage;
|
||||
|
||||
// Empty the font list
|
||||
FontListFamily *flf=(FontListFamily*)familylist->RemoveItem(0L);
|
||||
BString sty, extra;
|
||||
int32 famindex, styindex;
|
||||
bool tempbool;
|
||||
|
||||
while(flf)
|
||||
{
|
||||
STRACE(("Removing %s from list\n",flf->name.String()));
|
||||
delete flf;
|
||||
flf=(FontListFamily*)familylist->RemoveItem(0L);
|
||||
}
|
||||
STRACE(("\n"));
|
||||
|
||||
famindex=0;
|
||||
|
||||
// Repopulate with new listings
|
||||
while(fontmsg.FindMessage("family",famindex,&familymsg)==B_OK)
|
||||
{
|
||||
famindex++;
|
||||
|
||||
flf=new FontListFamily();
|
||||
familylist->AddItem(flf);
|
||||
familymsg.FindString("name",&(flf->name));
|
||||
if (file.InitCheck() == B_OK
|
||||
&& fontMessage.Unflatten(&file) == B_OK) {
|
||||
#ifdef DEBUG_CLIENT_FONT_LIST
|
||||
printf("Font message contents:\n");
|
||||
fontmsg.PrintToStream();
|
||||
#endif
|
||||
|
||||
STRACE(("Adding %s to list\n",flf->name.String()));
|
||||
styindex=0;
|
||||
// Empty the font list
|
||||
FontListFamily *family;
|
||||
while ((family = (FontListFamily *)familylist->RemoveItem(0L)) != NULL) {
|
||||
STRACE(("Removing %s from list\n", family->name.String()));
|
||||
delete family;
|
||||
|
||||
}
|
||||
STRACE(("\n"));
|
||||
|
||||
// populate family with styles
|
||||
while(familymsg.FindString("styles",styindex,&sty)==B_OK)
|
||||
{
|
||||
STRACE(("\tAdding %s\n",sty.String()));
|
||||
styindex++;
|
||||
flf->styles->AddItem(new BString(sty));
|
||||
}
|
||||
|
||||
if(familymsg.FindBool("tuned",&tempbool)==B_OK)
|
||||
{
|
||||
STRACE(("Family %s has tuned fonts\n", flf->name.String()));
|
||||
flf->flags|=B_HAS_TUNED_FONT;
|
||||
}
|
||||
|
||||
if(familymsg.FindBool("fixed",&tempbool)==B_OK)
|
||||
{
|
||||
STRACE(("Family %s is fixed-width\n", flf->name.String()));
|
||||
flf->flags|=B_IS_FIXED;
|
||||
}
|
||||
familymsg.MakeEmpty();
|
||||
|
||||
}
|
||||
// Repopulate with new listings
|
||||
int32 familyIndex = 0;
|
||||
BMessage familyMessage;
|
||||
while (fontMessage.FindMessage("family", familyIndex++, &familyMessage) == B_OK) {
|
||||
family = new FontListFamily();
|
||||
familylist->AddItem(family);
|
||||
familyMessage.FindString("name", &family->name);
|
||||
|
||||
serverlink.StartMessage(AS_UPDATED_CLIENT_FONTLIST);
|
||||
serverlink.Flush();
|
||||
|
||||
release_sem(fontlock);
|
||||
return false;
|
||||
STRACE(("Adding %s to list\n", family->name.String()));
|
||||
|
||||
int32 styleIndex = 0;
|
||||
|
||||
// populate family with styles
|
||||
BString string;
|
||||
while (familyMessage.FindString("styles", styleIndex++, &string) == B_OK) {
|
||||
STRACE(("\tAdding %s\n", string.String()));
|
||||
family->styles->AddItem(new BString(string));
|
||||
}
|
||||
|
||||
if (familyMessage.FindBool("tuned")) {
|
||||
STRACE(("Family %s has tuned fonts\n", family->name.String()));
|
||||
family->flags |= B_HAS_TUNED_FONT;
|
||||
}
|
||||
|
||||
if (familyMessage.FindBool("fixed")) {
|
||||
STRACE(("Family %s is fixed-width\n", family->name.String()));
|
||||
family->flags |= B_IS_FIXED;
|
||||
}
|
||||
familyMessage.MakeEmpty();
|
||||
}
|
||||
|
||||
link.StartMessage(AS_UPDATED_CLIENT_FONTLIST);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
} // end if Unflatten==B_OK
|
||||
} // end if InitCheck==B_OK
|
||||
} // end if needs_update
|
||||
|
||||
release_sem(fontlock);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 ClientFontList::CountFamilies(void)
|
||||
|
||||
int32
|
||||
ClientFontList::CountFamilies(void)
|
||||
{
|
||||
STRACE(("ClientFontList::CountFamilies\n"));
|
||||
STRACE(("ClientFontList::CountFamilies\n"));
|
||||
acquire_sem(fontlock);
|
||||
int32 count=familylist->CountItems();
|
||||
int32 count = familylist->CountItems();
|
||||
release_sem(fontlock);
|
||||
return count;
|
||||
}
|
||||
|
||||
status_t ClientFontList::GetFamily(int32 index, font_family *name, uint32 *flags)
|
||||
|
||||
status_t
|
||||
ClientFontList::GetFamily(int32 index, font_family *name, uint32 *flags)
|
||||
{
|
||||
STRACE(("ClientFontList::GetFamily(%ld)\n",index));
|
||||
if(!name)
|
||||
{
|
||||
if (!name) {
|
||||
STRACE(("ClientFontList::GetFamily: NULL font_family parameter\n"));
|
||||
return B_ERROR;
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
|
||||
acquire_sem(fontlock);
|
||||
FontListFamily *flf=(FontListFamily*)familylist->ItemAt(index);
|
||||
if(!flf)
|
||||
{
|
||||
|
||||
FontListFamily *family = (FontListFamily *)familylist->ItemAt(index);
|
||||
if (family == NULL) {
|
||||
STRACE(("ClientFontList::GetFamily: index not found\n"));
|
||||
return B_ERROR;
|
||||
}
|
||||
strcpy(*name,flf->name.String());
|
||||
|
||||
|
||||
release_sem(fontlock);
|
||||
|
||||
// ToDo: respect size of "name"
|
||||
strcpy(*name, family->name.String());
|
||||
|
||||
release_sem(fontlock);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
int32 ClientFontList::CountStyles(font_family f)
|
||||
|
||||
int32
|
||||
ClientFontList::CountStyles(font_family f)
|
||||
{
|
||||
acquire_sem(fontlock);
|
||||
|
||||
FontListFamily *flf=NULL;
|
||||
int32 i, count=familylist->CountItems();
|
||||
bool found=false;
|
||||
|
||||
for(i=0; i<count;i++)
|
||||
{
|
||||
flf=(FontListFamily *)familylist->ItemAt(i);
|
||||
if(!flf)
|
||||
FontListFamily *family = NULL;
|
||||
int32 i, count = familylist->CountItems();
|
||||
bool found = false;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
family = (FontListFamily *)familylist->ItemAt(i);
|
||||
if (!family)
|
||||
continue;
|
||||
if(flf->name.ICompare(f)==0)
|
||||
{
|
||||
found=true;
|
||||
|
||||
if (family->name.ICompare(f) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
count=(found)?flf->styles->CountItems():0;
|
||||
|
||||
|
||||
count = found ? family->styles->CountItems() : 0;
|
||||
|
||||
release_sem(fontlock);
|
||||
return count;
|
||||
}
|
||||
|
||||
status_t ClientFontList::GetStyle(font_family family, int32 index, font_style *name,uint32 *flags, uint16 *face)
|
||||
{
|
||||
if(!name || !(*name) || !family)
|
||||
return B_ERROR;
|
||||
|
||||
acquire_sem(fontlock);
|
||||
|
||||
FontListFamily *flf=NULL;
|
||||
BString *style;
|
||||
int32 i, count=familylist->CountItems();
|
||||
bool found=false;
|
||||
|
||||
for(i=0; i<count;i++)
|
||||
{
|
||||
flf=(FontListFamily *)familylist->ItemAt(i);
|
||||
if(!flf)
|
||||
status_t
|
||||
ClientFontList::GetStyle(font_family fontFamily, int32 index, font_style *name,
|
||||
uint32 *flags, uint16 *face)
|
||||
{
|
||||
if (!name || !*name || !fontFamily)
|
||||
return B_ERROR;
|
||||
|
||||
acquire_sem(fontlock);
|
||||
|
||||
FontListFamily *family = NULL;
|
||||
BString *style;
|
||||
int32 i, count = familylist->CountItems();
|
||||
bool found = false;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
family = (FontListFamily *)familylist->ItemAt(i);
|
||||
if (!family)
|
||||
continue;
|
||||
if(flf->name.ICompare(family)==0)
|
||||
{
|
||||
found=true;
|
||||
|
||||
if (family->name.ICompare(fontFamily) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
release_sem(fontlock);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
style=(BString*)flf->styles->ItemAt(index);
|
||||
if(!style)
|
||||
{
|
||||
|
||||
if (!found) {
|
||||
release_sem(fontlock);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
strcpy(*name,style->String());
|
||||
style = (BString *)family->styles->ItemAt(index);
|
||||
if (!style) {
|
||||
release_sem(fontlock);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if(flags)
|
||||
*flags=flf->flags;
|
||||
strcpy(*name, style->String());
|
||||
|
||||
if(face)
|
||||
{
|
||||
if(style->ICompare("Roman")==0 ||
|
||||
style->ICompare("Regular")==0 ||
|
||||
style->ICompare("Normal")==0 ||
|
||||
style->ICompare("Light")==0 ||
|
||||
style->ICompare("Medium")==0 ||
|
||||
style->ICompare("Plain")==0)
|
||||
{
|
||||
*face|=B_REGULAR_FACE;
|
||||
if (flags)
|
||||
*flags = family->flags;
|
||||
|
||||
if (face) {
|
||||
if (!style->ICompare("Roman")
|
||||
|| !style->ICompare("Regular")
|
||||
|| !style->ICompare("Normal")
|
||||
|| !style->ICompare("Light")
|
||||
|| !style->ICompare("Medium")
|
||||
|| !style->ICompare("Plain")) {
|
||||
*face |= B_REGULAR_FACE;
|
||||
STRACE(("GetStyle: %s Roman face\n", style->String()));
|
||||
}
|
||||
else
|
||||
if(style->ICompare("Bold")==0)
|
||||
{
|
||||
*face|=B_BOLD_FACE;
|
||||
} else if (!style->ICompare("Bold")) {
|
||||
*face |= B_BOLD_FACE;
|
||||
STRACE(("GetStyle: %s Bold face\n"));
|
||||
}
|
||||
else
|
||||
if(style->ICompare("Italic")==0)
|
||||
{
|
||||
*face|=B_ITALIC_FACE;
|
||||
STRACE(("GetStyle: %s Italic face\n"));
|
||||
}
|
||||
else
|
||||
if(style->ICompare("Bold Italic")==0)
|
||||
{
|
||||
*face|=B_ITALIC_FACE | B_BOLD_FACE;
|
||||
STRACE(("GetStyle: %s Bold Italic face\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
STRACE(("GetStyle: %s Unknown face %s\n", style->String()));
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!style->ICompare("Italic")) {
|
||||
*face|=B_ITALIC_FACE;
|
||||
STRACE(("GetStyle: %s Italic face\n"));
|
||||
} else if (!style->ICompare("Bold Italic")) {
|
||||
*face|=B_ITALIC_FACE | B_BOLD_FACE;
|
||||
STRACE(("GetStyle: %s Bold Italic face\n"));
|
||||
} else {
|
||||
STRACE(("GetStyle: %s Unknown face %s\n", style->String()));
|
||||
}
|
||||
}
|
||||
|
||||
release_sem(fontlock);
|
||||
return B_OK;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +1,13 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Window.cpp
|
||||
// Author: Adrian Oanca (adioanca@mymail.ro)
|
||||
// Description: A BWindow object represents a window that can be displayed
|
||||
// on the screen, and that can be the target of user events
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrian Oanca <adioanca@cotty.iren.ro>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <PropertyInfo.h>
|
||||
@ -43,7 +25,6 @@
|
||||
#include <MessageRunner.h>
|
||||
#include <Roster.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
#include <AppMisc.h>
|
||||
#include <PortLink.h>
|
||||
#include <ServerProtocol.h>
|
||||
@ -51,10 +32,10 @@
|
||||
#include <MessageUtils.h>
|
||||
#include <WindowAux.h>
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
//#define DEBUG_WIN
|
||||
#ifdef DEBUG_WIN
|
||||
# include <stdio.h>
|
||||
@ -65,8 +46,7 @@
|
||||
|
||||
using BPrivate::gDefaultTokens;
|
||||
|
||||
static property_info
|
||||
sWindowPropInfo[] = {
|
||||
static property_info sWindowPropInfo[] = {
|
||||
{
|
||||
"Feel", { B_GET_PROPERTY, B_SET_PROPERTY },
|
||||
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
|
||||
@ -391,16 +371,16 @@ BWindow::SendBehind(const BWindow *window)
|
||||
if (!window)
|
||||
return B_ERROR;
|
||||
|
||||
int32 rCode;
|
||||
|
||||
Lock();
|
||||
fLink->StartMessage(AS_SEND_BEHIND);
|
||||
fLink->Attach<int32>(_get_object_token_(window));
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
fLink->FlushWithReply(code);
|
||||
|
||||
Unlock();
|
||||
|
||||
return rCode == SERVER_TRUE ? B_OK : B_ERROR;
|
||||
return code == SERVER_TRUE ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -416,12 +396,13 @@ BWindow::Flush() const
|
||||
void
|
||||
BWindow::Sync() const
|
||||
{
|
||||
int32 rCode;
|
||||
|
||||
const_cast<BWindow*>(this)->Lock();
|
||||
fLink->StartMessage(AS_SYNC);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
// ToDo: why with reply?
|
||||
int32 code;
|
||||
if (fLink->FlushWithReply(code) == B_OK)
|
||||
|
||||
const_cast<BWindow*>(this)->Unlock();
|
||||
}
|
||||
|
||||
@ -1030,12 +1011,10 @@ BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
||||
fLink->Attach<float>(maxWidth);
|
||||
fLink->Attach<float>(minHeight);
|
||||
fLink->Attach<float>(maxHeight);
|
||||
fLink->Flush();
|
||||
|
||||
int32 rCode;
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
if (rCode == SERVER_TRUE) {
|
||||
int32 code;
|
||||
if (fLink->FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE) {
|
||||
// read the values that were really enforced on
|
||||
// the server side
|
||||
fLink->Read<float>(&fMinWindWidth);
|
||||
@ -1269,15 +1248,16 @@ bool
|
||||
BWindow::NeedsUpdate() const
|
||||
{
|
||||
// TODO: What about locking?!?
|
||||
int32 rCode;
|
||||
|
||||
const_cast<BWindow *>(this)->Lock();
|
||||
fLink->StartMessage(AS_NEEDS_UPDATE);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
fLink->FlushWithReply(code);
|
||||
|
||||
const_cast<BWindow *>(this)->Unlock();
|
||||
|
||||
return rCode == SERVER_TRUE;
|
||||
return code == SERVER_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -1538,17 +1518,18 @@ BWindow::AddToSubset(BWindow *window)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
team_id team = Team();
|
||||
int32 rCode;
|
||||
|
||||
Lock();
|
||||
fLink->StartMessage(AS_ADD_TO_SUBSET);
|
||||
fLink->Attach<int32>(_get_object_token_(window));
|
||||
fLink->Attach<team_id>(team);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
fLink->FlushWithReply(code);
|
||||
|
||||
Unlock();
|
||||
|
||||
return rCode == SERVER_TRUE ? B_OK : B_ERROR;
|
||||
return code == SERVER_TRUE ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -1561,17 +1542,17 @@ BWindow::RemoveFromSubset(BWindow *window)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
team_id team = Team();
|
||||
int32 rCode;
|
||||
|
||||
Lock();
|
||||
fLink->StartMessage(AS_REM_FROM_SUBSET);
|
||||
fLink->Attach<int32>(_get_object_token_(window));
|
||||
fLink->Attach<team_id>(team);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code;
|
||||
fLink->FlushWithReply(code);
|
||||
Unlock();
|
||||
|
||||
return rCode == SERVER_TRUE ? B_OK : B_ERROR;
|
||||
return code == SERVER_TRUE ? B_OK : B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -1607,17 +1588,18 @@ BWindow::Type() const
|
||||
status_t
|
||||
BWindow::SetLook(window_look look)
|
||||
{
|
||||
int32 rCode;
|
||||
|
||||
Lock();
|
||||
fLink->StartMessage(AS_SET_LOOK);
|
||||
fLink->Attach<int32>((int32)look);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
fLink->FlushWithReply(code);
|
||||
|
||||
Unlock();
|
||||
|
||||
// ToDo: the server should probably return something more meaningful, anyway
|
||||
if (rCode == SERVER_TRUE) {
|
||||
if (code == SERVER_TRUE) {
|
||||
fLook = look;
|
||||
return B_OK;
|
||||
}
|
||||
@ -1669,16 +1651,17 @@ BWindow::Feel() const
|
||||
status_t
|
||||
BWindow::SetFlags(uint32 flags)
|
||||
{
|
||||
int32 rCode;
|
||||
|
||||
Lock();
|
||||
fLink->StartMessage(AS_SET_FLAGS);
|
||||
fLink->Attach<uint32>(flags);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
fLink->FlushWithReply(code);
|
||||
|
||||
Unlock();
|
||||
|
||||
if (rCode == SERVER_TRUE) {
|
||||
if (code == SERVER_TRUE) {
|
||||
fFlags = flags;
|
||||
return B_OK;
|
||||
}
|
||||
@ -1707,7 +1690,6 @@ BWindow::SetWindowAlignment(window_alignment mode,
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// TODO: test if hOffset = 0 and set it to 1 if true.
|
||||
int32 rCode;
|
||||
|
||||
Lock();
|
||||
fLink->StartMessage(AS_SET_ALIGNMENT);
|
||||
@ -1720,11 +1702,13 @@ BWindow::SetWindowAlignment(window_alignment mode,
|
||||
fLink->Attach<int32>(vOffset);
|
||||
fLink->Attach<int32>(height);
|
||||
fLink->Attach<int32>(heightOffset);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
int32 code = SERVER_FALSE;
|
||||
fLink->FlushWithReply(code);
|
||||
|
||||
Unlock();
|
||||
|
||||
if (rCode == SERVER_TRUE)
|
||||
if (code == SERVER_TRUE)
|
||||
return B_OK;
|
||||
|
||||
return B_ERROR;
|
||||
@ -1736,14 +1720,12 @@ BWindow::GetWindowAlignment(window_alignment *mode,
|
||||
int32 *h, int32 *hOffset, int32 *width, int32 *widthOffset,
|
||||
int32 *v, int32 *vOffset, int32 *height, int32 *heightOffset) const
|
||||
{
|
||||
int32 rCode;
|
||||
|
||||
const_cast<BWindow*>(this)->Lock();
|
||||
const_cast<BWindow *>(this)->Lock();
|
||||
fLink->StartMessage(AS_GET_ALIGNMENT);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
|
||||
if (rCode == SERVER_TRUE) {
|
||||
int32 code = SERVER_FALSE;
|
||||
if (fLink->FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE) {
|
||||
fLink->Read<int32>((int32 *)mode);
|
||||
fLink->Read<int32>(h);
|
||||
fLink->Read<int32>(hOffset);
|
||||
@ -1752,15 +1734,14 @@ BWindow::GetWindowAlignment(window_alignment *mode,
|
||||
fLink->Read<int32>(v);
|
||||
fLink->Read<int32>(hOffset);
|
||||
fLink->Read<int32>(height);
|
||||
rCode = fLink->Read<int32>(heightOffset);
|
||||
|
||||
return B_NO_ERROR;
|
||||
fLink->Read<int32>(heightOffset);
|
||||
}
|
||||
|
||||
const_cast<BWindow *>(this)->Unlock();
|
||||
|
||||
if(rCode!=B_OK)
|
||||
|
||||
if (code != SERVER_TRUE)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -1768,14 +1749,16 @@ BWindow::GetWindowAlignment(window_alignment *mode,
|
||||
uint32
|
||||
BWindow::Workspaces() const
|
||||
{
|
||||
uint32 workspaces;
|
||||
int32 rCode;
|
||||
uint32 workspaces = 0;
|
||||
|
||||
const_cast<BWindow *>(this)->Lock();
|
||||
fLink->StartMessage(AS_GET_WORKSPACES);
|
||||
fLink->Flush();
|
||||
fLink->GetNextReply(&rCode);
|
||||
fLink->Read<uint32>(&workspaces);
|
||||
|
||||
int32 code;
|
||||
if (fLink->FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE)
|
||||
fLink->Read<uint32>(&workspaces);
|
||||
|
||||
const_cast<BWindow *>(this)->Unlock();
|
||||
|
||||
// TODO: shouldn't we cache?
|
||||
@ -2087,14 +2070,13 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
||||
// HERE we are in BApplication's thread, so for locking we use be_app variable
|
||||
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
|
||||
bool locked = false;
|
||||
if (!(be_app->IsLocked())) {
|
||||
if (!be_app->IsLocked()) {
|
||||
be_app->Lock();
|
||||
locked = true;
|
||||
}
|
||||
|
||||
STRACE(("be_app->fServerTo is %ld\n", be_app->fServerFrom));
|
||||
|
||||
status_t err;
|
||||
fLink->StartMessage(AS_CREATE_WINDOW);
|
||||
fLink->Attach<BRect>(fFrame);
|
||||
fLink->Attach<int32>((int32)fLook);
|
||||
@ -2105,21 +2087,21 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
|
||||
fLink->Attach<port_id>(receive_port);
|
||||
fLink->Attach<port_id>(fMsgPort);
|
||||
fLink->AttachString(title);
|
||||
fLink->Flush();
|
||||
|
||||
send_port = -1;
|
||||
int32 rCode = SERVER_FALSE;
|
||||
err = fLink->GetNextReply(&rCode);
|
||||
if (err == B_OK && rCode == SERVER_TRUE)
|
||||
fLink->Read<port_id>(&send_port);
|
||||
fLink->SetSendPort(send_port);
|
||||
int32 code;
|
||||
if (fLink->FlushWithReply(code) == B_OK
|
||||
&& code == SERVER_TRUE
|
||||
&& fLink->Read<port_id>(&send_port) == B_OK)
|
||||
fLink->SetSendPort(send_port);
|
||||
else
|
||||
send_port = -1;
|
||||
|
||||
if (locked)
|
||||
be_app->Unlock();
|
||||
|
||||
STRACE(("Server says that our send port is %ld\n", send_port));
|
||||
|
||||
STRACE(("Window locked?: %s\n", IsLocked()?"True":"False"));
|
||||
STRACE(("Window locked?: %s\n", IsLocked() ? "True" : "False"));
|
||||
|
||||
// build and register top_view with app_server
|
||||
BuildTopView();
|
||||
|
@ -401,23 +401,19 @@ AppServer::Run(void)
|
||||
void
|
||||
AppServer::MainLoop(void)
|
||||
{
|
||||
BPortLink pmsg(-1,fMessagePort);
|
||||
int32 code=0;
|
||||
status_t err=B_OK;
|
||||
|
||||
while(1)
|
||||
{
|
||||
STRACE(("info: AppServer::MainLoop listening on port %ld.\n", fMessagePort));
|
||||
err=pmsg.GetNextReply(&code);
|
||||
BPortLink pmsg(-1, fMessagePort);
|
||||
|
||||
if(err<B_OK)
|
||||
{
|
||||
while (1) {
|
||||
STRACE(("info: AppServer::MainLoop listening on port %ld.\n", fMessagePort));
|
||||
|
||||
int32 code;
|
||||
status_t err = pmsg.GetNextReply(code);
|
||||
if (err < B_OK) {
|
||||
STRACE(("MainLoop:pmsg.GetNextReply failed\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(code)
|
||||
{
|
||||
|
||||
switch (code) {
|
||||
case B_QUIT_REQUESTED:
|
||||
case AS_CREATE_APP:
|
||||
case AS_DELETE_APP:
|
||||
|
@ -192,12 +192,13 @@ RootLayer::RunThread()
|
||||
\param data Pointer to the app_server to which the thread belongs
|
||||
\return Throwaway value - always 0
|
||||
*/
|
||||
int32 RootLayer::WorkingThread(void *data)
|
||||
int32
|
||||
RootLayer::WorkingThread(void *data)
|
||||
{
|
||||
int32 code = 0;
|
||||
status_t err = B_OK;
|
||||
RootLayer *oneRootLayer = (RootLayer*)data;
|
||||
BPortLink messageQueue(-1, oneRootLayer->fListenPort);
|
||||
int32 code = 0;
|
||||
status_t err = B_OK;
|
||||
RootLayer *oneRootLayer = (RootLayer*)data;
|
||||
BPortLink messageQueue(-1, oneRootLayer->fListenPort);
|
||||
|
||||
// first make sure we are actualy visible
|
||||
oneRootLayer->Lock();
|
||||
@ -206,18 +207,16 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
oneRootLayer->Unlock();
|
||||
|
||||
STRACE(("info: RootLayer(%s)::WorkingThread listening on port %ld.\n", oneRootLayer->GetName(), oneRootLayer->fListenPort));
|
||||
for(;;)
|
||||
{
|
||||
err = messageQueue.GetNextReply(&code);
|
||||
if(err < B_OK) {
|
||||
for (;;) {
|
||||
err = messageQueue.GetNextReply(code);
|
||||
if (err < B_OK) {
|
||||
STRACE(("WorkingThread: messageQueue.GetNextReply failed\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
oneRootLayer->Lock();
|
||||
|
||||
switch(code)
|
||||
{
|
||||
|
||||
switch (code) {
|
||||
// We don't need to do anything with these two, so just pass them
|
||||
// onto the active application. Eventually, we will end up passing
|
||||
// them onto the window which is currently under the cursor.
|
||||
@ -242,22 +241,22 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
|
||||
case AS_ROOTLAYER_SHOW_WINBORDER:
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
WinBorder *winBorder = NULL;
|
||||
messageQueue.Read<WinBorder*>(&winBorder);
|
||||
oneRootLayer->show_winBorder(winBorder);
|
||||
break;
|
||||
}
|
||||
case AS_ROOTLAYER_HIDE_WINBORDER:
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
WinBorder *winBorder = NULL;
|
||||
messageQueue.Read<WinBorder*>(&winBorder);
|
||||
oneRootLayer->hide_winBorder(winBorder);
|
||||
break;
|
||||
}
|
||||
case AS_ROOTLAYER_DO_INVALIDATE:
|
||||
{
|
||||
BRegion invalidRegion;
|
||||
Layer *layer = NULL;
|
||||
BRegion invalidRegion;
|
||||
Layer *layer = NULL;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.ReadRegion(&invalidRegion);
|
||||
oneRootLayer->invalidate_layer(layer, invalidRegion);
|
||||
@ -265,8 +264,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_DO_REDRAW:
|
||||
{
|
||||
BRegion redrawRegion;
|
||||
Layer *layer = NULL;
|
||||
BRegion redrawRegion;
|
||||
Layer *layer = NULL;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.ReadRegion(&redrawRegion);
|
||||
oneRootLayer->redraw_layer(layer, redrawRegion);
|
||||
@ -274,8 +273,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_LAYER_MOVE:
|
||||
{
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.Read<float>(&x);
|
||||
messageQueue.Read<float>(&y);
|
||||
@ -284,8 +283,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_LAYER_RESIZE:
|
||||
{
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.Read<float>(&x);
|
||||
messageQueue.Read<float>(&y);
|
||||
@ -294,8 +293,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_ADD_TO_SUBSET:
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
WinBorder *toWinBorder = NULL;
|
||||
WinBorder *winBorder = NULL;
|
||||
WinBorder *toWinBorder = NULL;
|
||||
messageQueue.Read<WinBorder*>(&winBorder);
|
||||
messageQueue.Read<WinBorder*>(&toWinBorder);
|
||||
oneRootLayer->fDesktop->AddWinBorderToSubset(winBorder, toWinBorder);
|
||||
@ -303,8 +302,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_REMOVE_FROM_SUBSET:
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
WinBorder *fromWinBorder = NULL;
|
||||
WinBorder *winBorder = NULL;
|
||||
WinBorder *fromWinBorder = NULL;
|
||||
messageQueue.Read<WinBorder*>(&winBorder);
|
||||
messageQueue.Read<WinBorder*>(&fromWinBorder);
|
||||
oneRootLayer->fDesktop->RemoveWinBorderFromSubset(winBorder, fromWinBorder);
|
||||
@ -312,8 +311,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_WINBORDER_SET_WORKSPACES:
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
uint32 oldWks = 0, newWks = 0;
|
||||
WinBorder *winBorder = NULL;
|
||||
uint32 oldWks = 0, newWks = 0;
|
||||
|
||||
messageQueue.Read<WinBorder*>(&winBorder);
|
||||
messageQueue.Read<uint32>(&oldWks);
|
||||
@ -323,8 +322,8 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
}
|
||||
case AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL:
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
int32 newFeel = 0;
|
||||
WinBorder *winBorder = NULL;
|
||||
int32 newFeel = 0;
|
||||
|
||||
messageQueue.Read<WinBorder*>(&winBorder);
|
||||
messageQueue.Read<int32>(&newFeel);
|
||||
@ -345,9 +344,11 @@ int32 RootLayer::WorkingThread(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RootLayer::GoInvalidate(const Layer *layer, const BRegion ®ion)
|
||||
|
||||
void
|
||||
RootLayer::GoInvalidate(const Layer *layer, const BRegion ®ion)
|
||||
{
|
||||
BPortLink msg(fListenPort, -1);
|
||||
BPortLink msg(fListenPort, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_DO_INVALIDATE);
|
||||
msg.Attach<const Layer*>(layer);
|
||||
msg.AttachRegion(region);
|
||||
|
@ -297,7 +297,7 @@ ServerApp::MonitorApp(void *data)
|
||||
|
||||
while (!app->fQuitting) {
|
||||
STRACE(("info: ServerApp::MonitorApp listening on port %ld.\n", app->fMessagePort));
|
||||
err = msgqueue.GetNextMessage(&code);
|
||||
err = msgqueue.GetNextMessage(code);
|
||||
if (err < B_OK) {
|
||||
STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err)));
|
||||
|
||||
|
@ -1969,7 +1969,7 @@ ServerWindow::MonitorWin(void *data)
|
||||
while (!quitting) {
|
||||
// printf("info: ServerWindow::MonitorWin listening on port %ld.\n", win->fMessagePort);
|
||||
code = AS_CLIENT_DEAD;
|
||||
err = ses->GetNextMessage(&code);
|
||||
err = ses->GetNextMessage(code);
|
||||
if (err < B_OK)
|
||||
return err;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user