Commit graph

32756 commits

Author SHA1 Message Date
Ali Mohammad Pur 95b8c1745a AK: Make Variant::visit() prefer overloads accepting T const& over T&
This makes the following code behave as expected:

    Variant<int, String> x { some_string() };
    x.visit(
        [](String const&) {}, // Expectation is for this to be called
        [](auto&) {});
2022-01-14 11:35:40 +03:30
Ali Mohammad Pur 9de33629da AK+Everywhere: Make Variant::visit() respect the Variant's constness
...and fix all the instances of visit() taking non-const arguments.
2022-01-14 11:35:40 +03:30
Idan Horowitz d55c130df5 SystemMonitor: Split multi-core CPU usage graphs into multiple rows
This looks much nicer than the current cramped single-row solution.
2022-01-14 01:02:50 +01:00
Mustafa Quraish 7974fee800 PixelPaint: Inherit from AbstractZoomPanWidget 2022-01-14 01:02:34 +01:00
Mustafa Quraish b21d128075 ImageViewer: Inherit from AbstractZoomPanWidget 2022-01-14 01:02:34 +01:00
Mustafa Quraish 5d7f2086b0 LibGUI: Add AbstractZoomPanWidget widget :^)
This is an abstract widget that is meant to handle all the panning /
zooming functionality so that all applications implementing it do
not have to try to do their own coordinate math.
2022-01-14 01:02:34 +01:00
Andreas Kling 4d0abf82ed Tests: Remove some temporary files when finished using them
Leaving files in /tmp uses memory, which accumulates over time if you do
something weird like leaving `run-tests` going all day long. :^)
2022-01-14 00:20:30 +01:00
Andreas Kling 0e08763483 Kernel: Wrap much of sys$execve() in a block scope
Since we don't return normally from this function, let's make it a
little extra difficult to accidentally leak something by leaving it on
the stack in this function.
2022-01-13 23:57:33 +01:00
Andreas Kling 0e72b04e7d Kernel: Perform exec-into-new-image directly in sys$execve()
This ensures that everything allocated on the stack in Process::exec()
gets cleaned up. We had a few leaks related to the parsing of shebang
(#!) executables that get fixed by this.
2022-01-13 23:57:33 +01:00
Timothy Flynn c7dbe27781 LibJS: Handle the [[LanguageDisplay]] tag when localizing languages 2022-01-13 23:05:31 +01:00
Timothy Flynn c86f7a675d LibUnicode: Do not limit language display names to known locales
Currently, the UnicodeLocale generator collects a list of known locales
from the CLDR before processing language display names. For each locale,
the identifier is broken into language, script, and region subtags, and
we create a list of seen languages. When processing display names, we
skip languages we hadn't seen in that first step.

This is insufficient for language display names like "en-GB", which do
not have an locale entry in the CLDR, and thus are skipped. So instead,
create the list of known languages by actually reading through the list
of languages which have a display name.
2022-01-13 23:05:31 +01:00
Timothy Flynn b0671ceb74 LibUnicode: Add a method to combine locale subtags into a display string
This is just a convenience wrapper around the underlying generated APIs.
2022-01-13 23:05:31 +01:00
Timothy Flynn 91acc2e9c5 LibUnicode: Parse and generate locale display patterns
These patterns indicate how to display locale strings when that locale
contains multiple subtags. For example, "en-US" would be displayed as
"English (United States)".
2022-01-13 23:05:31 +01:00
Idan Horowitz cfb9f889ac LibELF: Accept Span instead of Pointer+Size in validate_program_headers 2022-01-13 22:40:25 +01:00
Idan Horowitz 3e959618c3 LibELF: Use StringBuilders instead of Strings for the interpreter path
This is required for the Kernel's usage of LibELF, since Strings do not
expose allocation failure.
2022-01-13 22:40:25 +01:00
Idan Horowitz fb3e46e930 Kernel: Make map_typed() & map_typed_writable() fallible using ErrorOr
This mostly just moved the problem, as a lot of the callers are not
capable of propagating the errors themselves, but it's a step in the
right direction.
2022-01-13 22:40:25 +01:00
Idan Horowitz e2e5d4da16 Kernel: Make map_bios() and map_ebda() fallible using ErrorOr 2022-01-13 22:40:25 +01:00
Marcus Nilsson ae5f5a4d50 Base: Add icon for palette files 2022-01-13 20:24:26 +01:00
Linus Groh 64f125fe34 LibJS: Mark CreateTemporalTimeZone("UTC") as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/ea25cfa
2022-01-13 19:25:56 +01:00
Kenneth Myhra 2255e8859c Ports/mc: Add Midnight Commander port 2022-01-13 18:46:22 +01:00
Kenneth Myhra 965b772f70 LibC: Remove TODO() macros to not break mc port
The TODO() macro crashes the port Midnight Commander on start-up.
2022-01-13 18:46:22 +01:00
Kenneth Myhra 99f315bda1 LibC: Add definition for PRIxMAX 2022-01-13 18:46:22 +01:00
Kenneth Myhra 0a3c2d5a8f Ports/vim: Bump version number to 8.2.4066 2022-01-13 18:46:22 +01:00
Marcus Nilsson 56be956eb5 Base: Fix non-compliant PNG icons
These were found with pngcheck and includes icons that were made
with PixelPaint. All were re-saved with GIMP and then stripped with
optipng.
2022-01-13 17:59:58 +01:00
Marcus Nilsson 6523f03d47 LibGfx: Change return type of Adler32 checksums in PNGWriter
The two Adler32 checksums are u16 and these two getters were mistakenly
left as u32 when PNGChunk::add_as_big_endian() was templated leading
to corrupted IDAT fields in our PNGs.
2022-01-13 17:59:58 +01:00
Andreas Kling 8ad46fd8f5 Kernel: Stop leaking executable path in successful sys$execve()
Since we don't return from sys$execve() when it's successful, we have to
take special care to tear down anything we've allocated.

Turns out we were not doing this for the full executable path itself.
2022-01-13 16:15:37 +01:00
Andreas Kling 611733af0d WindowServer: Don't try to flash menubar in deleted windows
Capture the window weakly when setting up the menubar flash timer.
2022-01-13 16:15:37 +01:00
Lady Gegga c53486b9ce Meta: Add Xexxa's name to the contributors list 2022-01-13 13:56:00 +01:00
Timothy Flynn 4875ec26dd LibJS: Implement per-locale display of calendars and date-time fields 2022-01-13 13:43:57 +01:00
Timothy Flynn adb762ee48 LibJS: Add FIXME regarding [[LanguageDisplay]] internal slot handling
This is supposed to work as follows (grabbed from SpiderMonkey):

    > opt = { type: "language", languageDisplay: "dialect" };
    > new Intl.DisplayNames([], opt).of("en-US");
    "American English"

    > opt = { type: "language", languageDisplay: "standard" };
    > new Intl.DisplayNames([], opt).of("en-US");
    "English (United States)"

We currently display the "dialect" variant. We will need to figure out
how to display the "standard" variant. I think the way it works is that
we take the display names of "en" (language) and "US" (region) and
format them according to this pattern in localeDisplayNames.json:

    "localeDisplayNames": {
        "localeDisplayPattern": {
            "localePattern": "{0} ({1})",
        },
    },

But I'd like to confirm this before implementing it.
2022-01-13 13:43:57 +01:00
Timothy Flynn 8126cb2545 LibJS+LibUnicode: Remove unnecessary locale currency mapping wrapper
Before LibUnicode generated methods were weakly linked, we had a public
method (get_locale_currency_mapping) for retrieving currency mappings.
That method invoked one of several style-specific methods that only
existed in the generated UnicodeLocale.

One caveat of weakly linked functions is that every such function must
have a public declaration. The result is that each of those styled
methods are declared publicly, which makes the wrapper redundant
because it is just as easy to invoke the method for the desired style.
2022-01-13 13:43:57 +01:00
Timothy Flynn 0d75949827 LibUnicode: Parse and generate locale display names for date fields 2022-01-13 13:43:57 +01:00
Timothy Flynn 7f162c471d LibUnicode: Parse and generate locale display names for calendars
Note there's a bit of an unfortunate duplication in the calendar enum
generated by UnicodeLocale and the existing enum generated by
UnicodeDateTimeFormat. The former contains every calendar known to the
CLDR, whereas the latter contains the calendars we've actually parsed
for DateTimeFormat (currently only Gregorian). The new enum generated
here can be removed once DateTimeFormat knows about all calendars.
2022-01-13 13:43:57 +01:00
Timothy Flynn 1a3e6e8a7b LibJS: Add [[LanguageDisplay]] to Intl.DisplayNames's resolvedOptions 2022-01-13 13:43:57 +01:00
Timothy Flynn 27c845eef2 js: Pretty-print the Intl.DisplayNames [[LanguageDisplay]] internal slot 2022-01-13 13:43:57 +01:00
Timothy Flynn 71f7e67a20 LibJS: Parse new Intl.DisplayNames "type" and "languageDisplay" options
Intl.DisplayNames v2 adds "calendar" and "dateTimeField" types, as well
as a "languageDisplay" option for the "language" type. This just adds
these options to the constructor.
2022-01-13 13:43:57 +01:00
Timothy Flynn 853ccab9af LibJS: Remove unnecessary braces in Intl.DisplayNames
Just caught my eye as I was modifying this code.
2022-01-13 13:43:57 +01:00
DavidLindbom c6f3856d4f man.serenityos.org: Include Games section on index page 2022-01-13 13:43:51 +01:00
sin-ack aedb013ee3 LibIMAP+Userland: Convert LibIMAP::Client to the Serenity Stream APIs
You now cannot get an unconnected LibIMAP::Client, but you can still
close it. This makes for a nicer API where we don't have a Client object
in a limbo state between being constructed and being connected.

This code still isn't as nice as it should be, as TLS::TLSv12 is still
not a Core::Stream::Socket subclass, which would allow for consolidating
most of the TLS/non-TLS code into a single implementation.
2022-01-13 15:16:12 +03:30
sin-ack 53e9d757fe test-imap: Convert test-imap to LibMain 2022-01-13 15:16:12 +03:30
sin-ack 5f645e84d8 LibCore: Use Error::from_errno in Stream APIs
This makes Stream APIs work with Lagom and is overall cleaner.
2022-01-13 15:16:12 +03:30
sin-ack dbd25916a3 LibCore+Userland+Tests: Convert Stream APIs to construct on heap
As per previous discussion, it was decided that the Stream classes
should be constructed on the heap.

While I don't personally agree with this change, it does have the
benefit of avoiding Function object reconstructions due to the lambda
passed to Notifier pointing to a stale object reference. This also has
the benefit of not having to "box" objects for virtual usage, as the
objects come pre-boxed.

However, it means that we now hit the heap everytime we construct a
TCPSocket for instance, which might not be desirable.
2022-01-13 15:16:12 +03:30
sin-ack eb389db92c LibCore: Remove the SocketError class
SocketError is a relic from the KResult days when we couldn't have a
string in the KResult type, only an errno. Now that we can use string
literals with Error, it's no longer necessary. gai_strerror is thread
safe, so we can use it here unlike strerror.
2022-01-13 15:16:12 +03:30
sin-ack 28063de488 AK: Add ByteBuffer::{must_,}get_bytes_for_writing()
This is useful for writing new data at the end of a ByteBuffer. For
instance, with the Stream API:

    auto pending_bytes = TRY(stream.pending_bytes());
    auto receive_buffer = TRY(buffer.get_bytes_for_writing(
        pending_bytes));
    TRY(stream.read(receive_buffer));
2022-01-13 15:16:12 +03:30
sin-ack 9569841589 AK: Use Error::from_errno in adopt_nonnull_own_or_enomem
This fails to build on Lagom otherwise.
2022-01-13 15:16:12 +03:30
David Lindbom 1e773256bf Snake: Add link to help pages in menu 2022-01-13 03:45:17 -08:00
David Lindbom fff9547d9b Base: Add manual page for Snake 2022-01-13 03:45:17 -08:00
David Lindbom 3a197eea92 Pong: Add link to help pages in menu 2022-01-13 03:45:17 -08:00
David Lindbom aa231a1580 Base: Add manual page for Pong 2022-01-13 03:45:17 -08:00
David Lindbom ae6d326388 Minesweeper: Add link to help pages in menu 2022-01-13 03:45:17 -08:00