We set the value of pending_lines to -n, which has the side effect of
ignoring any subsequent scroll up events before the next draw. Subtract
the scroll up quantity from the current value, instead.
We previously passed the root window to the root surface, however the
root surface could actually be smaller than the root window. This can
lead to confusing rendering because it was possible for children to be
rendered outside of their parent
Modify the handling and hit testing:
- Only widgets which have event handlers or capture handlers are
considered for the hit list
- The topmost widget is always the target. We used to consider the last
widget which handled the mouse as the target. Now we consider the
topmost the target. This lets us generate an explicit mouse_enter
event since we can determine this before sending events
- Modify relevant widgets to remove noopEventHandler and remove this
function entirely
- mouse_enter and mouse_leave events are based on how browsers determine
these events. Any widget hit this frame that was not hit last frame
gets a mouse_enter. Any widget which was hit last_frame but not this
frame gets a mouse_leave.
Follow-up to my previous patch; this fixes an issue where the mouse_leave
event was never sent because maybe_last_handler was only set when there
was already a maybe_last_handler widget set.
The change here makes it so that every time an event is consumed libvaxis
keeps track of which widget did that through the maybe_last_handler
variable.
In other words: we update maybe_last_handler every time an event is
explcitly consumed.
The MouseHandler used to only consume the mouse events if there was a
last_handler widget defined AND whoever is using the API set
ctx.consume_event to true.
This change makes it so the event is consumed when ctx.consume_event is
set to true, even if there is no last_handler widget defined.
Don't require that surfaces explicitly declare mouse handling. We either
pass an event to the eventHandler or we don't. Along with this, we
remove all native widget passthrough events (IE we never pass an event
to a child). Native widgets which don't handle events also set
eventHandler to null, which prevents any null pointer issues also
Move capture handling of events to a different method on Widget. Having
capturing phase in the same method makes it very easy to accidentally
capture an event, producing confusing results. Browsers and GTK both
require handlers to explicitly listen to capturing phase events, so
there is precedence for having this as a separate method. For
applications that want to handle it all within the same function, the
signature is the same so they can use the same function for both methods
and achieve the same result.
Check if the target mods have shift or caps lock, and uppercase our
codepoint if they do. Someday we will need to allocate zg.case_data to
handle all of unicode casing, but for now we handle ascii until we
figure out a nice way to plumb in case_data.
RichText is a general purpose text layout widget which can have more
than one style. This comes with a small performance penalty compared to
`Text` due to not being able to do the same index operations, however it
does support all of the same features
Text widget is a general purpose text layout widget. Includes support
for soft wrapping, ellipsis truncation, and text alignment. A single
style is applied to the entire widget area.
This was previously being developed at github.com/rockorager/vtk. I
really liked how it came together, and am moving it into the vaxis repo
piece by piece.