Commit graph

15110 commits

Author SHA1 Message Date
Linus Groh 51bcfb5a44 Meta: Update lint-{clang-format,shell-scripts}.sh to take a list of files
This should speed up pre-commit a bit as only files that are staged will
be processed, and clang-format and shellcheck are only invoked once, not
for every file. When no arguments are given (e.g. on CI), it still uses
'git ls-files'.
2020-12-27 21:25:27 +01:00
Linus Groh a56b3cbf7c Meta: Set 'pipefail' option correctly in shell scripts
This needs '-o' to work correctly. Also update the shebang to bash in
some scripts as shellcheck was complaining about pipefail not being a
POSIX shell thing otherwise.
2020-12-27 21:25:27 +01:00
Linus Groh 5122f98198 Base+LibJS+LibWeb: Make prettier clean
Also use "// prettier-ignore" comments where necessary rather than
excluding whole files (via .prettierignore).
2020-12-27 21:25:27 +01:00
Andreas Kling 76239f89c2 LibGUI: Select the edited text by default in StringModelEditingDelegate
This way, if you press F2 to edit the name of an item, the name will be
selected in the editor that pops up, and you can start typing a new
name for it immediately.
2020-12-27 19:08:19 +01:00
Andreas Kling f294bdedcc LibGUI: Make IconView return a larger content rect for editing
This fixes a visual glitch where editing the name of an item in an
IconView would cut off the edited text.
2020-12-27 19:05:43 +01:00
Andreas Kling 04f1f74b85 LibGUI+WindowServer: Tweak hover shadows slightly
Move the shadow 1 more pixel away from the unhovered icon location,
making a total 2 pixel distance between the icon and the shadow.
Also tweak the shadow color to be a darkened variant of the base color
underneath the icon.
2020-12-27 18:43:34 +01:00
Linus Groh fe6a312714 Base+Playground: Add app-playground.png 16x16 and 32x32 icons 2020-12-27 18:36:43 +01:00
Linus Groh 2e7395d6da LibGUI: Include LibGfx/Bitmap.h in Icon.h
It doesn't compile with just the forwarding headers when nothing else
(e.g. Button.h) pulls in Bitmap.h.
2020-12-27 18:36:43 +01:00
Linus Groh dc55fbeb79 Playground: Pre-populate the text editor with some GML
The text editor is now populated with some very basic GML after startup:

    @GUI::Widget {
        layout: @GUI::VerticalBoxLayout {
        }

        // Now add some widgets!
    }

