mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 02:46:49 +00:00
fix Propagation mousewheel event in game
Propagation mousewheel event was introduce to have the opportunity to parent handle this event if an only if the child doenst handle and the parent set a handler for that event. The error foundedd by elexis inside a game relay on the message waw propagated outsie IGUIObjects to CGUI.cpp that shouldnt be at the beggin. I forget to stop the propagation when all objects in the tree was validated, because of that the message was propagate to CGUI.cpp andd then hanle by camera. the fix suggest to only propagate the event in the GUI tree, not outside the GUI tree
This commit is contained in:
@@ -415,8 +415,13 @@ InReaction IGUIObject::SendMouseEvent(EGUIMessageType type, const CStr& eventNam
|
||||
|
||||
// inform to parents until get to the root object
|
||||
// for now only wheel events are inform to parents
|
||||
if (GetParent() && (type == GUIM_MOUSE_WHEEL_UP || type == GUIM_MOUSE_WHEEL_DOWN || type == GUIM_MOUSE_WHEEL_LEFT || type == GUIM_MOUSE_WHEEL_RIGHT) && msg.skipped)
|
||||
msg.Skip(GetParent()->SendMouseEvent(type, eventName) == IN_PASS);
|
||||
if ((type == GUIM_MOUSE_WHEEL_UP || type == GUIM_MOUSE_WHEEL_DOWN || type == GUIM_MOUSE_WHEEL_LEFT || type == GUIM_MOUSE_WHEEL_RIGHT) && msg.skipped)
|
||||
{
|
||||
if (GetParent())
|
||||
msg.Skip(GetParent()->SendMouseEvent(type, eventName) == IN_PASS);
|
||||
else
|
||||
msg.Skip(false);
|
||||
}
|
||||
|
||||
return msg.skipped ? IN_PASS : IN_HANDLED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user