When the active window (the one who has both, focus and front states) changes, messages are sent to the client side. This makes BWindow::WindowActivated to be called on such am event.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12077 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-03-27 13:52:26 +00:00
parent 80cbe2b0f3
commit d9bbe07efa

View File

@ -917,6 +917,7 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
click_type action; click_type action;
bool invalidate; bool invalidate;
bool sendMessage = true; bool sendMessage = true;
WinBorder *exActive = ActiveWinBorder();
WinBorder *exFocus = FocusWinBorder(); WinBorder *exFocus = FocusWinBorder();
WinBorder *target = fLastMouseMoved->fOwner? WinBorder *target = fLastMouseMoved->fOwner?
fLastMouseMoved->fOwner: fLastMouseMoved->fOwner:
@ -942,6 +943,8 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
draw_window_tab(exFocus, FocusWinBorder()); draw_window_tab(exFocus, FocusWinBorder());
winborder_activation(exActive);
if (action == DEC_DRAG) if (action == DEC_DRAG)
{ {
fMovingWindow = true; fMovingWindow = true;
@ -1675,6 +1678,7 @@ void RootLayer::show_winBorder(WinBorder *winBorder)
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder *exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder();
winBorder->Show(false); winBorder->Show(false);
@ -1708,6 +1712,8 @@ void RootLayer::show_winBorder(WinBorder *winBorder)
invalidate_layer(this, fFull); invalidate_layer(this, fFull);
draw_window_tab(exFocus, FocusWinBorder()); draw_window_tab(exFocus, FocusWinBorder());
winborder_activation(exActive);
} }
} }
@ -1716,6 +1722,7 @@ void RootLayer::hide_winBorder(WinBorder *winBorder)
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder *exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder();
winBorder->Hide(false); winBorder->Hide(false);
@ -1739,6 +1746,8 @@ void RootLayer::hide_winBorder(WinBorder *winBorder)
invalidate_layer(this, fFull); invalidate_layer(this, fFull);
draw_window_tab(exFocus, FocusWinBorder()); draw_window_tab(exFocus, FocusWinBorder());
winborder_activation(exActive);
} }
} }
@ -1835,3 +1844,21 @@ void RootLayer::empty_visible_regions(Layer *layer)
child = layer->VirtualUpperSibling(); child = layer->VirtualUpperSibling();
} }
} }
inline
void RootLayer::winborder_activation(WinBorder* exActive)
{
if (exActive && (FocusWinBorder() != exActive || FrontWinBorder() != exActive))
{
BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", false);
exActive->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
}
if (FocusWinBorder() == FrontWinBorder()
&& FrontWinBorder() != NULL && FrontWinBorder() != exActive)
{
BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", true);
FrontWinBorder()->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
}
}