* DispatchMessage()'s B_WINDOW_ACTIVATED now checks if there are any pending

activation messages, and always retrieves the information from the latest.
* Reverted r23062, as the above should fix bug #613 as well.
* This should also fix bug #1674.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23196 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-12-30 12:46:30 +00:00
parent 9ffc1f4105
commit deb58f165b
+26 -11
View File
@@ -874,7 +874,6 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target)
// combine with pending resize notifications // combine with pending resize notifications
BMessage* pendingMessage; BMessage* pendingMessage;
while ((pendingMessage = MessageQueue()->FindMessage(B_WINDOW_RESIZED, 0))) { while ((pendingMessage = MessageQueue()->FindMessage(B_WINDOW_RESIZED, 0))) {
if (pendingMessage != msg) {
int32 nextWidth; int32 nextWidth;
if (pendingMessage->FindInt32("width", &nextWidth) == B_OK) if (pendingMessage->FindInt32("width", &nextWidth) == B_OK)
width = nextWidth; width = nextWidth;
@@ -887,9 +886,6 @@ BWindow::DispatchMessage(BMessage *msg, BHandler *target)
delete pendingMessage; delete pendingMessage;
// this deletes the first *additional* message // this deletes the first *additional* message
// fCurrentMessage is safe // fCurrentMessage is safe
} else {
MessageQueue()->RemoveMessage(pendingMessage);
}
} }
if (width != fFrame.Width() || height != fFrame.Height()) { if (width != fFrame.Width() || height != fFrame.Height()) {
// NOTE: we might have already handled the resize // NOTE: we might have already handled the resize
@@ -932,10 +928,32 @@ FrameMoved(origin);
} }
case B_WINDOW_ACTIVATED: case B_WINDOW_ACTIVATED:
if (target == this) { if (target != this) {
target->MessageReceived(msg);
break;
}
bool active; bool active;
if (msg->FindBool("active", &active) == B_OK if (msg->FindBool("active", &active) != B_OK)
&& active != fActive) { break;
// find latest activation message
while (true) {
BMessage* pendingMessage = MessageQueue()->FindMessage(
B_WINDOW_RESIZED, 0);
if (pendingMessage == NULL)
break;
bool nextActive;
if (pendingMessage->FindBool("active", &nextActive) == B_OK)
active = nextActive;
MessageQueue()->RemoveMessage(pendingMessage);
delete pendingMessage;
}
if (active != fActive) {
fActive = active; fActive = active;
WindowActivated(active); WindowActivated(active);
@@ -957,8 +975,6 @@ FrameMoved(origin);
msg.AddMessenger("view", messenger); msg.AddMessenger("view", messenger);
_control_input_server_(&msg, &reply); _control_input_server_(&msg, &reply);
} }
} else
target->MessageReceived(msg);
break; break;
case B_SCREEN_CHANGED: case B_SCREEN_CHANGED:
@@ -1686,8 +1702,7 @@ BWindow::UpdateIfNeeded()
BMessage *msg; BMessage *msg;
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) { for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) {
// TODO: Dispatch more messages ?!?!? Check what beos does. if (msg->what == _UPDATE_) {
if (msg->what == _UPDATE_ || msg->what == B_WINDOW_ACTIVATED) {
BWindow::DispatchMessage(msg, this); BWindow::DispatchMessage(msg, this);
// we need to make sure that no overridden method is called // we need to make sure that no overridden method is called
// here; for BWindow::DispatchMessage() we now exactly what // here; for BWindow::DispatchMessage() we now exactly what