ServerFont:

* fixed weird pointer conversion in SetStyle()
* fixed a potential mix up in operator=() in case the
  other ServerFont has fStyle == NULL

ServerWindow:
* the WindowLayer fTopLayer cannot be deleted by
  client request, just for safety reasons
* the link is flushed if there is no drawing engine,
  but this case is theoretical only
* deleting the ServerWindow object syncs with the
  client, so that when BBitmaps are deleted, they
  can be sure there are no pending messages (which
  would be executed in a nother thread)
* there is no timeout anymore when sending messages
  to the client, which made absolutely no sense

AGGTextRenderer:
* renamed fFontManager to fFontCache, because that's
  what it really is
* fLastFamilyAndStyle defaulted to the system plain
  font and therefor that font was never loaded when
  the font never changed meanwhile

DrawingMode:
* I'm not quite sure but I think there was the
  potential of a division by zero, at least I
  had crashes with "divide error"

HWInterface:
* fix update when the cursor shape changed in
  double buffered mode
 
ViewLayer:
* since the top layer is never really deleted
  before its time has come, it is not necessary
  to set it to NULL in the ViewLayer destructor

ViewLayer/WindowLayer:
* added a function to collect the view tokens
  that are affected by an update session

EventDispatcher:
* use the importance of the message for the timeout
  in _SendMessage()
* drop mouse moved events in the server if we're
  lagging behind more than 5 ms (Axel, maybe review)

View:
* there were some problems with the locking
  of the BWindow looper in RemoveSelf(), since
  this is called from the window destructor,
  also of BWindows from BBitmaps, which have
  never been run (this might need review), at
  least I seem to have solved the crashing
  problems introduced by actually deleting the
  view hirarchy in the BWindow destructor
* fixed _Draw() for being used non-recursively,
  temporarily disabled DrawAfterChildren, which
  didn't work yet anyways (because views cannot
  draw over children in the server yet)

Window:
* small cleanup when deleting shortcuts
* sync with the server when having send
  AS_DELETE_WINDOW (see ServerWindow above)
* fixed locking in Begin/EndViewTransaction()
* removed folding of _UPDATE_ messages, since
  there is only one ever in the queue
* set the fInTransaction flag during an update,
  I plan to use this in BView later to
  flush the link when drawing outside of an
  update
* BView::_Draw() is now called by view token,
  this gives the next leap forward in speed,
  the overhead because of drawing clean views
  was considerable



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15878 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-01-08 22:04:52 +00:00
parent f15ba33751
commit 7afc7c5074
13 changed files with 203 additions and 146 deletions
+47 -47
View File
@@ -315,10 +315,10 @@ BWindow::~BWindow()
fTopView->RemoveSelf();
delete fTopView;
// remove all existing shortcuts
int32 noOfItems = fShortcuts.CountItems();
for (int32 index = noOfItems - 1; index >= 0; index--) {
delete (Shortcut *)fShortcuts.ItemAt(index);
// remove all remaining shortcuts
int32 shortCutCount = fShortcuts.CountItems();
for (int32 i = 0; i < shortCutCount; i++) {
delete (Shortcut*)fShortcuts.ItemAtFast(i);
}
// TODO: release other dynamically-allocated objects
@@ -332,7 +332,13 @@ BWindow::~BWindow()
// tell app_server about our demise
fLink->StartMessage(AS_DELETE_WINDOW);
fLink->Flush();
// sync with the server so that for example
// a BBitmap can be sure that there are no
// more pending messages that are executed
// after the bitmap is deleted (which uses
// a different link and server side thread)
int32 code;
fLink->FlushWithReply(code);
// the sender port belongs to the app_server
delete_port(fLink->ReceiverPort());
@@ -511,7 +517,7 @@ BWindow::Sync() const
const_cast<BWindow*>(this)->Lock();
fLink->StartMessage(AS_SYNC);
// ToDo: why with reply?
// waiting for the reply is the actual syncing
int32 code;
fLink->FlushWithReply(code);
@@ -542,12 +548,15 @@ BWindow::EnableUpdates()
void
BWindow::BeginViewTransaction()
{
if (!fInTransaction) {
Lock();
if (Lock()) {
if (fInTransaction) {
Unlock();
return;
}
fLink->StartMessage(AS_BEGIN_TRANSACTION);
Unlock();
fInTransaction = true;
Unlock();
}
}
@@ -555,13 +564,16 @@ BWindow::BeginViewTransaction()
void
BWindow::EndViewTransaction()
{
if (fInTransaction) {
Lock();
if (Lock()) {
if (!fInTransaction) {
Unlock();
return;
}
fLink->StartMessage(AS_END_TRANSACTION);
fLink->Flush();
Unlock();
fInTransaction = false;
Unlock();
}
}
@@ -896,8 +908,14 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target)
uint32 buttons;
uint32 transit;
msg->FindPoint("be:view_where", &where);
msg->FindInt32("buttons", (int32 *)&buttons);
msg->FindInt32("be:transit", (int32 *)&transit);
msg->FindInt32("buttons", (int32*)&buttons);
msg->FindInt32("be:transit", (int32*)&transit);
// bigtime_t when;
// if (msg->FindInt64("when", (int64*)&when) < B_OK)
// printf("BWindow B_MOUSE_MOVED no when\n");
// else if (system_time() - when > 5000) {
// printf("BWindow B_MOUSE_MOVED lagging behind\n");
// }
BMessage* dragMessage = NULL;
if (msg->HasMessage("be:drag_message")) {
dragMessage = new BMessage();
@@ -927,41 +945,23 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target)
case _UPDATE_:
{
STRACE(("info:BWindow handling _UPDATE_.\n"));
// BRect updateRect;
// int32 token;
// msg->FindRect("_rect", &updateRect);
// msg->FindInt32("_token", &token);
// // TODO: why is "_token" ignored?
//
// fLink->StartMessage(AS_BEGIN_UPDATE);
// fTopView->_Draw(updateRect);
// fLink->StartMessage(AS_END_UPDATE);
// fLink->Flush();
BRect total;
msg->FindRect("_rect", &total);
// combine with pending update requests
BRect next;
BMessage* pendingMessage;
while ((pendingMessage = MessageQueue()->FindMessage(_UPDATE_, 0))) {
if (pendingMessage != msg) {
pendingMessage->FindRect("_rect", &next);
total = total | next;
MessageQueue()->RemoveMessage(pendingMessage);
// TODO: the BeBook says that MessageQueue::RemoveMessage() deletes the message!
// this deletes the first *additional* message
// fCurrentMessage is safe
delete pendingMessage;
} else {
MessageQueue()->RemoveMessage(pendingMessage);
}
}
BRect updateRect;
msg->FindRect("_rect", &updateRect);
updateRect.OffsetBy(fFrame.LeftTop());
fLink->StartMessage(AS_BEGIN_UPDATE);
fTopView->_Draw(total);
fInTransaction = true;
int32 token;
for (int32 i = 0; msg->FindInt32("_token", i, &token) == B_OK; i++) {
if (BView* view = _FindView(token))
view->_Draw(updateRect);
}
fLink->StartMessage(AS_END_UPDATE);
fLink->Flush();
fInTransaction = false;
break;
}