Commit graph

11674 commits

Author SHA1 Message Date
Itamar c3c2fe153b LibCpp: Add "ignore invalid statements" option to Preprocessor
When we run the Preprocessor from the CppComprehensionEngine of
the language server, we don't want the preprocessor to crash if it
encounters an invalid preprocessor statement (for example, an #endif
statement without an accompanying previous #if statement).

To achieve this, this commit adds an "ignore_invalid_statements" flag
to the preprocessor which is set by the CppComprehensionEngine.

Fixes #11064.
2021-12-03 15:38:21 +01:00
Itamar 408f05bbb9 HackStudio: Decrease the maximal crash frequency of the server to 10 sec
The maximal crash frequency of the language server was previously 3
seconds, but in practice it was too high.
When working with larger projects the language server can get into a
"crash and respawn" loop that takes more than 3 seconds.

10 seconds seems like a reasonable threshold beyond which we no longer
attempt to respawn the server.
2021-12-03 15:38:21 +01:00
Itamar 28ff7d49ad HackStudio: Only send the content of open files to language server
When respawning the language server, we only need to send the content
of opened files to the server.

The on-disk content of files that are not currently open is up to
date, so the server can read them on its own.
2021-12-03 15:38:21 +01:00
Itamar 3e9a96f1d8 HackStudio: Add HackStudio::for_each_open_file 2021-12-03 15:38:21 +01:00
Martin Blicha 8fb52c6962 LibGUI: Make FilteringProxyModel reference-count its parent model
Before this change, the destructor of FilteringProxyModel
would crash if the parent model had been destroyed earlier.

This unifies the behaviour of FilteringProxyModel with
SortingProxyModel in this respect.
2021-12-02 22:43:54 +01:00
Idan Horowitz f415218afe Kernel+LibC: Implement sigaltstack()
This is required for compiling wine for serenity
2021-12-01 21:44:11 +02:00
Timothy Flynn bf79c73158 LibUnicode: Do not generate data for "generic" calendars
This is not a calendar supported by ECMA-402, so let's not waste space
with its data.

Further, don't generate "gregorian" as a valid Unicode locale extension
keyword. It's an invalid type identifier, thus cannot be used in locales
such as "en-u-ca-gregorian".
2021-12-01 16:36:26 +00:00
Timothy Flynn f02ecc1da2 LibUnicode: Fix copy-paste error in calendar_pattern_style_to_string
The string returned must be lowercase.
2021-12-01 16:36:26 +00:00
Timothy Flynn d2588d852b LibJS: Change all [[RelevantExtensionKeys]] to return constexpr arrays
There's no need to allocate a vector for this internal slot. Similar to
commit: bb11437792
2021-12-01 16:36:26 +00:00
Jelle Raaijmakers e27b077c2a LibGL: Add GL::present_context()
This provides a convenience method that performs the virtual resolution
for `::present` on the provided `GLContext`.
2021-12-01 12:35:08 +01:00
Jelle Raaijmakers bed0f3466a LibGL: Remove TextureUnit::unbind_texture() 2021-12-01 10:21:13 +01:00
Jelle Raaijmakers a4603fbc06 3DFileViewer: Add checkbox to disable texture 2021-12-01 10:21:13 +01:00
Jelle Raaijmakers 5788a139d8 LibGL: Implement texture unit texturing states 2021-12-01 10:21:13 +01:00
Hendiadyoin1 713a9ca5f1 LookupServer: Remove unused this capture in a lambda function
this was causing CI to fail
2021-11-30 16:15:52 -08:00
Andreas Kling 2e010db0a5 LibCpp: Update list of well-known C++ types to match current AK 2021-11-30 23:34:40 +01:00
Andreas Kling 9cd89f0085 LibCpp: Use StringView for the known keywords array 2021-11-30 23:34:40 +01:00
Andreas Kling fc0a040e5d CrashReporter: Remove unnecessary button height overrides from GML 2021-11-30 23:34:40 +01:00
Andreas Kling 85eb0eaad0 CrashReporter+HackStudio: Let's call it "Debug in Hack Studio"
"Inspect in Hack Studio" was a bit vague.
2021-11-30 23:34:40 +01:00
Andreas Kling d3bd9f1f0c HackStudio: Scope the "delete file from project" action to tree view
Otherwise it triggers when trying to delete characters in the editor.
2021-11-30 23:34:40 +01:00
Andreas Kling 354c4690d2 LibCore: Use LibCore syscall wrappers in get_password() 2021-11-30 23:34:40 +01:00
Andreas Kling 612eafea2c LibCore: Add syscall wrappers for tcgetattr() and tcsetattr() 2021-11-30 23:34:40 +01:00
Andreas Kling 2b0c2360bb KeyboardPreferenceLoader: Use Core::System::ioctl() 2021-11-30 23:34:40 +01:00
Andreas Kling fd2ea6923c top: Use Core::System::ioctl() 2021-11-30 23:34:40 +01:00
Andreas Kling 90aa1abfed LibCore: Add ioctl() syscall wrapper 2021-11-30 23:34:40 +01:00
Andreas Kling 9815ad556a fortune: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 8ba9a54310 lspci: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 74a6fb64b2 DHCPClient: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 6e7ff8cf1c netstat: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 2bb27184b4 KeyboardPreferenceLoader: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling fbeebce4e3 whoami: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling a93205199b AudioServer: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling cac3f3c81f top: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling e399835466 ChessEngine: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 6e2f7a15fb InspectorServer: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling fe00393941 LibCore: Change Core::LocalServer::on_ready_to_accept => on_accept
Everyone used this hook in the same way: immediately accept() on the
socket and then do something with the newly accepted fd.

This patch simplifies the hook by having LocalServer do the accepting
automatically.
2021-11-30 23:34:40 +01:00
Andreas Kling 6cb3092b42 WebContent: Remove unnecessary client map
WebContent processes only serve a single client, so we don't need to
keep a map of them.
2021-11-30 23:34:40 +01:00
Andreas Kling 314a687eeb ImageDecoder: Remove unnecessary client map
ImageDecoder processes only serve a single client, so we don't need to
keep a map of them.
2021-11-30 23:34:40 +01:00
Andreas Kling 8c8bf9433f LibIPC: Mark ClientConnection::die() as an override 2021-11-30 23:34:40 +01:00
Erik Biederstadt e052d647b7 Spreadsheet: Allow sheet renaming after double clicking on the tabwidget 2021-12-01 00:44:26 +03:30
Erik Biederstadt 0cfe446d3f LibGUI: Allow double clicking on tabwidgets 2021-12-01 00:44:26 +03:30
Linus Groh 5ca242ce30 LibJS/Tests: Fix typo in a test description 2021-11-30 20:42:04 +00:00
davidot 5010d4c20c LibJS: Don't match async \n function as an async function declaration 2021-11-30 17:05:32 +00:00
davidot c2ebaa9d87 LibJS: Replace the verify in private identifier with a syntax error
Since sometimes expressions are parsed without checking we can hit this
expression without it being followed by an 'in'.
2021-11-30 17:05:32 +00:00
davidot b7c7d54167 LibJS: Split parsing program to script and module separately
This allows us to only perform checks like export bindings existing only
for modules. Also this makes it easier to set strict and other state
variables with TemporaryChanges.
2021-11-30 17:05:32 +00:00
davidot 22174d3b7b LibJS: Rename in_async_function_context to await_expression_is_valid
Since await can be valid in module code which is not an async function
the old name is not really representative for the usage.
2021-11-30 17:05:32 +00:00
davidot 045a42cf35 LibJS: Parse dynamic import calls 'import()' and 'import.meta'
For now both just throw when executing but this can be implemented when
modules are implemented :^).
2021-11-30 17:05:32 +00:00
davidot 73eb29dabe LibJS: Lookahead for a period when parsing new.target
This allows us to skip saving and loading the state whenever we parse
'new'.
2021-11-30 17:05:32 +00:00
davidot 4d7e79fb72 LibJS: Stop parsing an expression on comma after a yield 2021-11-30 17:05:32 +00:00
davidot 156dfe3d62 LibJS: Disallow member expression in binding pattern as parameters 2021-11-30 17:05:32 +00:00
davidot 51e23cd043 LibJS: Disallow shorthand properties with reserved names 2021-11-30 17:05:32 +00:00
davidot e491fc0e81 LibJS: Allow defining class fields with "keyword" names 2021-11-30 17:05:32 +00:00
davidot cbbfcd35e7 LibJS: Disallow await keywords in static init blocks
In static init blocks 'await' cannot be used. Note that this does not
cover all the cases since the parser currently cannot distinguish
between expressions within parenthesis and direct expressions.
2021-11-30 17:05:32 +00:00
davidot 7624c3de0e LibJS: Disallow '\8' and '\9' in strict mode due to being octal escapes 2021-11-30 17:05:32 +00:00
davidot c57721cf83 LibJS: Allow escaped 'async' as identifier
Since 'async' is only special if it occurs before a function it can be
used as escaped identifier in all cases.
2021-11-30 17:05:32 +00:00
davidot e751dcea43 LibJS: Treat private identifier as divisible token
And also make sure private identifiers are correctly checked when
synthesizing a binding pattern.
2021-11-30 17:05:32 +00:00
davidot afde1821b5 LibJS: Disallow numerical separators in octal numbers and after '.' 2021-11-30 17:05:32 +00:00
davidot 32016d3924 LibJS: Allow object properties called 'async' 2021-11-30 17:05:32 +00:00
davidot 450dedabd1 LibJS: Add messages to the toEval and toEvalTo tests
This makes it a lot easier to understand what is going wrong when an
eval test fails. As an example instead of just getting:
`ExpectationError`
You would now get:
`ExpectationError: Expected _1_2E+0_1_ to eval to _12_ but got _120_`.
2021-11-30 17:05:32 +00:00
Timothy Flynn 7e6ad172a4 LibUnicode: Support code point names that apply to ranges of code points
For example, consider the following adjacent entries in UnicodeData.txt:

    3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
    4DBF;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;

