Handling crashes synchronously is finicky since we're modifying the
m_client_state struct while in a callback lambda owned by it.
Let's avoid all the footguns here by simply using deferred_invoke()
and handling the crash on next event loop iteration instead.
Also, only mark the menu bar item as opened if a menu was actually
opened through the menu bar.
These changes allow a menu to be used both in the menu bar as well
as a context menu.
Fixes#5469
Because re-evaluation of the hovered window may trigger sending a
MouseMove event to a window we should only wake it if the mouse
position actually has changed.
For example, navigating File Manager to a directory that contains a vaild BMP file that
uses a palette, this code would end up trying to create an indexed thumbnail.
However, Painter asserts that the thumbnail that we paint on is *not* indexed,
usually crashing File Manager.
Partially fixes#5299, as it now crashes somewhere else.
A window repaint may change the alpha value, resulting in a different
hit test outcome. In those cases, re-evaluate the cursor hit testing
after a window was painted, and update the cursor if needed.
This should really be a WindowProxy? but since we don't have anything
representing that concept yet, let's just expose the Window object
directly so document.defaultView.foo works. :^)
This is an improved version of WrapperGenerator's snake_name(), which
seems like the kind of thing that could be useful elsewhere but would
end up getting duplicated - so let's add this to AK::String instead,
like to_{lowercase,uppercase}().
Most of the functions under FileUtils were removed, except those which
dealt with file deletion, as they spawned MessageBoxes for errors, as
such, those functions were written in terms of Core::File::remove.
FileManager, cp, mv, rm had some duplicated code, implementing basic
file management operations. This patch creates adds functions that try
to provide an interface suited for all these programs, but this patch
does not make them be used throughout the Userland.
They are added to Core::File following the example of functions such as
read_link/real_path_for.
- We've already computed the number of fds * sizeof(pollfd), so use it
instead of needlessly doing it again.
- Use fds_copy.data() instead off address of indexing the vector.
Don't fire the on_terminal_size hook while we're in relayout.
This fixes the terminal window flopping around during interactive
resizing. (It was mostly noticeable if something else was hogging
the CPU at the same time.)
The `default_signal_action(u8 signal)` function already has the
full mapping. The only caveat being that now we need to make
sure the thread constructor and clear_signals() method do the work
of resetting the m_signal_action_data array, instead or relying on
the previous logic in set_default_signal_dispositions.