diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 3220a244ff..e7e75e78fa 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -1267,10 +1267,25 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) msg.Read(&evt.wheel_delta_x); msg.Read(&evt.wheel_delta_y); - if (FocusWinBorder()) + if (fLastMouseMoved != this) { - BPoint cursorPos = GetDisplayDriver()->GetCursorPosition(); - FocusWinBorder()->MouseWheel(evt, cursorPos); + if (fLastMouseMoved->fOwner) // is a Layer object not a WinBorder one + { + if (fLastMouseMoved->fOwner->fTopLayer != fLastMouseMoved) // must not be the top_view's counterpart + { + BMessage wheelmsg(B_MOUSE_WHEEL_CHANGED); + wheelmsg.AddInt64("when", evt.when); + wheelmsg.AddFloat("be:wheel_delta_x",evt.wheel_delta_x); + wheelmsg.AddFloat("be:wheel_delta_y",evt.wheel_delta_y); + + fLastMouseMoved->Window()->SendMessageToClient(&wheelmsg, fLastMouseMoved->fViewToken, false); + } + } + else + { + // TODO: WinBorder::MouseWheel() should dissapear or get other params! + // ((WinBorder*)fLastMouseMoved)->MouseWheel(...) + } } break; } @@ -1609,7 +1624,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg) keymsg.AddInt32("modifiers", modifiers); keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16); - win->SendMessageToClient(&keymsg); + win->SendMessageToClient(&keymsg, B_NULL_TOKEN, true); } } @@ -1645,7 +1660,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg) keymsg.AddInt32("modifiers", modifiers); keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16); - win->SendMessageToClient(&keymsg); + win->SendMessageToClient(&keymsg, B_NULL_TOKEN, true); } } @@ -1679,7 +1694,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg) keymsg.AddInt32("be:old_modifiers", oldmodifiers); keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16); - win->SendMessageToClient(&keymsg); + win->SendMessageToClient(&keymsg, B_NULL_TOKEN, true); } } diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index d4e24d9709..5da3a22ed1 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -271,22 +271,8 @@ void WinBorder::MouseUp(click_type action) void WinBorder::MouseWheel(PointerEvent& evt, BPoint& ptWhere) { - if (fTopLayer->fFullVisible.Contains(ptWhere)) - { - Window()->Lock(); - // TODO: you can improve performance by doing this search client-side! - Layer *target = LayerAt(evt.where); - if (target && target != fTopLayer) - { - BMessage wheelmsg(B_MOUSE_WHEEL_CHANGED); - wheelmsg.AddInt64("when",evt.when); - wheelmsg.AddFloat("be:wheel_delta_x",evt.wheel_delta_x); - wheelmsg.AddFloat("be:wheel_delta_y",evt.wheel_delta_y); - - Window()->SendMessageToClient(&wheelmsg); - } - Window()->Unlock(); - } + // what should decorator do with mouse wheel message. + // maybe decorator should have some hook functions for mouse messages. } //! Sets the decorator focus to active or inactive colors