Our current implementation would assign the display name "CJK Ideograph
Extension A" to code points U+3400 & U+4DBF, but not to the code points
in between. Not only should those code points be assigned a name, but
the Unicode spec also has formatting rules on what the names should be
(the names for these ranged code points are not as they appear in
UnicodeData.txt).

The spec also defines names for code point ranges that actually are
listed individually in UnicodeData.txt. For example:

    2F800;CJK COMPATIBILITY IDEOGRAPH-2F800;Lo;0;L;4E3D;;;;N;;;;;
    2F801;CJK COMPATIBILITY IDEOGRAPH-2F801;Lo;0;L;4E38;;;;N;;;;;
    2F802;CJK COMPATIBILITY IDEOGRAPH-2F802;Lo;0;L;4E41;;;;N;;;;;

Code points are only coalesced into a range if all fields after the name
are equivalent. Our parser will insert the range and its name formatting
pattern when it comes across the first code point in that range, then
ignore other code points in that range. This reduces the number of names
we generated by nearly 2,000.
2021-11-30 11:24:02 +01:00
scwfri dbd40e4c2a LibGUI: Implement vim motions for LeftBrace and RightBrace
In VimEditingEngine, implemented vim motions for Key_LeftBrace and
Key_RightBrace
2021-11-30 10:55:19 +01:00
Jelle Raaijmakers e187207610 Kernel: Register Virtio console ports with device management
Previously, Virtio console ports would not show up in `/sys/dev/char/`.
Also adds support to `SystemServer` to create more than one console
port device in `/dev/` in the multiport case.
2021-11-30 10:53:41 +01:00
Jelle Raaijmakers 2565f458d1 ClipboardHistory: Add debug dump action
This allows for easy dumping of clipboard data to the debug console.
2021-11-30 10:52:18 +01:00
thankyouverycool 298a6b9937 LibGUI+FontEditor: Allow ComboBox on_change callback to be toggled
When calling set_selected_index() on ComboBox, allow its on_change
callback to be disabled. Fixes FontEditor window state erroneously
switching to modified when initializing between different slopes
and weights.
2021-11-30 10:51:51 +01:00
thankyouverycool ca062d83db FontEditor: Convert to east const 2021-11-30 10:51:51 +01:00
thankyouverycool de77e28360 FontEditor: Correct member type and initialization in UndoGlyph
Makes code_point type u32, consistent with the rest of the system,
and properly initializes it.
2021-11-30 10:51:51 +01:00
thankyouverycool e3e3c03dca FontEditor: Remove unused Vector<String> 2021-11-30 10:51:51 +01:00
thankyouverycool ca77aea099 FontEditor: Correct NewFontDialog layout issues
Fixes incorrect scale initialization and inconsistent margins, sets
minimum values for glyph width and height to 1, and labels page 1
more precisely as "Typeface" properties.
2021-11-30 10:51:51 +01:00
thankyouverycool 9b184fc1cb FontEditor: Clean up GlyphMapWidget header
Fixes minor organizational inconsistency and zeroes initializations
for rows and columns as the previous values haven't been meaningful
since the map was converted to a scrollable widget. No functional
changes.
2021-11-30 10:51:51 +01:00
thankyouverycool 7d73d2dfc8 FontEditor: Remove superfluous 'this' pointers 2021-11-30 10:51:51 +01:00
thankyouverycool e29abc5395 LibGfx+FontEditor: Consolidate BitmapFont width and height limits
And make them more self-documenting. Previously these constraints
were duplicated across multiple files.
2021-11-30 10:51:51 +01:00
thankyouverycool 541f1de3a8 FontEditor: Add scaled offset members to GlyphEditor
Previously these were undescriptive globals making them a bit cryptic.
2021-11-30 10:51:51 +01:00
thankyouverycool aa09e40eb2 FontEditor: Update status bar on initialization
Fixes incorrect glyph status immediately after loading a new font.
2021-11-30 10:51:51 +01:00
thankyouverycool ae922c67fd FontEditor: Remove code duplication when resizing GlyphEditor
The left column now also enforces a minimum width to prevent especially
small fonts from hiding the glyph toolbars and width widgets.
2021-11-30 10:51:51 +01:00
thankyouverycool c1744822a1 FontEditor: Account for glyph width when pasting
Fixes glyphs not expanding up to their maximum width if necessary
when pasting larger glyphs into smaller ones.
2021-11-30 10:51:51 +01:00
thankyouverycool 281805696b FontEditor: Don't allow cutting and copying absent glyphs
And update status bar on cut. Fixes placing these effectless actions
on the undo stack.
2021-11-30 10:51:51 +01:00
thankyouverycool d2b211f14a FontEditor: Don't null check newly created NonnullRefPtr fonts 2021-11-30 10:51:51 +01:00
thankyouverycool 74938e6f42 FontEditor: Factor out redundant code for a request to close 2021-11-30 10:51:51 +01:00
thankyouverycool 1e052f5a91 FontEditor: Convert mode and transform buttons into toolbar actions
This will let us more easily organize and assign shortcuts to new
modes and transformations as they are built, and it generally looks
more polished as a uniform interface. Also adds a counterclockwise
option to the rotate action, moves Copy as Character to the edit
menu as it doesn't directly impact GlyphEditor, and makes the paint
and move modes exclusive checkables to make the editor's state more
visually obvious.
2021-11-30 10:51:51 +01:00
thankyouverycool 922e80e72b FontEditor: Simplify start-up
Previusly a cloned or newly loaded font was moved twice from main to
the constructor and then from constructor to an init routine where it
was finally used. The unmasked font is now moved only once, directly
to initialization, and redundant error checking is discarded.
2021-11-30 10:51:51 +01:00
thankyouverycool 56a8a2b493 FontEditor: Use LibUnicode to convert character case
Fixes characters beyond the Basic Latin code block not showing
their upper-case form in the preview window.
2021-11-30 10:51:51 +01:00
thankyouverycool edf86af4f4 LibGfx+FontEditor: Add helper to determine raw glyph presence
GlyphBitmaps are considered present if they have a width greater
than zero. This adds a counterpart method for raw (unmasked) glyphs
and makes intent more explicit throughout FontEditor.
2021-11-30 10:51:51 +01:00
Arne Elster cdaa179eeb LibCore: Fix relative seeking in IODevice
The recently introduced read buffer in IODevice broke relative seeking.
The amount of data in the buffer wouldn't get taken into account.
2021-11-30 10:51:10 +01:00
Timothy Flynn 1039159a6c LibJS: Change LargerOfTwoTemporalUnits AO to return a StringView 2021-11-30 00:01:07 +00:00
Luke Wilde 2cea4ad508 LibJS: Implement Temporal.Duration.prototype.subtract 2021-11-29 22:56:35 +00:00
Luke Wilde ac8c3919cb LibJS: Implement Temporal.Duration.prototype.add 2021-11-29 22:56:35 +00:00
Luke Wilde acf8729a81 LibJS: Implement Temporal.Duration.prototype.round 2021-11-29 22:56:35 +00:00
Timothy Flynn 4a08fd2be2 LibJS: Implement Intl.DateTimeFormat.prototype.resolvedOptions 2021-11-29 22:48:46 +00:00
Timothy Flynn d0e1997e07 LibJS: Implement Intl.DateTimeFormat.supportedLocalesOf 2021-11-29 22:48:46 +00:00
Timothy Flynn 6ad00088c0 js: Implement pretty-printing of Intl.DateTimeFormat 2021-11-29 22:48:46 +00:00
Timothy Flynn 16151aa7d5 LibJS+LibUnicode: Implement the Intl.DateTimeFormat constructor 2021-11-29 22:48:46 +00:00
Timothy Flynn 75b2a09a2f LibJS: Implement a nearly empty Intl.DateTimeFormat object
This adds plumbing for the Intl.DateTimeFormat object, constructor, and
prototype.

