* 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:
@@ -874,22 +874,18 @@ 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;
|
|
||||||
|
|
||||||
int32 nextHeight;
|
int32 nextHeight;
|
||||||
if (pendingMessage->FindInt32("height", &nextHeight) == B_OK)
|
if (pendingMessage->FindInt32("height", &nextHeight) == B_OK)
|
||||||
height = nextHeight;
|
height = nextHeight;
|
||||||
|
|
||||||
MessageQueue()->RemoveMessage(pendingMessage);
|
MessageQueue()->RemoveMessage(pendingMessage);
|
||||||
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,33 +928,53 @@ FrameMoved(origin);
|
|||||||
}
|
}
|
||||||
|
|
||||||
case B_WINDOW_ACTIVATED:
|
case B_WINDOW_ACTIVATED:
|
||||||
if (target == this) {
|
if (target != this) {
|
||||||
bool active;
|
|
||||||
if (msg->FindBool("active", &active) == B_OK
|
|
||||||
&& active != fActive) {
|
|
||||||
fActive = active;
|
|
||||||
|
|
||||||
WindowActivated(active);
|
|
||||||
|
|
||||||
// call hook function 'WindowActivated(bool)' for all
|
|
||||||
// views attached to this window.
|
|
||||||
fTopView->_Activate(active);
|
|
||||||
|
|
||||||
// we notify the input server if we are gaining or losing focus
|
|
||||||
// from a view which has the B_INPUT_METHOD_AWARE on a window
|
|
||||||
// (de)activation
|
|
||||||
bool inputMethodAware = false;
|
|
||||||
if (fFocus)
|
|
||||||
inputMethodAware = fFocus->Flags() & B_INPUT_METHOD_AWARE;
|
|
||||||
BMessage msg(active && inputMethodAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW);
|
|
||||||
BMessenger messenger(fFocus);
|
|
||||||
BMessage reply;
|
|
||||||
if (fFocus)
|
|
||||||
msg.AddMessenger("view", messenger);
|
|
||||||
_control_input_server_(&msg, &reply);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
target->MessageReceived(msg);
|
target->MessageReceived(msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool active;
|
||||||
|
if (msg->FindBool("active", &active) != B_OK)
|
||||||
|
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;
|
||||||
|
|
||||||
|
WindowActivated(active);
|
||||||
|
|
||||||
|
// call hook function 'WindowActivated(bool)' for all
|
||||||
|
// views attached to this window.
|
||||||
|
fTopView->_Activate(active);
|
||||||
|
|
||||||
|
// we notify the input server if we are gaining or losing focus
|
||||||
|
// from a view which has the B_INPUT_METHOD_AWARE on a window
|
||||||
|
// (de)activation
|
||||||
|
bool inputMethodAware = false;
|
||||||
|
if (fFocus)
|
||||||
|
inputMethodAware = fFocus->Flags() & B_INPUT_METHOD_AWARE;
|
||||||
|
BMessage msg(active && inputMethodAware ? IS_FOCUS_IM_AWARE_VIEW : IS_UNFOCUS_IM_AWARE_VIEW);
|
||||||
|
BMessenger messenger(fFocus);
|
||||||
|
BMessage reply;
|
||||||
|
if (fFocus)
|
||||||
|
msg.AddMessenger("view", messenger);
|
||||||
|
_control_input_server_(&msg, &reply);
|
||||||
|
}
|
||||||
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
|
||||||
@@ -1695,8 +1710,8 @@ BWindow::UpdateIfNeeded()
|
|||||||
queue->RemoveMessage(msg);
|
queue->RemoveMessage(msg);
|
||||||
delete msg;
|
delete msg;
|
||||||
break;
|
break;
|
||||||
// NOTE: "i" would have to be decreased if there were
|
// NOTE: "i" would have to be decreased if there were
|
||||||
// multiple _UPDATE_ messages and we would not break!
|
// multiple _UPDATE_ messages and we would not break!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user