Less typing, less intimidating! :^)
2020-12-27 18:36:43 +01:00
Linus Groh 999e3f87a9 Base: Add Playground.af 2020-12-27 18:36:43 +01:00
Linus Groh e955c024b2 LibCore: Add Object::remove_all_children() 2020-12-27 18:36:43 +01:00
Andreas Kling ddaedbca87 Kernel: Allow sys$rename() to rename symlinks
Previously, this syscall would try to rename the target of the link,
not the link itself.
2020-12-27 15:38:07 +01:00
Andreas Kling 3499ac4b54 Base: Flip shortcut emblem icons horizontally
Make the little arrows point towards the large icon instead of away
from it. This feels like an obviously better visual clue that they're
pointers *to* something.
2020-12-27 15:33:47 +01:00
Andreas Kling 590fd45461 Terminal: Tweak settings window layout slightly
Make it a little taller so we can see the focus rect around the radio
buttons when they are focused.
2020-12-27 15:29:13 +01:00
Andreas Kling 00cfc25688 Base: Add some default desktop icons
I just picked three apps at random: Browser, TextEditor and Help.
This should make it a bit more visible that we have a working desktop.
2020-12-27 14:51:08 +01:00
Andreas Kling 55e990cbc4 FileManager: Layout the desktop icons from top-to-bottom :^)
This looks way nicer than left-to-right!
2020-12-27 14:48:12 +01:00
Andreas Kling 8b31833650 LibGUI: Support top-to-bottom flow in IconView
Sometimes you might want your icons to flow from top-to-bottom instead
of from left-to-right. :^)
2020-12-27 14:48:12 +01:00
Andreas Kling 0117c57418 LibGUI: Move some large IconView internal helpers to the .cpp file
Stuff that's only used internally by the class is nice to keep out of
the header when possible.
2020-12-27 14:48:12 +01:00
Brian Gianforcaro 815d39886f Kernel: Tag more methods and types as [[nodiscard]]
Tag methods at where not obvserving the return value is an obvious error
with [[nodiscard]] to catch potential future bugs.
2020-12-27 11:09:30 +01:00
Brian Gianforcaro 21a5524d01 AK: Add NO_DISCARD macro to allow clang-format friendly class annotations
clang-format seems to barf on these attributes, to make it easier to
use these attributes and have clang-format not mangle the following code
we can hide them behind a macro so clang-format doesn't have to handle it.
2020-12-27 11:09:30 +01:00
Nathan Lanza 33834090bb
Documentation: Update macOS build instructions cask invocation (#4561)
brew deprecated `brew cask` and requires `brew install --cask` instead
2020-12-27 01:18:15 +01:00
Tom f1534ff36e Kernel: Take into account the time keeper's frequency (if no HPET)
The PIT is now also running at a rate of ~250 ticks/second, so rather
than assuming there are 1000 ticks/second we need to query the timer
being used for the actual frequency.

Fixes #4508
2020-12-27 01:17:50 +01:00
Andreas Kling 0e2b7f9c9a Kernel: Remove the per-process icon_id and sys$set_process_icon()
This was a goofy kernel API where you could assign an icon_id (int) to
a process which referred to a global shbuf with a 16x16 icon bitmap
inside it.

Instead of this, programs that want to display a process icon now
retrieve it from the process executable instead.
2020-12-27 01:16:56 +01:00
Andreas Kling cb68b8ff8b LibGUI: Use FileIconProvider in RunningProcessesModel
This was the last remaining client of the per-process icon_id.
2020-12-27 01:16:56 +01:00
Andreas Kling 2e846631a8 SystemMonitor: Fetch process icons from their executable
Instead of using the extremely hackish icon_id field in /proc/all,
we now retrieve process icons from their executable by using
GUI::FileIconProvider.
2020-12-27 01:16:56 +01:00
Andreas Kling 21ccbc2167 Kernel: Expose process executable paths in /proc/all 2020-12-27 01:16:56 +01:00
Andreas Kling 87492e723b Kernel: Lock target process when generating core dump
Dumping core can happen at the end of a profiling run, and in that case
we have to protect the target process and take the lock while iterating
over its region map.

Fixes #4509.
2020-12-27 01:16:56 +01:00
Linus Groh 4395e1b240 paste: Don't read past clipboard data buffer size
ByteBuffer is not null-terminated (anymore), this is another one of
those bugs.
Also use the new format functions while we're here.

Fixes #4558.
2020-12-27 01:11:42 +01:00
Tom 74fa894994 Kernel: Remove subheap from list before removing memory
When the ExpandableHeap calls the remove_memory function, the
subheap is assumed to be removed and freed entirely. remove_memory
may drop the underlying memory at any time, but it also may cause
further allocation requests. Not removing it from the list before
calling remove_memory could cause a memory allocation in that
subheap while remove_memory is executing. which then causes issues
once the underlying memory is actually freed.
2020-12-26 19:55:01 +01:00
Andreas Kling 2588b14d38 DevTools: Add a simple GML Playground application :^)
This app allows you to edit GML and see the results live. Pretty cool!
2020-12-26 19:04:46 +01:00
Itamar ec33e57f32 CMake: Generate SONAME attribute for shared objects
Previosuly, generation of the SONAME attribute was disabled.
This caused libraries to have relative paths in DT_NEEDED attributes
(e.g "Libraries/libcore.so" instead of just "libcore.so"),
which caused build errors when the working directory during build was
not $SERENITY_ROOT/Build.

This caused the build of ports that use libraries other than libc.so
to fail (e.g the nesalizer port).