Note that unlike other Intl objects, the Intl.DateTimeFormat object has
a LibUnicode structure as a base. This is to prevent wild amounts of
code duplication between LibUnicode, Intl.DateTimeFormat, and other
not-yet-defined Intl structures, because there's 12 fields shared
between them.
2021-11-29 22:48:46 +00:00
Timothy Flynn 6dbdfb6ba1 LibUnicode: Add special handling of hour cycle (hc) Unicode keywords
For other keywords, allowed values per locale are generated at compile
time. But since the CLDR doesn't present hour cycles on a per-locale
basis, and hour cycles lookups depend on runtime data, we must handle
hour cycle keyword lookups differently than other keywords.
2021-11-29 22:48:46 +00:00
Timothy Flynn 48ce72e472 LibUnicode: Parse and generate regional hour cycles
Unlike most data in the CLDR, hour cycles are not stored on a per-locale
basis. Instead, they are keyed by a string that is usually a region, but
sometimes is a locale. Therefore, given a locale, to determine the hour
cycles for that locale, we:

    1. Check if the locale itself is assigned hour cycles.
    2. If the locale has a region, check if that region is assigned hour
       cycles.
    3. Otherwise, maximize that locale, and if the maximized locale has
       a region, check if that region is assigned hour cycles.
    4. If the above all fail, fallback to the "001" region.

