From d9bbe07efadc0d349f236823faa170967937e372 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Sun, 27 Mar 2005 13:52:26 +0000 Subject: [PATCH] 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 --- src/servers/app/RootLayer.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 03c9fd52ae..79d351ef91 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -917,6 +917,7 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) click_type action; bool invalidate; bool sendMessage = true; + WinBorder *exActive = ActiveWinBorder(); WinBorder *exFocus = FocusWinBorder(); WinBorder *target = fLastMouseMoved->fOwner? fLastMouseMoved->fOwner: @@ -942,6 +943,8 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) draw_window_tab(exFocus, FocusWinBorder()); + winborder_activation(exActive); + if (action == DEC_DRAG) { fMovingWindow = true; @@ -1672,9 +1675,10 @@ void RootLayer::PrintToStream() void RootLayer::show_winBorder(WinBorder *winBorder) { - bool invalidate = false; - bool invalid; + bool invalidate = false; + bool invalid; WinBorder *exFocus = FocusWinBorder(); + WinBorder *exActive = ActiveWinBorder(); winBorder->Show(false); @@ -1708,6 +1712,8 @@ void RootLayer::show_winBorder(WinBorder *winBorder) invalidate_layer(this, fFull); draw_window_tab(exFocus, FocusWinBorder()); + + winborder_activation(exActive); } } @@ -1716,6 +1722,7 @@ void RootLayer::hide_winBorder(WinBorder *winBorder) bool invalidate = false; bool invalid; WinBorder *exFocus = FocusWinBorder(); + WinBorder *exActive = ActiveWinBorder(); winBorder->Hide(false); @@ -1739,6 +1746,8 @@ void RootLayer::hide_winBorder(WinBorder *winBorder) invalidate_layer(this, fFull); draw_window_tab(exFocus, FocusWinBorder()); + + winborder_activation(exActive); } } @@ -1835,3 +1844,21 @@ void RootLayer::empty_visible_regions(Layer *layer) 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); + } +}