Introducing a new event system architecture in Nux 1.0
The event processing in Nux needed to change for Unity. The
previous architecture was no longer fitting. The new system is, I
believe, less complex than the previous one, and it leaves a lot
of dead code that will be progressively removed.
The heart of the new architecture is in these functions:
- ::FindAreaUnderMouse
- Area::TestMousePointerInclusion
- WindowCompositor::MouseEventCycle
- WindowCompositor::KeyboardEventCycle
InputArea::OnEvent is no longer needed. That function was too
large and too complex. Now, when you create a new widget and you
need to implement FindAreaUnderMouse, all you have to do is find
the Area that is just below the mouse pointer.
There are a few things you have to do for the system to work
smoothly. You have to make sure that all widgets have a parent:
- When a widget is added to a layout, the layout becomes it
parent. You have nothing to do in this case.
- If you have a Button widget inside another MyWidget class,
and you don’t add that button to MyWidget’s layout, then you
need to call button->SetParentObject(this) for the button
to become a child of the MyWidget object.
- To un-parent a widget, call UnParentObject. For now do not
call UnParentObject on a widget that is in a layout. Always
match a call to UnParentObject with a previous call to
SetParentObject.
How does this affect Unity?
The changes required in Unity where not substantial. However,
there are some pending issues:
- There is a regression in the Dash keyboard navigation. You
cannot use the left, right, down and up keys to navigate from
widget to widget in the Dash.
- You have to click on the text entry in the Dash search area
before you can enter some text.
- DnD (drag and drop) is not working.
- There is a regression in the speed of the Dash scrolling.
I have probably missed a few more regressions; please report them.
These pending issues will be resolved as quickly as possible. The
keyboard event architecture needs more development and feedback
from the team is needed to make it efficient and robust.
On the positive side, keyboard navigation in the launcher (Alt+F1)
and Quicklist is ok.
If you have pending branches that still rely on the previous event
architecture, let me know and we will port them to the new system.
Personal Note
Thank you all for your feedbacks. And thank you for taking Nux to
its 1.0.1 release.