Further, each locale's default hour cycle is the first assigned hour
cycle.
2021-11-29 22:48:46 +00:00
Timothy Flynn 7872934861 LibUnicode: Parse and generate available candidate format patterns
These formats are used by ECMA-402 when neither a date nor time style is
specified. In that case, these patterns are searched for a best match.
2021-11-29 22:48:46 +00:00
Timothy Flynn f471ecdbe9 LibUnicode: Parse and generate date, time, and date-time format patterns 2021-11-29 22:48:46 +00:00
Timothy Flynn 914675e826 LibJS+LibUnicode: Separate number formatting methods from Locale.h
Currently, we generate separate data files for locale and number format
related tables/methods, but provide public accessors for all of the data
in one Locale.h file. Rather than continuing this trend for date-time,
relative time, etc. formatting, it's a bit easier to reason about if the
public accessors are also in separate files.
2021-11-29 22:48:46 +00:00
Timothy Flynn bb11437792 LibJS: Change Intl's GetOption AO to accept a Span rather than a Vector
Allocating a Vector for each of these invocations is a bit silly when
the values are basically all compile-time arrays. This AO is used even
more heavily by Intl.DateTimeFormat, so change it to accept a Span to
reduce its cost.

This also adds an overload to accept a fixed-size C-array so callers do
not have to be prefixed with AK::Array, i.e. this:

    get_option(..., AK::Array { "a"sv, "b"sv }, ...);

