If an ELF application contains sections called "serenity_icon_s"
or "serenity_icon_m" then parse these as PNG images and use them
for the 16x16 and 32x32 executable file icons respectively.
If the application is not an ELF binary, the sections do not
exist, the sections are not valid PNGs, or the file cannot be read
then the default application icon will be used.
Problem:
- `(void)` simply casts the expression to void. This is understood to
indicate that it is ignored, but this is really a compiler trick to
get the compiler to not generate a warning.
Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.
Note:
- Functions taking a `(void)` argument list have also been changed to
`()` because this is not needed and shows up in the same grep
command.
This patch replaces the UI-from-JSON mechanism with a more
human-friendly DSL.
The current implementation simply converts the GML into a JSON object
that can be consumed by GUI::Widget::load_from_json(). The parser is
not very helpful if you make a mistake.
The language offers a very simple way to instantiate any registered
Core::Object class by simply saying @ClassName
@GUI::Label {
text: "Hello friends!"
tooltip: ":^)"
}
Layouts are Core::Objects and can be assigned to the "layout" property:
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
spacing: 2
margins: [8, 8, 8, 8]
}
}
And finally, child objects are simply nested within their parent:
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
}
@GUI::Button {
text: "OK"
}
@GUI::Button {
text: "Cancel"
}
}
This feels a *lot* more pleasant to write than the JSON we had. The fact
that no new code was being written with the JSON mechanism was pretty
telling, so let's approach this with developer convenience in mind. :^)
Just like the other event handler functions, handle_resize_event()
shouldn't assume that the window has a main widget (which is being
resized in this case).
Fixes#4450.
Let's make SelectionBehavior a view concept where views can either
select individual items (row, index) or whole rows. Maybe some day
we'll do whole columns, but I don't think we need that now.
This is a rather ugly hack just to get app icons to show up in the
FileManager. It would be a lot nicer to embed icons in executables
instead but it's not obvious to me how to do that.
Instead of symlinks showing up with the "filetype-symlink" icon, we now
generate a new icon by taking the target file's icon and slapping a
small arrow emblem on top of it.
This looks rather nice. :^)
If a hook triggers the deletion of the GUI::Button, we would be unable
to proceed in a well-defined manner here, so let's protect ourselves.
This probably needs to be done in a whole lot of places, since GUI
widgets are just ref-counted Core::Objects and running arbitrary code
can mean that they get deleted.
Instead of TextEditor knowing about the ComboBox button on the right
hand side, we now make ComboBox inherit from GUI::Frame, and make the
inner text editor widget frameless.
This allows us to place the button ourselves inside ComboBox without
any frame artifacts, and TextEditor no longer needs to keep track of
the geometry of that button.
The focus_dependent_delete_action that sits in the file manager's
toolbar would always remain enabled, even if nothing was selected,
activating it if nothing was selected would then crash the application.
The action is now correctly enabled/disabled, but due to the way
selection works in TreeViews, something is always selected, what really
matters is if the TreeView has something selected, and it has focus.
As it currently stands, there is no way to know when the TreeView's
is_focused status changes. In order for this to work I added a callback
to the Widget class which fires when a widget receives or looses focus.
In that callback, the focus_dependent_delete_action's enabled value is
recalculated.
Sometimes an action should be disabled and the KeyEvent not posted to
the app's event loop nonetheless. In other words the action swallows the
KeyEvent without being activated.
Specific use-case: Terminal's Ctrl+Shift+{C,V}.
We need to call waitpid until no more waitable children are available.
This is necessary because SIGCHLD signals may coalesce into one when
multiple children terminate almost simultaneously.
Also, switch to EventLoop's asynchronous signal handling mechanism,
which allows more complex operations in the signal handler.
When `DontInvalidIndexes` is passed, be optimistic and keep the old
indices when the model validates them.
This is currently fine, as the group of models that use
DontInvalidateIndexes use it as "The old indices are still ok" (there's
a note about this in ProcessModel.cpp).
Previously GUI::Actions which were constructed without initializing
m_shortcut could be activated via an invalid GUI::Shortcut.
Steps to reproduce:
It was possible to enable TextEditor's markdown preview by pressing
Ctrl or Alt (Cmd/Ctrl) keys, which should not happen, as this Action
did not specify a shortcut.
This fix should apply to all other cases where actions where declared
without specifying a shortcut.