All keyboard messages now go to BWindow's preferred handler. Also, mouse wheel messages go to the BView under mouse.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12396 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-04-14 21:42:32 +00:00
parent e86740b699
commit b53cd0ef8f
2 changed files with 23 additions and 22 deletions

View File

@ -1267,10 +1267,25 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
msg.Read<float>(&evt.wheel_delta_x);
msg.Read<float>(&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);
}
}

View File

@ -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