Reduces to:

    get_option(..., { "a"sv, "b"sv }, ...);

(Which is how all call sites were already written to construct a Vector
in place).
2021-11-29 22:48:46 +00:00
Brian Gianforcaro 55aecf5381 LibDSP: Fix potential slicing issue in volume_from_envelope
Use pointer or reference to avoid slicing from "PitchedEnvelope"
to "Envelope". This was found by SonarCloud.
2021-11-29 14:19:31 -08:00
Brian Gianforcaro a225b26d88 LibCpp: Fix copy paste typo in Parser::match_secondary_expression
This was caught by SonarCloud.
2021-11-29 14:19:31 -08:00
Jelle Raaijmakers 61e4c09514 3DFileViewer: Set correct aspect ratio in view frustum 2021-11-29 22:11:41 +00:00
Hendiadyoin1 76e6ed0d75 LibGL: Mark SoftwareGLContext::gl_scissor as override
I do not know how this did not trigger CI up until now...
2021-11-29 23:17:05 +03:30
Hendiadyoin1 51cf35988b LibGfx: Link against LibIPC
Gfx::Color implements an IPC::[en|de]code function, but we did not
actually link against LibIPC to resolve the needed Symbols for that and
were relying on LibGui or others to link against it for us.

Having this linkage is unfortunate, but static inlining the functions in
question is sadly not possible, due needed includes leading the IPC
pipeline to initialize multiple times then, which leads to a compilation
error.
2021-11-29 23:17:05 +03:30
Hendiadyoin1 9e7c16d0a4 LibGfx: Load default font lazily
This is required when trying to use a Painter from lagom, due to
/res/font not being present
2021-11-29 23:17:05 +03:30
davidot e69276e704 LibJS: Implement parsing and executing for-await-of loops 2021-11-29 15:20:07 +00:00
davidot b3699029e2 LibJS: Implement the async versions of iterator operations
Since AsyncIteratorClose and IteratorClose differ only in that the async
version awaits the inner value we just implement them with an enum flag
to switch just that behavior.
2021-11-29 15:20:07 +00:00
davidot 064c8be627 LibJS: Add AsyncFromSyncIteratorPrototype and Async-From-Sync instances
Until we have actual iterator records we have to store the sync iterator
as the raw object.
2021-11-29 15:20:07 +00:00
davidot 0535c1abbd LibJS: Move the TRY_OR_REJECT macro to PromiseReaction
Also fixes that we ignored the result of the Call which we shouldn't
according to the spec.
2021-11-29 15:20:07 +00:00
davidot 7fd38eac98 LibJS: Add AsyncIteratorPrototype 2021-11-29 15:20:07 +00:00
Andreas Kling da42c1552c ImageDecoder: Fix assertion after failed decode
We were calling value() on an ErrorOr containing an error when trying
to extract the frame duration after a failed decode.

This fixes ImageDecoder crashing on various websites.
2021-11-29 13:21:27 +01:00
Jelle Raaijmakers dcc7d7d566 3DFileViewer: Improve FPS display
We only showed frame times down to the millisecond. Our FPS counter was
based off of that, allowing for a limited set of possible FPS values.

Convert these calculations to floating point so we get more useful FPS
and frame time values.
2021-11-29 11:44:01 +00:00
davidot f151a0d720 LibIPC: Mark m_sockfd as maybe_unused on non Serenity platforms 2021-11-29 01:46:28 -08:00
Andreas Kling ddce053f6c LibIPC: Replace u32/u64 value coders with u/ul/ull value coders
We can and should do more cleanups of this kind, but this is a quick fix
to unbreak the 32-bit HackStudio build.
2021-11-29 02:45:27 +01:00
Andreas Kling 16746efcf8 SpiceAgent: Port to LibMain :^) 2021-11-28 23:14:19 +01:00
Andreas Kling 83056efc1a LibCore: Add syscall wrapper for dup() 2021-11-28 23:14:19 +01:00
Andreas Kling cb9cac4e40 LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
2021-11-28 23:14:19 +01:00
Andreas Kling 8d76eb773f LibIPC: Make IPC::Connection::post_message() return ErrorOr 2021-11-28 23:14:18 +01:00
Andreas Kling 982ac34437 LibCore: Add syscall wrappers for sendfd() and recvfd() 2021-11-28 23:14:18 +01:00
Andreas Kling 86a3ef2709 LibIPC: Give MessageBuffer::fds some inline capacity (1)
This dodges a heap allocation when sending 0 or 1 fd across the IPC
boundary (which covers every message.)
2021-11-28 23:14:18 +01:00
kleines Filmröllchen 8608cd11e4 LibAudio: Optimize sample moves in FlacLoader
As long as possible, entire decoded frame sample vectors are moved into
the output vector, leading to up to 20% speedups by avoiding memmoves on
take_first.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 9c40311622 Utilites: Add abench utility
abench (audio benchmark) is an audio benchmarking utility that allows
testing decoder performance.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 96d02a3e75 LibAudio: New error propagation API in Loader and Buffer
Previously, a libc-like out-of-line error information was used in the
loader and its plugins. Now, all functions that may fail to do their job
return some sort of Result. The universally-used error type ist the new
LoaderError, which can contain information about the general error
category (such as file format, I/O, unimplemented features), an error
description, and location information, such as file index or sample
index.

