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:
parent
e86740b699
commit
b53cd0ef8f
@ -1267,10 +1267,25 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
|||||||
msg.Read<float>(&evt.wheel_delta_x);
|
msg.Read<float>(&evt.wheel_delta_x);
|
||||||
msg.Read<float>(&evt.wheel_delta_y);
|
msg.Read<float>(&evt.wheel_delta_y);
|
||||||
|
|
||||||
if (FocusWinBorder())
|
if (fLastMouseMoved != this)
|
||||||
{
|
{
|
||||||
BPoint cursorPos = GetDisplayDriver()->GetCursorPosition();
|
if (fLastMouseMoved->fOwner) // is a Layer object not a WinBorder one
|
||||||
FocusWinBorder()->MouseWheel(evt, cursorPos);
|
{
|
||||||
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@ -1609,7 +1624,7 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg)
|
|||||||
keymsg.AddInt32("modifiers", modifiers);
|
keymsg.AddInt32("modifiers", modifiers);
|
||||||
keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16);
|
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.AddInt32("modifiers", modifiers);
|
||||||
keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16);
|
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.AddInt32("be:old_modifiers", oldmodifiers);
|
||||||
keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16);
|
keymsg.AddData("states", B_UINT8_TYPE, keystates, sizeof(int8) * 16);
|
||||||
|
|
||||||
win->SendMessageToClient(&keymsg);
|
win->SendMessageToClient(&keymsg, B_NULL_TOKEN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,22 +271,8 @@ void WinBorder::MouseUp(click_type action)
|
|||||||
|
|
||||||
void WinBorder::MouseWheel(PointerEvent& evt, BPoint& ptWhere)
|
void WinBorder::MouseWheel(PointerEvent& evt, BPoint& ptWhere)
|
||||||
{
|
{
|
||||||
if (fTopLayer->fFullVisible.Contains(ptWhere))
|
// what should decorator do with mouse wheel message.
|
||||||
{
|
// maybe decorator should have some hook functions for mouse messages.
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets the decorator focus to active or inactive colors
|
//! Sets the decorator focus to active or inactive colors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user