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:
Axel Dörfler
2005-06-08 00:36:26 +00:00
parent 750b92faf3
commit 75936a02e4
16 changed files with 865 additions and 1011 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class LinkMsgReader {
void SetPort(port_id port); void SetPort(port_id port);
port_id Port(void) { return fReceivePort; } 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 Read(void *data, ssize_t size);
status_t ReadString(char **string); status_t ReadString(char **string);
template <class Type> status_t Read(Type *data) template <class Type> status_t Read(Type *data)
+1 -1
View File
@@ -34,7 +34,7 @@ class LinkMsgSender {
//status_t FlushWithReply(int32 *code); //status_t FlushWithReply(int32 *code);
status_t Attach(const void *data, size_t size); 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) template <class Type> status_t Attach(const Type& data)
{ {
return Attach(&data, sizeof(Type)); return Attach(&data, sizeof(Type));
+9 -5
View File
@@ -51,7 +51,7 @@ class BPortLink {
status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false); status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false);
status_t Attach(const void *data, ssize_t size); 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 &region); status_t AttachRegion(const BRegion &region);
status_t AttachShape(BShape &shape); status_t AttachShape(BShape &shape);
template <class Type> status_t Attach(const Type& data); template <class Type> status_t Attach(const Type& data);
@@ -61,13 +61,17 @@ class BPortLink {
void SetReplyPort(port_id port); void SetReplyPort(port_id port);
port_id ReplyPort(); 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 Read(void *data, ssize_t size);
status_t ReadString(char **string); status_t ReadString(char **string);
status_t ReadRegion(BRegion *region); status_t ReadRegion(BRegion *region);
status_t ReadShape(BShape *shape); status_t ReadShape(BShape *shape);
template <class Type> status_t Read(Type *data); template <class Type> status_t Read(Type *data);
// convenience methods
status_t FlushWithReply(int32 &code);
protected: protected:
LinkMsgReader *fReader; LinkMsgReader *fReader;
LinkMsgSender *fSender; LinkMsgSender *fSender;
@@ -118,9 +122,9 @@ BPortLink::Attach(const void *data, ssize_t size)
} }
inline status_t 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 template<class Type> status_t
@@ -144,7 +148,7 @@ BPortLink::ReplyPort()
} }
inline status_t inline status_t
BPortLink::GetNextReply(int32 *code, bigtime_t timeout) BPortLink::GetNextReply(int32 &code, bigtime_t timeout)
{ {
return fReader->GetNextMessage(code, timeout); return fReader->GetNextMessage(code, timeout);
} }
+1 -1
View File
@@ -75,7 +75,7 @@ BAppServerLink::FlushWithReply(int32 *code)
if (err < B_OK) if (err < B_OK)
return err; return err;
return GetNextReply(code); return GetNextReply(*code);
} }
} // namespace BPrivate } // namespace BPrivate
+3 -7
View File
@@ -1109,7 +1109,7 @@ BApplication::connect_to_app_server()
// 4) int32 - handler ID token of the app // 4) int32 - handler ID token of the app
// 5) char * - signature of the regular app // 5) char * - signature of the regular app
BPortLink link(fServerFrom, fServerTo); BPortLink link(fServerFrom, fServerTo);
int32 code = SERVER_FALSE; int32 code;
link.StartMessage(AS_CREATE_APP); link.StartMessage(AS_CREATE_APP);
link.Attach<port_id>(fServerTo); link.Attach<port_id>(fServerTo);
@@ -1117,13 +1117,9 @@ BApplication::connect_to_app_server()
link.Attach<team_id>(Team()); link.Attach<team_id>(Team());
link.Attach<int32>(_get_object_token_(this)); link.Attach<int32>(_get_object_token_(this));
link.AttachString(fAppName); link.AttachString(fAppName);
link.Flush();
link.GetNextReply(&code);
// Reply code: SERVER_TRUE if (link.FlushWithReply(code) == B_OK
// Reply data: && code == SERVER_TRUE)
// 1) port_id server-side application port (fServerFrom value)
if (code == SERVER_TRUE)
link.Read<port_id>(&fServerFrom); link.Read<port_id>(&fServerFrom);
else else
debugger("BApplication: couldn't obtain new app_server comm port"); debugger("BApplication: couldn't obtain new app_server comm port");
+6 -6
View File
@@ -54,7 +54,7 @@ LinkMsgReader::SetPort(port_id port)
status_t status_t
LinkMsgReader::GetNextMessage(int32 *code, bigtime_t timeout) LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
{ {
int32 remaining; int32 remaining;
@@ -92,7 +92,7 @@ LinkMsgReader::GetNextMessage(int32 *code, bigtime_t timeout)
return B_ERROR; return B_ERROR;
} }
*code = header->code; code = header->code;
fRecvPosition += sizeof(message_header); fRecvPosition += sizeof(message_header);
STRACE(("info: LinkMsgReader got header %s [%ld %ld %ld] from port %ld.\n", 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) if (status < B_OK)
return status; return status;
if (length > 0) { if (length >= 0) {
char *string = (char *)malloc(length); char *string = (char *)malloc(length + 1);
if (string == NULL) { if (string == NULL) {
fRecvPosition -= sizeof(int32); // rewind the transaction fRecvPosition -= sizeof(int32); // rewind the transaction
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -261,8 +261,8 @@ LinkMsgReader::ReadString(char **_string)
return status; return status;
} }
// make sure the string is null terminated (although it already should be) // make sure the string is null terminated
string[length - 1] = '\0'; string[length] = '\0';
*_string = string; *_string = string;
return B_OK; return B_OK;
+9 -5
View File
@@ -156,19 +156,23 @@ LinkMsgSender::Attach(const void *data, size_t size)
status_t status_t
LinkMsgSender::AttachString(const char *string) LinkMsgSender::AttachString(const char *string, int32 length)
{ {
if (string == NULL) if (string == NULL)
string = ""; string = "";
int32 length = strlen(string) + 1; if (length == -1)
length = strlen(string);
status_t status = Attach<int32>(length); status_t status = Attach<int32>(length);
if (status < B_OK) if (status < B_OK)
return status; return status;
status = Attach(string, length); if (length > 0) {
if (status < B_OK) status = Attach(string, length);
fCurrentEnd -= sizeof(int32); // rewind the transaction if (status < B_OK)
fCurrentEnd -= sizeof(int32); // rewind the transaction
}
return status; return status;
} }
+11
View File
@@ -87,3 +87,14 @@ BPortLink::AttachShape(BShape &shape)
fSender->Attach(opList, opCount * sizeof(uint32)); fSender->Attach(opList, opCount * sizeof(uint32));
return fSender->Attach(ptList, ptCount * sizeof(BPoint)); 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);
}
+25 -31
View File
@@ -39,42 +39,36 @@
#include <ServerProtocol.h> #include <ServerProtocol.h>
#include "ServerMemIO.h" #include "ServerMemIO.h"
ServerMemIO::ServerMemIO(size_t size) ServerMemIO::ServerMemIO(size_t size)
: fLen(0), : fLen(0),
fPhys(0), fPhys(0),
fPos(0) fPos(0)
{ {
if(size>0) if (size == 0)
{ return;
BPrivate::BAppServerLink link;
link.StartMessage(AS_ACQUIRE_SERVERMEM); BPrivate::BAppServerLink link;
link.Attach<size_t>(size); link.StartMessage(AS_ACQUIRE_SERVERMEM);
link.Attach<port_id>(link.ReplyPort()); link.Attach<size_t>(size);
link.Flush(); link.Attach<port_id>(link.ReplyPort());
int32 code; int32 code;
link.GetNextReply(&code); if (link.FlushWithReply(&code) == B_OK
&& code == SERVER_TRUE) {
if(code==SERVER_TRUE) area_info info;
{
area_info ai; link.Read<area_id>(&fSourceArea);
link.Read<size_t>(&fOffset);
link.Read<area_id>(&fSourceArea);
link.Read<size_t>(&fOffset); if (fSourceArea >= B_OK && get_area_info(fSourceArea, &info) == B_OK) {
fPhys = size;
if(fSourceArea>0 && get_area_info(fSourceArea,&ai)==B_OK) fArea = clone_area("ServerMemIO area", (void **)&fBuf, B_CLONE_ADDRESS,
{ B_READ_AREA|B_WRITE_AREA, fSourceArea);
fPhys=size;
fBuf += fOffset;
fArea=clone_area("ServerMemIO area",(void**)&fBuf,B_CLONE_ADDRESS, } else {
B_READ_AREA|B_WRITE_AREA,fSourceArea); debugger("PANIC: bad data or something in ServerMemIO constructor");
fBuf+=fOffset;
}
else
{
debugger("PANIC: bad data or something in ServerMemIO constructor");
}
} }
} }
} }
+178 -216
View File
@@ -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 // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
@@ -44,312 +44,274 @@
# define STRACE(x) ; # define STRACE(x) ;
#endif #endif
class FontListFamily
{ class FontListFamily {
public: public:
FontListFamily(void); FontListFamily(void);
~FontListFamily(void); ~FontListFamily(void);
BString name;
BList *styles; BString name;
int32 flags; BList *styles;
int32 flags;
}; };
FontListFamily::FontListFamily(void) FontListFamily::FontListFamily(void)
{ {
styles=new BList(0); styles = new BList(0);
flags=0; flags = 0;
} }
FontListFamily::~FontListFamily(void) FontListFamily::~FontListFamily(void)
{ {
BString *s; for (int32 i = styles->CountItems(); i-- > 0; ) {
s=(BString*)styles->RemoveItem(0L); delete (BString *)styles->ItemAt(i);
while(s)
{
delete s;
s=(BString*)styles->RemoveItem(0L);
} }
delete styles; delete styles;
} }
ClientFontList::ClientFontList(void) ClientFontList::ClientFontList(void)
{ {
STRACE(("ClientFontList()\n")); STRACE(("ClientFontList()\n"));
familylist=new BList(0); familylist = new BList(0);
fontlock=create_sem(1,"fontlist_sem"); fontlock = create_sem(1,"fontlist_sem");
} }
ClientFontList::~ClientFontList(void) ClientFontList::~ClientFontList(void)
{ {
STRACE(("~ClientFontList()\n")); STRACE(("~ClientFontList()\n"));
acquire_sem(fontlock); acquire_sem(fontlock);
font_family *fam; for (int32 i = familylist->CountItems(); i-- > 0; ) {
while(familylist->ItemAt(0L)!=NULL) delete (font_family *)familylist->ItemAt(i);
{
fam=(font_family *)familylist->RemoveItem(0L);
delete fam;
} }
familylist->MakeEmpty();
delete familylist; delete familylist;
delete_sem(fontlock); 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 // Open the font list kept in font list
acquire_sem(fontlock); acquire_sem(fontlock);
// We're going to ask the server whether the list has changed // We're going to ask the server whether the list has changed
port_id serverport; port_id port = find_port(SERVER_PORT_NAME);
serverport=find_port(SERVER_PORT_NAME);
bool needs_update=true;
BPortLink serverlink(serverport);
if(serverport!=B_NAME_NOT_FOUND) bool needsUpdate = true;
{ BPortLink link(port);
int32 code=SERVER_FALSE;
serverlink.StartMessage(AS_QUERY_FONTS_CHANGED); if (port >= B_OK) {
serverlink.Flush(); link.StartMessage(AS_QUERY_FONTS_CHANGED);
serverlink.GetNextReply(&code);
int32 code;
// Attached Data: none if (link.FlushWithReply(code) == B_OK)
// Reply: SERVER_TRUE if fonts have changed, SERVER_FALSE if not needsUpdate = code == SERVER_TRUE;
} else {
needs_update=(code==SERVER_TRUE)?true:false;
}
else
{
STRACE(("ClientFontList::Update(): Couldn't find app_server port\n")); STRACE(("ClientFontList::Update(): Couldn't find app_server port\n"));
} }
if(check_only) if (checkOnly || !needsUpdate) {
{
release_sem(fontlock); release_sem(fontlock);
return needs_update; return needsUpdate;
} }
// Don't update the list if nothing has changed BFile file(SERVER_FONT_LIST,B_READ_ONLY);
if(needs_update) BMessage fontMessage;
{
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
// Empty the font list if (file.InitCheck() == B_OK
FontListFamily *flf=(FontListFamily*)familylist->RemoveItem(0L); && fontMessage.Unflatten(&file) == B_OK) {
BString sty, extra; #ifdef DEBUG_CLIENT_FONT_LIST
int32 famindex, styindex; printf("Font message contents:\n");
bool tempbool; fontmsg.PrintToStream();
#endif
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));
STRACE(("Adding %s to list\n",flf->name.String())); // Empty the font list
styindex=0; 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 // Repopulate with new listings
while(familymsg.FindString("styles",styindex,&sty)==B_OK) int32 familyIndex = 0;
{ BMessage familyMessage;
STRACE(("\tAdding %s\n",sty.String())); while (fontMessage.FindMessage("family", familyIndex++, &familyMessage) == B_OK) {
styindex++; family = new FontListFamily();
flf->styles->AddItem(new BString(sty)); familylist->AddItem(family);
} familyMessage.FindString("name", &family->name);
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();
}
serverlink.StartMessage(AS_UPDATED_CLIENT_FONTLIST); STRACE(("Adding %s to list\n", family->name.String()));
serverlink.Flush();
int32 styleIndex = 0;
release_sem(fontlock);
return false; // 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); release_sem(fontlock);
return false; return false;
} }
int32 ClientFontList::CountFamilies(void)
int32
ClientFontList::CountFamilies(void)
{ {
STRACE(("ClientFontList::CountFamilies\n")); STRACE(("ClientFontList::CountFamilies\n"));
acquire_sem(fontlock); acquire_sem(fontlock);
int32 count=familylist->CountItems(); int32 count = familylist->CountItems();
release_sem(fontlock); release_sem(fontlock);
return count; 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)); STRACE(("ClientFontList::GetFamily(%ld)\n",index));
if(!name) if (!name) {
{
STRACE(("ClientFontList::GetFamily: NULL font_family parameter\n")); STRACE(("ClientFontList::GetFamily: NULL font_family parameter\n"));
return B_ERROR; return B_BAD_VALUE;
} }
acquire_sem(fontlock); 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")); STRACE(("ClientFontList::GetFamily: index not found\n"));
return B_ERROR; 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; return B_OK;
} }
int32 ClientFontList::CountStyles(font_family f)
int32
ClientFontList::CountStyles(font_family f)
{ {
acquire_sem(fontlock); acquire_sem(fontlock);
FontListFamily *flf=NULL;
int32 i, count=familylist->CountItems();
bool found=false;
for(i=0; i<count;i++) FontListFamily *family = NULL;
{ int32 i, count = familylist->CountItems();
flf=(FontListFamily *)familylist->ItemAt(i); bool found = false;
if(!flf)
for (i = 0; i < count; i++) {
family = (FontListFamily *)familylist->ItemAt(i);
if (!family)
continue; continue;
if(flf->name.ICompare(f)==0)
{ if (family->name.ICompare(f) == 0) {
found=true; found = true;
break; break;
} }
} }
count=(found)?flf->styles->CountItems():0; count = found ? family->styles->CountItems() : 0;
release_sem(fontlock); release_sem(fontlock);
return count; 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++) status_t
{ ClientFontList::GetStyle(font_family fontFamily, int32 index, font_style *name,
flf=(FontListFamily *)familylist->ItemAt(i); uint32 *flags, uint16 *face)
if(!flf) {
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; continue;
if(flf->name.ICompare(family)==0)
{ if (family->name.ICompare(fontFamily) == 0) {
found=true; found = true;
break; break;
} }
} }
if(!found) if (!found) {
{
release_sem(fontlock);
return B_ERROR;
}
style=(BString*)flf->styles->ItemAt(index);
if(!style)
{
release_sem(fontlock); release_sem(fontlock);
return B_ERROR; return B_ERROR;
} }
strcpy(*name,style->String()); style = (BString *)family->styles->ItemAt(index);
if (!style) {
release_sem(fontlock);
return B_ERROR;
}
if(flags) strcpy(*name, style->String());
*flags=flf->flags;
if(face) if (flags)
{ *flags = family->flags;
if(style->ICompare("Roman")==0 ||
style->ICompare("Regular")==0 || if (face) {
style->ICompare("Normal")==0 || if (!style->ICompare("Roman")
style->ICompare("Light")==0 || || !style->ICompare("Regular")
style->ICompare("Medium")==0 || || !style->ICompare("Normal")
style->ICompare("Plain")==0) || !style->ICompare("Light")
{ || !style->ICompare("Medium")
*face|=B_REGULAR_FACE; || !style->ICompare("Plain")) {
*face |= B_REGULAR_FACE;
STRACE(("GetStyle: %s Roman face\n", style->String())); STRACE(("GetStyle: %s Roman face\n", style->String()));
} } else if (!style->ICompare("Bold")) {
else *face |= B_BOLD_FACE;
if(style->ICompare("Bold")==0)
{
*face|=B_BOLD_FACE;
STRACE(("GetStyle: %s Bold face\n")); STRACE(("GetStyle: %s Bold face\n"));
} } else if (!style->ICompare("Italic")) {
else *face|=B_ITALIC_FACE;
if(style->ICompare("Italic")==0) STRACE(("GetStyle: %s Italic face\n"));
{ } else if (!style->ICompare("Bold Italic")) {
*face|=B_ITALIC_FACE; *face|=B_ITALIC_FACE | B_BOLD_FACE;
STRACE(("GetStyle: %s Italic face\n")); STRACE(("GetStyle: %s Bold Italic face\n"));
} } else {
else STRACE(("GetStyle: %s Unknown face %s\n", style->String()));
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()));
}
}
release_sem(fontlock); release_sem(fontlock);
return B_OK; return B_OK;
} }
File diff suppressed because it is too large Load Diff
+78 -96
View File
@@ -1,31 +1,13 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2005, Haiku * Copyright 2001-2005, Haiku.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a *
// copy of this software and associated documentation files (the "Software"), * Authors:
// to deal in the Software without restriction, including without limitation * Adrian Oanca <adioanca@cotty.iren.ro>
// the rights to use, copy, modify, merge, publish, distribute, sublicense, * Axel Dörfler, axeld@pinc-software.de
// 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 ([email protected])
// Description: A BWindow object represents a window that can be displayed
// on the screen, and that can be the target of user events
//------------------------------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h> #include <BeBuild.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <PropertyInfo.h> #include <PropertyInfo.h>
@@ -43,7 +25,6 @@
#include <MessageRunner.h> #include <MessageRunner.h>
#include <Roster.h> #include <Roster.h>
// Project Includes ------------------------------------------------------------
#include <AppMisc.h> #include <AppMisc.h>
#include <PortLink.h> #include <PortLink.h>
#include <ServerProtocol.h> #include <ServerProtocol.h>
@@ -51,10 +32,10 @@
#include <MessageUtils.h> #include <MessageUtils.h>
#include <WindowAux.h> #include <WindowAux.h>
// Standard Includes -----------------------------------------------------------
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
//#define DEBUG_WIN //#define DEBUG_WIN
#ifdef DEBUG_WIN #ifdef DEBUG_WIN
# include <stdio.h> # include <stdio.h>
@@ -65,8 +46,7 @@
using BPrivate::gDefaultTokens; using BPrivate::gDefaultTokens;
static property_info static property_info sWindowPropInfo[] = {
sWindowPropInfo[] = {
{ {
"Feel", { B_GET_PROPERTY, B_SET_PROPERTY }, "Feel", { B_GET_PROPERTY, B_SET_PROPERTY },
{ B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE } { B_DIRECT_SPECIFIER }, NULL, 0, { B_INT32_TYPE }
@@ -391,16 +371,16 @@ BWindow::SendBehind(const BWindow *window)
if (!window) if (!window)
return B_ERROR; return B_ERROR;
int32 rCode;
Lock(); Lock();
fLink->StartMessage(AS_SEND_BEHIND); fLink->StartMessage(AS_SEND_BEHIND);
fLink->Attach<int32>(_get_object_token_(window)); fLink->Attach<int32>(_get_object_token_(window));
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code = SERVER_FALSE;
fLink->FlushWithReply(code);
Unlock(); 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 void
BWindow::Sync() const BWindow::Sync() const
{ {
int32 rCode;
const_cast<BWindow*>(this)->Lock(); const_cast<BWindow*>(this)->Lock();
fLink->StartMessage(AS_SYNC); 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(); const_cast<BWindow*>(this)->Unlock();
} }
@@ -1030,12 +1011,10 @@ BWindow::SetSizeLimits(float minWidth, float maxWidth,
fLink->Attach<float>(maxWidth); fLink->Attach<float>(maxWidth);
fLink->Attach<float>(minHeight); fLink->Attach<float>(minHeight);
fLink->Attach<float>(maxHeight); fLink->Attach<float>(maxHeight);
fLink->Flush();
int32 rCode; int32 code;
fLink->GetNextReply(&rCode); if (fLink->FlushWithReply(code) == B_OK
&& code == SERVER_TRUE) {
if (rCode == SERVER_TRUE) {
// read the values that were really enforced on // read the values that were really enforced on
// the server side // the server side
fLink->Read<float>(&fMinWindWidth); fLink->Read<float>(&fMinWindWidth);
@@ -1269,15 +1248,16 @@ bool
BWindow::NeedsUpdate() const BWindow::NeedsUpdate() const
{ {
// TODO: What about locking?!? // TODO: What about locking?!?
int32 rCode;
const_cast<BWindow *>(this)->Lock(); const_cast<BWindow *>(this)->Lock();
fLink->StartMessage(AS_NEEDS_UPDATE); fLink->StartMessage(AS_NEEDS_UPDATE);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code = SERVER_FALSE;
fLink->FlushWithReply(code);
const_cast<BWindow *>(this)->Unlock(); 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; return B_BAD_VALUE;
team_id team = Team(); team_id team = Team();
int32 rCode;
Lock(); Lock();
fLink->StartMessage(AS_ADD_TO_SUBSET); fLink->StartMessage(AS_ADD_TO_SUBSET);
fLink->Attach<int32>(_get_object_token_(window)); fLink->Attach<int32>(_get_object_token_(window));
fLink->Attach<team_id>(team); fLink->Attach<team_id>(team);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code = SERVER_FALSE;
fLink->FlushWithReply(code);
Unlock(); 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; return B_BAD_VALUE;
team_id team = Team(); team_id team = Team();
int32 rCode;
Lock(); Lock();
fLink->StartMessage(AS_REM_FROM_SUBSET); fLink->StartMessage(AS_REM_FROM_SUBSET);
fLink->Attach<int32>(_get_object_token_(window)); fLink->Attach<int32>(_get_object_token_(window));
fLink->Attach<team_id>(team); fLink->Attach<team_id>(team);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code;
fLink->FlushWithReply(code);
Unlock(); 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 status_t
BWindow::SetLook(window_look look) BWindow::SetLook(window_look look)
{ {
int32 rCode;
Lock(); Lock();
fLink->StartMessage(AS_SET_LOOK); fLink->StartMessage(AS_SET_LOOK);
fLink->Attach<int32>((int32)look); fLink->Attach<int32>((int32)look);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code = SERVER_FALSE;
fLink->FlushWithReply(code);
Unlock(); Unlock();
// ToDo: the server should probably return something more meaningful, anyway // ToDo: the server should probably return something more meaningful, anyway
if (rCode == SERVER_TRUE) { if (code == SERVER_TRUE) {
fLook = look; fLook = look;
return B_OK; return B_OK;
} }
@@ -1669,16 +1651,17 @@ BWindow::Feel() const
status_t status_t
BWindow::SetFlags(uint32 flags) BWindow::SetFlags(uint32 flags)
{ {
int32 rCode;
Lock(); Lock();
fLink->StartMessage(AS_SET_FLAGS); fLink->StartMessage(AS_SET_FLAGS);
fLink->Attach<uint32>(flags); fLink->Attach<uint32>(flags);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code = SERVER_FALSE;
fLink->FlushWithReply(code);
Unlock(); Unlock();
if (rCode == SERVER_TRUE) { if (code == SERVER_TRUE) {
fFlags = flags; fFlags = flags;
return B_OK; return B_OK;
} }
@@ -1707,7 +1690,6 @@ BWindow::SetWindowAlignment(window_alignment mode,
return B_BAD_VALUE; return B_BAD_VALUE;
// TODO: test if hOffset = 0 and set it to 1 if true. // TODO: test if hOffset = 0 and set it to 1 if true.
int32 rCode;
Lock(); Lock();
fLink->StartMessage(AS_SET_ALIGNMENT); fLink->StartMessage(AS_SET_ALIGNMENT);
@@ -1720,11 +1702,13 @@ BWindow::SetWindowAlignment(window_alignment mode,
fLink->Attach<int32>(vOffset); fLink->Attach<int32>(vOffset);
fLink->Attach<int32>(height); fLink->Attach<int32>(height);
fLink->Attach<int32>(heightOffset); fLink->Attach<int32>(heightOffset);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code = SERVER_FALSE;
fLink->FlushWithReply(code);
Unlock(); Unlock();
if (rCode == SERVER_TRUE) if (code == SERVER_TRUE)
return B_OK; return B_OK;
return B_ERROR; return B_ERROR;
@@ -1736,14 +1720,12 @@ BWindow::GetWindowAlignment(window_alignment *mode,
int32 *h, int32 *hOffset, int32 *width, int32 *widthOffset, int32 *h, int32 *hOffset, int32 *width, int32 *widthOffset,
int32 *v, int32 *vOffset, int32 *height, int32 *heightOffset) const 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->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>((int32 *)mode);
fLink->Read<int32>(h); fLink->Read<int32>(h);
fLink->Read<int32>(hOffset); fLink->Read<int32>(hOffset);
@@ -1752,15 +1734,14 @@ BWindow::GetWindowAlignment(window_alignment *mode,
fLink->Read<int32>(v); fLink->Read<int32>(v);
fLink->Read<int32>(hOffset); fLink->Read<int32>(hOffset);
fLink->Read<int32>(height); fLink->Read<int32>(height);
rCode = fLink->Read<int32>(heightOffset); fLink->Read<int32>(heightOffset);
return B_NO_ERROR;
} }
const_cast<BWindow *>(this)->Unlock(); const_cast<BWindow *>(this)->Unlock();
if(rCode!=B_OK) if (code != SERVER_TRUE)
return B_ERROR; return B_ERROR;
return B_OK; return B_OK;
} }
@@ -1768,14 +1749,16 @@ BWindow::GetWindowAlignment(window_alignment *mode,
uint32 uint32
BWindow::Workspaces() const BWindow::Workspaces() const
{ {
uint32 workspaces; uint32 workspaces = 0;
int32 rCode;
const_cast<BWindow *>(this)->Lock(); const_cast<BWindow *>(this)->Lock();
fLink->StartMessage(AS_GET_WORKSPACES); fLink->StartMessage(AS_GET_WORKSPACES);
fLink->Flush();
fLink->GetNextReply(&rCode); int32 code;
fLink->Read<uint32>(&workspaces); if (fLink->FlushWithReply(code) == B_OK
&& code == SERVER_TRUE)
fLink->Read<uint32>(&workspaces);
const_cast<BWindow *>(this)->Unlock(); const_cast<BWindow *>(this)->Unlock();
// TODO: shouldn't we cache? // 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 // 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 // we'll lock the be_app to be sure we're the only one writing at BApplication's server port
bool locked = false; bool locked = false;
if (!(be_app->IsLocked())) { if (!be_app->IsLocked()) {
be_app->Lock(); be_app->Lock();
locked = true; locked = true;
} }
STRACE(("be_app->fServerTo is %ld\n", be_app->fServerFrom)); STRACE(("be_app->fServerTo is %ld\n", be_app->fServerFrom));
status_t err;
fLink->StartMessage(AS_CREATE_WINDOW); fLink->StartMessage(AS_CREATE_WINDOW);
fLink->Attach<BRect>(fFrame); fLink->Attach<BRect>(fFrame);
fLink->Attach<int32>((int32)fLook); 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>(receive_port);
fLink->Attach<port_id>(fMsgPort); fLink->Attach<port_id>(fMsgPort);
fLink->AttachString(title); fLink->AttachString(title);
fLink->Flush();
send_port = -1; int32 code;
int32 rCode = SERVER_FALSE; if (fLink->FlushWithReply(code) == B_OK
err = fLink->GetNextReply(&rCode); && code == SERVER_TRUE
if (err == B_OK && rCode == SERVER_TRUE) && fLink->Read<port_id>(&send_port) == B_OK)
fLink->Read<port_id>(&send_port); fLink->SetSendPort(send_port);
fLink->SetSendPort(send_port); else
send_port = -1;
if (locked) if (locked)
be_app->Unlock(); be_app->Unlock();
STRACE(("Server says that our send port is %ld\n", send_port)); 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 // build and register top_view with app_server
BuildTopView(); BuildTopView();
+9 -13
View File
@@ -401,23 +401,19 @@ AppServer::Run(void)
void void
AppServer::MainLoop(void) AppServer::MainLoop(void)
{ {
BPortLink pmsg(-1,fMessagePort); 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);
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")); STRACE(("MainLoop:pmsg.GetNextReply failed\n"));
continue; continue;
} }
switch(code) switch (code) {
{
case B_QUIT_REQUESTED: case B_QUIT_REQUESTED:
case AS_CREATE_APP: case AS_CREATE_APP:
case AS_DELETE_APP: case AS_DELETE_APP:
+33 -32
View File
@@ -192,12 +192,13 @@ RootLayer::RunThread()
\param data Pointer to the app_server to which the thread belongs \param data Pointer to the app_server to which the thread belongs
\return Throwaway value - always 0 \return Throwaway value - always 0
*/ */
int32 RootLayer::WorkingThread(void *data) int32
RootLayer::WorkingThread(void *data)
{ {
int32 code = 0; int32 code = 0;
status_t err = B_OK; status_t err = B_OK;
RootLayer *oneRootLayer = (RootLayer*)data; RootLayer *oneRootLayer = (RootLayer*)data;
BPortLink messageQueue(-1, oneRootLayer->fListenPort); BPortLink messageQueue(-1, oneRootLayer->fListenPort);
// first make sure we are actualy visible // first make sure we are actualy visible
oneRootLayer->Lock(); oneRootLayer->Lock();
@@ -206,18 +207,16 @@ int32 RootLayer::WorkingThread(void *data)
oneRootLayer->Unlock(); oneRootLayer->Unlock();
STRACE(("info: RootLayer(%s)::WorkingThread listening on port %ld.\n", oneRootLayer->GetName(), oneRootLayer->fListenPort)); STRACE(("info: RootLayer(%s)::WorkingThread listening on port %ld.\n", oneRootLayer->GetName(), oneRootLayer->fListenPort));
for(;;) for (;;) {
{ err = messageQueue.GetNextReply(code);
err = messageQueue.GetNextReply(&code); if (err < B_OK) {
if(err < B_OK) {
STRACE(("WorkingThread: messageQueue.GetNextReply failed\n")); STRACE(("WorkingThread: messageQueue.GetNextReply failed\n"));
continue; continue;
} }
oneRootLayer->Lock(); oneRootLayer->Lock();
switch(code) switch (code) {
{
// We don't need to do anything with these two, so just pass them // We don't need to do anything with these two, so just pass them
// onto the active application. Eventually, we will end up passing // onto the active application. Eventually, we will end up passing
// them onto the window which is currently under the cursor. // them onto the window which is currently under the cursor.
@@ -242,22 +241,22 @@ int32 RootLayer::WorkingThread(void *data)
case AS_ROOTLAYER_SHOW_WINBORDER: case AS_ROOTLAYER_SHOW_WINBORDER:
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
oneRootLayer->show_winBorder(winBorder); oneRootLayer->show_winBorder(winBorder);
break; break;
} }
case AS_ROOTLAYER_HIDE_WINBORDER: case AS_ROOTLAYER_HIDE_WINBORDER:
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
oneRootLayer->hide_winBorder(winBorder); oneRootLayer->hide_winBorder(winBorder);
break; break;
} }
case AS_ROOTLAYER_DO_INVALIDATE: case AS_ROOTLAYER_DO_INVALIDATE:
{ {
BRegion invalidRegion; BRegion invalidRegion;
Layer *layer = NULL; Layer *layer = NULL;
messageQueue.Read<Layer*>(&layer); messageQueue.Read<Layer*>(&layer);
messageQueue.ReadRegion(&invalidRegion); messageQueue.ReadRegion(&invalidRegion);
oneRootLayer->invalidate_layer(layer, invalidRegion); oneRootLayer->invalidate_layer(layer, invalidRegion);
@@ -265,8 +264,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_DO_REDRAW: case AS_ROOTLAYER_DO_REDRAW:
{ {
BRegion redrawRegion; BRegion redrawRegion;
Layer *layer = NULL; Layer *layer = NULL;
messageQueue.Read<Layer*>(&layer); messageQueue.Read<Layer*>(&layer);
messageQueue.ReadRegion(&redrawRegion); messageQueue.ReadRegion(&redrawRegion);
oneRootLayer->redraw_layer(layer, redrawRegion); oneRootLayer->redraw_layer(layer, redrawRegion);
@@ -274,8 +273,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_LAYER_MOVE: case AS_ROOTLAYER_LAYER_MOVE:
{ {
Layer *layer = NULL; Layer *layer = NULL;
float x, y; float x, y;
messageQueue.Read<Layer*>(&layer); messageQueue.Read<Layer*>(&layer);
messageQueue.Read<float>(&x); messageQueue.Read<float>(&x);
messageQueue.Read<float>(&y); messageQueue.Read<float>(&y);
@@ -284,8 +283,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_LAYER_RESIZE: case AS_ROOTLAYER_LAYER_RESIZE:
{ {
Layer *layer = NULL; Layer *layer = NULL;
float x, y; float x, y;
messageQueue.Read<Layer*>(&layer); messageQueue.Read<Layer*>(&layer);
messageQueue.Read<float>(&x); messageQueue.Read<float>(&x);
messageQueue.Read<float>(&y); messageQueue.Read<float>(&y);
@@ -294,8 +293,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_ADD_TO_SUBSET: case AS_ROOTLAYER_ADD_TO_SUBSET:
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
WinBorder *toWinBorder = NULL; WinBorder *toWinBorder = NULL;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
messageQueue.Read<WinBorder*>(&toWinBorder); messageQueue.Read<WinBorder*>(&toWinBorder);
oneRootLayer->fDesktop->AddWinBorderToSubset(winBorder, toWinBorder); oneRootLayer->fDesktop->AddWinBorderToSubset(winBorder, toWinBorder);
@@ -303,8 +302,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_REMOVE_FROM_SUBSET: case AS_ROOTLAYER_REMOVE_FROM_SUBSET:
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
WinBorder *fromWinBorder = NULL; WinBorder *fromWinBorder = NULL;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
messageQueue.Read<WinBorder*>(&fromWinBorder); messageQueue.Read<WinBorder*>(&fromWinBorder);
oneRootLayer->fDesktop->RemoveWinBorderFromSubset(winBorder, fromWinBorder); oneRootLayer->fDesktop->RemoveWinBorderFromSubset(winBorder, fromWinBorder);
@@ -312,8 +311,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_WINBORDER_SET_WORKSPACES: case AS_ROOTLAYER_WINBORDER_SET_WORKSPACES:
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
uint32 oldWks = 0, newWks = 0; uint32 oldWks = 0, newWks = 0;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
messageQueue.Read<uint32>(&oldWks); messageQueue.Read<uint32>(&oldWks);
@@ -323,8 +322,8 @@ int32 RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL: case AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL:
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
int32 newFeel = 0; int32 newFeel = 0;
messageQueue.Read<WinBorder*>(&winBorder); messageQueue.Read<WinBorder*>(&winBorder);
messageQueue.Read<int32>(&newFeel); messageQueue.Read<int32>(&newFeel);
@@ -345,9 +344,11 @@ int32 RootLayer::WorkingThread(void *data)
return 0; return 0;
} }
void RootLayer::GoInvalidate(const Layer *layer, const BRegion &region)
void
RootLayer::GoInvalidate(const Layer *layer, const BRegion &region)
{ {
BPortLink msg(fListenPort, -1); BPortLink msg(fListenPort, -1);
msg.StartMessage(AS_ROOTLAYER_DO_INVALIDATE); msg.StartMessage(AS_ROOTLAYER_DO_INVALIDATE);
msg.Attach<const Layer*>(layer); msg.Attach<const Layer*>(layer);
msg.AttachRegion(region); msg.AttachRegion(region);
+1 -1
View File
@@ -297,7 +297,7 @@ ServerApp::MonitorApp(void *data)
while (!app->fQuitting) { while (!app->fQuitting) {
STRACE(("info: ServerApp::MonitorApp listening on port %ld.\n", app->fMessagePort)); STRACE(("info: ServerApp::MonitorApp listening on port %ld.\n", app->fMessagePort));
err = msgqueue.GetNextMessage(&code); err = msgqueue.GetNextMessage(code);
if (err < B_OK) { if (err < B_OK) {
STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err))); STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err)));
+1 -1
View File
@@ -1969,7 +1969,7 @@ ServerWindow::MonitorWin(void *data)
while (!quitting) { while (!quitting) {
// printf("info: ServerWindow::MonitorWin listening on port %ld.\n", win->fMessagePort); // printf("info: ServerWindow::MonitorWin listening on port %ld.\n", win->fMessagePort);
code = AS_CLIENT_DEAD; code = AS_CLIENT_DEAD;
err = ses->GetNextMessage(&code); err = ses->GetNextMessage(code);
if (err < B_OK) if (err < B_OK)
return err; return err;