Additionally, the loader plugins try to do as little work as possible in
their constructors. Right after being constructed, a user should call
initialize() and check the errors returned from there. (This is done
transparently by Loader itself.) If a constructor caused an error, the
call to initialize should check and return it immediately.

This opportunity was used to rework a lot of the internal error
propagation in both loader classes, especially FlacLoader. Therefore, a
couple of other refactorings may have sneaked in as well.

The adoption of LibAudio users is minimal. Piano's adoption is not
important, as the code will receive major refactoring in the near future
anyways. SoundPlayer's adoption is also less important, as changes to
refactor it are in the works as well. aplay's adoption is the best and
may serve as an example for other users. It also includes new buffering
behavior.

Buffer also gets some attention, making it OOM-safe and thereby also
propagating its errors to the user.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen ec8bd8116d LibAudio: Buffer API improvements
This consists of two changes: First, a utility function create_empty
allows the user to quickly create an empty buffer. Second, most creation
functions now return a NonnullRefPtr, as their failure causes a VERIFY
crash anyways.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 14d330faba LibAudio: Avoid frequent read() calls in FLAC residual decode
Decoding the residual in FLAC subframes is by far the most I/O-heavy
operation in FLAC decoding, as the residual data makes up the majority
of subframe data in LPC subframes. As the residual consists of many
Rice-encoded numbers with different bit sizes for differently large
numbers, the residual decoder frequently reads only one or two bytes at
a time. As we use a normal FileInputStream, that directly translates to
many calls to the read() syscall. We can see that the I/O overhead while
FLAC decoding is quite large, and much time is spent in the read()
syscall's kernel code.

This is optimized by using a Buffered<FileInputStream> instead, leading
to 4K blocks being read at once and a large reduction in I/O overhead.

Benchmarking with the new abench utility gives a 15-20% speedup on
identical files, usually pushing FLAC decoding to 10-15x realtime speed
on common sample rates.
2021-11-28 13:33:51 -08:00
Marcus Nilsson 5217202737 ThemeEditor: Use LibMain
Use the new serenity_main construct and TRY in ThemeEditor.
2021-11-28 10:10:35 -08:00
Marcus Nilsson c91eebfbaa Magnifier: Use LibMain
Use the new serenity_main construct and TRY in Magnifier.
2021-11-28 10:10:35 -08:00
Stephan Unverwerth cbf93ee687 LibGL: Initialize all GL context matrices with the identity matrix 2021-11-28 10:07:34 -08:00
Daniel Bertalan 87d548c520 LibC: Make SIZE_MAX be understood by the preprocessor
POSIX mandates that the macros contained in `stdint.h` be suitable for
use by the C preprocessor.

If we write `((size_t)-1)`, the C preprocessor will just skip the cast
and treat the value as `-1`. This means that we end up taking the wrong
branch in an `#if` directive like `#if SIZE_MAX > UINT32_MAX`.

This fixes building the LLVM port on i686.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 23adb7449f LibC: Fix stdint.h macros on x86_64
x86_64 is an LP64 platform, so its `uint64_t` type is defined to be
`unsigned long`, not `unsigned long long` like on i686. This means that
the `UL` literal suffix should be used instead of `ULL`.