Closes #4457
2020-12-26 17:38:39 +01:00
AnotherTest 7b5aa06702 Kernel: Allow 'elevating' unveil permissions if implicitly inherited from '/'
This can happen when an unveil follows another with a path that is a
sub-path of the other one:
```c++
unveil("/home/anon/.config/whoa.ini", "rw");
unveil("/home/anon", "r"); // this would fail, as "/home/anon" inherits
                           // the permissions of "/", which is None.
```
2020-12-26 16:10:04 +01:00
Andreas Kling 3be9a9ac76 LibTLS: Fix TLS breakage after ByteBuffer => Span conversion
Oops, I accidentally shadowed the outer scope's "decrypted" ByteBuffer
which caused us to throw away the buffer too early.

Fixes #4533.
2020-12-26 16:09:02 +01:00
Andreas Kling bdff88d8d5 LibGUI: Make the LinkLabel widget keyboard-friendly
Make it tab-focusable and activate it with the return key. :^)
2020-12-26 16:09:02 +01:00
Brendan Coles 6b6594e3d0 MenuApplets: Username: init app early, pledge early, do not unveil /tmp 2020-12-26 15:18:12 +01:00
Sergey Bugaev 738f5f4d66 SystemServer: Set HOME for services
Fixes https://github.com/SerenityOS/serenity/issues/4484
2020-12-26 14:23:29 +01:00
Sergey Bugaev 95157f8b81 SystemServer: Port to Core::Account
We now have a handy Core::Account class that we can use instead of iterating
over the passwd database ourselves.
2020-12-26 14:23:29 +01:00
Andreas Kling 7babe5ade6 LibGUI: Set LinkLabel tooltip if text can't fit the widget
We were setting a tooltip when the text overflowed the *window* width,
make this more general by basing it on the *widget* width.
2020-12-26 13:17:57 +01:00
Andreas Kling 4e084793df LibGUI: Tweak GUI::Label API a bit and add did_change_text() virtual 2020-12-26 13:11:43 +01:00
Andreas Kling 9fe310c470 LibGUI: Minor tweaks to the GUI::LinkLabel
Remove some unnecessary includes and make the constructor private.
2020-12-26 13:07:53 +01:00
Andreas Kling 5452c8a566 LibGUI: Rename Link => LinkLabel 2020-12-26 13:03:38 +01:00
Andreas Kling 788594c0c2 Profiler: Show the name & PID of process being profiled
Also tweak the GUI a little bit to look nicer.
2020-12-26 12:58:50 +01:00
AnotherTest 1c9d28d212 AK: Fix busted Trie test
This wasn't testing anything ^^'
2020-12-26 12:32:27 +01:00
AnotherTest ad646420dd AK: Make AK::IsSame<T, U>::value a constexpr bool
It being an enum value was preventing it from being used without `!!` in
requires clauses (bool also makes more sense anyway).
2020-12-26 12:32:27 +01:00
AnotherTest a9184fcb76 Kernel: Implement unveil() as a prefix-tree
Fixes #4530.
2020-12-26 11:54:54 +01:00
AnotherTest cb3348191b AK: Add a prefix tree implementation
`AK::Trie` can be keyed by any given hashable type, and can store any
metadata (including nothing at all).
Also adds a test.
2020-12-26 11:54:54 +01:00
AnotherTest 3dcdee75be Meta: Make lint-shell-scripts.sh happy
`${FAILURES}` -> `"${FAILURES}"`
2020-12-26 11:54:54 +01:00
Andreas Kling bd47957c3a Profiler: Show a GUI message box with the error when profiling fails
This came up in @jonathandturner's video walking through the system
and playing with things: https://www.youtube.com/watch?v=TtV86uL5oD4

At one point, he tried profiling his Terminal app, and since the
Terminal was completely idle while profiling, no samples were captured
and there was no profile to show.

Make sure we propagate any error when loading the profile, and show it
in a GUI message box instead of stderr. :^)
2020-12-26 10:27:57 +01:00
Lenny Maiorani b2316701a8 Everywhere: void arguments to C functions
Problem:
- C functions with no arguments require a single `void` in the argument list.

Solution:
- Put the `void` in the argument list of functions in C header files.
2020-12-26 10:10:27 +01:00
Sahan Fernando b990fc5d3a LibC: Enable compiler warnings for scanf and strftime format strings 2020-12-26 10:05:50 +01:00