Furthermore, `uintptr_t` is 64 bits wide on x86_64, so defining
`UINTPTR_MAX` to be `UINT32_MAX` is also not correct.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 4c0d868bb6 LibC: Add definition for ENOTRECOVERABLE
This is used by the LLVM port.
2021-11-28 09:38:57 -08:00
Jelle Raaijmakers bb58f6ccab LibGL: Implement glScissor() 2021-11-28 09:20:58 -08:00
Ali Mohammad Pur ccf713bf23 LibJS: Spin the event loop while waiting for async completion in await 2021-11-28 13:28:01 +00:00
Linus Groh f7ba81ac52 LibJS: Implement parsing of TemporalDurationString 2021-11-28 10:32:28 +00:00
Andreas Kling 60c132d7d3 LibGUI: Move GUI::SettingsWindow setup out of the constructor
In order to propagate errors that occur during UI setup, we have to move
all that logic out of widget/window subclass constructors. This is a
first attempt at doing that, for GUI::SettingsWindow.
2021-11-28 08:54:22 +01:00
Andreas Kling 56c4f0aff5 LibGUI: Add fallible variants of the GUI::Layout add/insert APIs 2021-11-28 08:54:22 +01:00
Andreas Kling acd4cc97fc KeyboardSettings: Remove some unnecessary pledge promises
This program doesn't need to create or write files directly.
2021-11-28 08:54:22 +01:00
Andreas Kling 45844f9338 LibGUI: Make GUI::SettingsWindow::add_tab() return ErrorOr
This allows us to use TRY() when creating settings UI.
2021-11-28 08:10:53 +01:00
Andreas Kling 7c19e86a50 TerminalSettings: Remove unnecessary pledges and unveils 2021-11-28 08:10:53 +01:00
Andreas Kling 6b862d5063 TerminalSettings: Port to LibMain :^) 2021-11-28 08:10:53 +01:00
Andreas Kling 8359975ff3 LibGUI: Make GUI::TabWidget tab creation APIs take String
Ultimately we'd like the caller to provide a String if possible (instead
of a StringView) as we're going to end up storing it.
2021-11-28 08:10:53 +01:00
Andreas Kling 8a11e986e5 MailSettings: Port to LibMain :^) 2021-11-28 08:10:53 +01:00
Andreas Kling 984cf1fe7a DisplaySettings: Port to LibMain :^) 2021-11-28 08:10:53 +01:00
Brian Gianforcaro cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Brian Gianforcaro 44ffe3e5bb LibCore: Allow System::pledge execpromises argument to be omitted
It appears that we don't have almost no cases of a callers passing
exec promises when they call `pledge()`. To simplify the code a bit we
add a default parameter that will pass nullptr for us to `pledge()`.
2021-11-28 08:04:57 +01:00
Brian Gianforcaro fcc00c9a27 LibCore+cat: Switch Core::System::read/write to take a Span of bytes
In the spirit of the Core::System name space having "modern" facades
for classically C functions / Kernel interfaces, it seems appropriate
that we should take Span's of data instead of raw pointer + length
arguments.
2021-11-28 08:04:57 +01:00
Brian Gianforcaro eb896aa33e Settings: Convert to TRY + serenity_main(..) 2021-11-28 08:04:57 +01:00
Linus Groh 908d943e85 LibJS: Parse TemporalInstantString as part of TemporalCalendarString 2021-11-27 23:54:38 +00:00
Linus Groh 8f99c05f97 LibJS: Implement Temporal.PlainYearMonth.prototype.since() 2021-11-27 19:11:31 +00:00
Linus Groh bdd2c357fd LibJS: Implement Temporal.PlainYearMonth.prototype.until() 2021-11-27 19:11:31 +00:00
Linus Groh 6f2e0b3355 LibJS: Implement Temporal.PlainYearMonth.prototype.subtract() 2021-11-27 17:48:04 +00:00
Linus Groh acbcd64cdc LibJS: Implement Temporal.PlainYearMonth.prototype.add() 2021-11-27 17:48:04 +00:00
Pedro Pereira d748f2bea2 Spider: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira 206847c37d Solitaire: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira d2e9b122e0 Snake: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira 498d8bf1d7 Pong: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira aa2bc6fd47 Minesweeper: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira 1211a3a3f3 Hearts: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira ee3b14fc38 GameOfLife: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira 2f5f53d1cf FlappyBug: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira 45e29d58e2 Chess: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira 5caa9311d7 Breakout: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
Pedro Pereira d56e4d5145 2048: TRY() all the things in serenity_main() :^) 2021-11-27 17:18:44 +01:00
kleines Filmröllchen 1ff48a3ca4 Terminal: Modernize terminal settings as a standalone application
The settings for Terminal are extracted into their own application,
TerminalSettings, which is reachable over the normal Settings menu as
well as the same place in the Terminal menu. The font settings are moved
into these settings as well, which are now split up into the "Terminal"
and "View" tabs. The font settings themselves receive an option to
override the selected font with the system default on the user side.
The live update behavior of all of the terminal settings is retained.

The layout of the new TerminalSettings is based around the other
Settings applications, but pixel-perfectness is missing in some places.
It's a bit fiddly and I'd like to have some better GUI::Label auto-size
behavior, but oh well :^)
2021-11-27 12:45:44 +01:00
kleines Filmröllchen 1e9554145e LibGUI: Add a cancel button callback to settings window tabs
Some settings tabs, like the ones on the upcoming terminal settings,
need to know when the cancel button is pressed to clean up things like
temporary live updates. Therefore, the SettingsWindow::Tab now features
a cancel_settings callback which does not need to be implemented.
2021-11-27 12:45:44 +01:00
Brian Gianforcaro 72e9d024b9 Settings: Fix launch of settings dialog
There was a bug report on discord where someone mentioned that
launching the keyboard settings always crashed. When looking
at the backtrace it became clear we were calling down the
`AppFile::executable()` path on uninitialized memory.

We can fix this by using the "official" API for obtaining data
from the GUI ModelIndex, instead of casting random memory to
the object type we expect it to be. :^)

Validated this fixes the issue for me locally.
2021-11-27 11:24:31 +01:00
Kenneth Myhra f25466ae08 bt: Port to LibMain :^) 2021-11-27 11:14:16 +01:00
Kenneth Myhra 951d8a06d8 LibCore: Add syscall wrapper for gethostname() 2021-11-27 11:14:16 +01:00
Kenneth Myhra 8c4625e3b1 asctl: Port to LibMain :^) 2021-11-27 11:14:16 +01:00
Kenneth Myhra 880888fcc7 aplay: Port to LibMain 2021-11-27 11:14:16 +01:00
Kenneth Myhra 494f177d22 allocate: Port to LibMain :^) 2021-11-27 11:14:16 +01:00
Marcus Nilsson 67f349be46 PixelPaint: Keep a RefPtr to offset_text_box in EditGuideDialog
Keep a RefPtr to offset_text_box in EditGuideDialog instead of using
a local pointer. Previously the lambda in ok_button.on_click() would
outlive the local variable causing a crash.
2021-11-27 11:04:48 +01:00
Brian Gianforcaro f807796380 UserspaceEmulator: Fix after add_positional_argument API change :^)
Get UE compiling again after the Vector<String> API was changed to
Vector<StringView>.
2021-11-26 16:47:39 -08:00
Idan Horowitz 957f54d96f LibJS: Throw InternalErrors instead of Errors on CallStackSizeExceeded
These seem more appropriate.
2021-11-27 01:58:05 +02:00
Andreas Kling 7341faceeb cat: Remove accidentally-committed unused macro 2021-11-27 00:48:44 +01:00
Andreas Kling 1ded1ed963 Run: Port to LibMain :^) 2021-11-26 23:27:57 +01:00
Andreas Kling 0b8fb8358e cp: Port to LibMain :^) 2021-11-26 23:27:57 +01:00
Andreas Kling f1cc3d0fc4 Userland: Use Core::ArgsParser's Vector<StringView> API everywhere
...and remove the Vector<String> variant since there are no remaining
users of this API.
2021-11-26 23:27:57 +01:00
Andreas Kling 395ba619d8 LibCore: Add Vector<StringView> variant of add_positional_argument() 2021-11-26 23:27:57 +01:00
Andreas Kling 5bf6503ed1 cat: Use TRY() and LibCore syscall wrappers a lot more :^) 2021-11-26 23:27:57 +01:00
Sam Atkins 377a984905 Settings: Make sure settings are listed in alphabetical order
DirectoryIterator, and so `Desktop::AppFile::for_each()`, doesn't
guarantee anything about the order, so we manually sort afterwards.
Which means using a manual version of NonnullRefPtrVector, since that
doesn't support `quick_sort()`.
2021-11-26 22:14:56 +01:00
Sam Atkins 705b7fc407 Browser: Allow custom search engine URLs that don't start http[s]:// 2021-11-26 22:14:56 +01:00
Sam Atkins a1e1405f26 BrowserSettings: Add some icons for it :^) 2021-11-26 22:14:56 +01:00
Sam Atkins c22b0bb8b2 Browser+Base: Delete provided Browser.ini file
Having files in Base's user `.config` folder means that every time the
Serenity image is built, all user settings in that file are thrown away.
So, let's not do that! :^)

Modified the default value for the homepage url to match what was in
Browser.ini, so there is no visible change.
2021-11-26 22:14:56 +01:00
Sam Atkins e84b3e7110 BrowserSettings: Implement restoring default values 2021-11-26 22:14:56 +01:00
Sam Atkins f2b8ae7d86 BrowserSettings: Add preferred-color-scheme setting 2021-11-26 22:14:56 +01:00
Sam Atkins 11466c5316 BrowserSettings: Add setting for search engine 2021-11-26 22:14:56 +01:00
Sam Atkins e927048754 Browser: Move search engine definitions to a json file
This both makes them configurable, and means that we can read them from
other applications, such as BrowserSettings. :^)
2021-11-26 22:14:56 +01:00
Sam Atkins 1933076143 Browser+BrowserSettings: Persist the "show bookmarks bar" setting
Previously this setting was only temporary, but we now save/load it from
the config file.
2021-11-26 22:14:56 +01:00
Sam Atkins 8a284be5c7 BrowserSettings: Create a BrowserSettings application :^)
Browser has a bunch of settings, but most are non-trivial to add here.
So far, these are implemented:

- Homepage URL
- Whether to close download windows when they complete

The others will be added in subsequent commits.
2021-11-26 22:14:56 +01:00
Karol Kosek 20191b58e2 DisplaySettings: Update wallpaper config path only on success
The Window Server is ignoring incorrect files since 235f39e449, so let's
not update the config when that happens and an error message instead!
2021-11-26 11:30:55 -08:00
Karol Kosek e56ffd11ce DisplaySettings: Always save the background color to the config
Previously, you could notice that the background color isn't being
updated when you picked a small bitmap image with the 'center' mode.
2021-11-26 11:30:55 -08:00
Karol Kosek 65f3a259d2 WindowServer: Clear wallpaper if the requested path is empty
235f39e449 secretly added an if check that ignores all the files that
couldn't be loaded into bitmaps.  Unfortunately, we send an empty path
as a way to unset the wallpaper, which meant that we couldn't go back
to the default background color anymore.
2021-11-26 11:30:55 -08:00
Federico Guerinoni 4a90729a3e HackStudio: Port to LibMain :^) 2021-11-26 11:13:59 -08:00
Kenneth Myhra 98e65f71da echo: Port to LibMain :^) 2021-11-25 21:41:46 +01:00
Kenneth Myhra d7336879d1 basename: Port to LibMain 2021-11-25 21:41:12 +01:00
Kenneth Myhra 430e231f5e copy: Port to LibMain :^) 2021-11-25 21:41:02 +01:00
Kenneth Myhra 507de4bc1d cat: Port to LibMain :^) 2021-11-25 21:40:52 +01:00
Ralf Donau 1c59cfa28c SystemMonitor: Remove unveiling /tmp/portal/config 2021-11-25 08:50:31 +01:00
pbrw 4d03852190 WidgetGallery: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw bd61558ed8 Starfield: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 9e3bc3f930 Screensaver: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00