Commit graph

26003 commits

Author SHA1 Message Date
Andreas Kling
13f4890c38 LibCore: Make Core::File::open() return OSError in case of failure 2021-08-20 15:31:46 +02:00
Andrew January
1474a537b6 DisplaySettings: Lazily load wallpapers
Load the wallpaper in a background action instead of on the main thread.

This reduces the time to first paint, and makes the UI feel more
responsive when clicking on wallpaper thumbnails.

The behavior of the method is changed slightly to return true if it
succesfully "loads" the empty path. This makes the API a little more
consistent, where "true" means "I made changes" and "false" means "I did
not make changes". No call sites currently use the return value, so no
changes are needed to those.
2021-08-20 15:31:22 +02:00
Andrew January
ac055554f6 LibGUI: Reduce amount we init for FileIconProvider::filetype_image_icon
Instead of loading every icon, only load the filetype image icon if it
hasn't been already. This icon is used by IconViews that need to lazily
load thumbnails, which don't need any of the other icon types.

Spending the time to load the unneeded images was causing delays to
first paint in BackgroundSettings.
2021-08-20 15:31:22 +02:00
Karol Kosek
947b61c1de HackStudio: Update the window title after changing a file name
This is a very similar fix as the previous commit, but here it's
due to my oversight when I was adding an 'Save as..' feature.
2021-08-20 11:47:00 +02:00
Karol Kosek
6e64988396 HackStudio: Update the window title after changing an active editor
Prior this change, the window title was updated only when a new file
has been opened, which means that it wasn't updated when user selected
an already opened file in the split view.

This change updates the title whenever the active editor changes.
In addition, this title update logic has now its own function
as it'll also be used in the next commit. :)
2021-08-20 11:47:00 +02:00
Timothy Flynn
ddfd4cced7 CI: Set on-target test timeout to 60 minutes
The on-target pipelines have a timeout of 6 hours to allow time for a
clean toolchain + Serenity build. Tests should time out much sooner than
that though.
2021-08-20 10:34:52 +02:00
Timothy Flynn
25ae1f7f72 CI: Include a timestamp in the Azure ccache key
Caches on Azure are immutable - so if a cache changes, but its key does
not, then the cache is not updated. Include a timestamp in the ccache
key so that we always push an updated cache from the master branch. Then
use a subkey without the timestamp to pull the cache.

We use a similar trick on GitHub Actions.
2021-08-20 10:34:52 +02:00
Andreas Kling
8fce5caa49 LibGUI: Pass context menu events through normal event dispatch
Previously we'd synthesize an event and invoke context_menu_event()
directly. This prevented the event from bubbling even if ignored.
2021-08-20 01:27:39 +02:00
Andreas Kling
20b104dead WidgetGallery: Remove menubar 2021-08-20 01:27:39 +02:00
Idan Horowitz
cf271183b4 Kernel: Make Process::current() return a Process& instead of Process*
This has several benefits:
1) We no longer just blindly derefence a null pointer in various places
2) We will get nicer runtime error messages if the current process does
turn out to be null in the call location
3) GCC no longer complains about possible nullptr dereferences when
compiling without KUBSAN
2021-08-19 23:49:53 +02:00
Timothy Flynn
1259dc3623 LibJS: Allow Unicode escape sequences in identifiers
For example, "property.br\u{64}wn" should resolve to "property.brown".

To support this behavior, this commit changes the Token class to hold
both the evaluated identifier name and a view into the original source
for the unevaluated name. There are some contexts in which identifiers
are not allowed to contain Unicode escape sequences; for example, export
statements of the form "export {} from foo.js" forbid escapes in the
identifier "from".

The test file is added to .prettierignore because prettier will replace
all escaped Unicode sequences with their unescaped value.
2021-08-19 23:49:25 +02:00
Timothy Flynn
c5b5c779ff LibRegex+LibJS: Change capture group names from a String to a FlyString
The parser now stores this as a FlyString everywhere, so consumers can
also use it as a FlyString.
2021-08-19 23:49:25 +02:00
Timothy Flynn
4f2cbe119b LibRegex: Allow Unicode escape sequences in capture group names
Unfortunately, this requires a slight divergence in the way the capture
group names are stored. Previously, the generated byte code would simply
store a view into the regex pattern string, so no string copying was
required.

Now, the escape sequences are decoded into a new string, and a vector
of all parsed capture group names are stored in a vector in the parser
result structure. The byte code then stores a view into the
corresponding string in that vector.
2021-08-19 23:49:25 +02:00
Timothy Flynn
6131c0485e LibRegex: Use GenericLexer to consume escaped code points 2021-08-19 23:49:25 +02:00
Timothy Flynn
5ff9596678 LibRegex: Convert regex::Lexer to inherit from GenericLexer
This will allow regex::Lexer users to invoke GenericLexer consumption
methods, such as GenericLexer::consume_escaped_codepoint().

This also allows for de-duplicating common methods between the lexers.
2021-08-19 23:49:25 +02:00
Timothy Flynn
dd44a5e948 LibJS: Use GenericLexer to consume escaped code points 2021-08-19 23:49:25 +02:00
Timothy Flynn
fd8ccedf2b AK: Add GenericLexer API to consume an escaped Unicode code point
This parsing is already duplicated between LibJS and LibRegex, and will
shortly be needed in more places in those libraries. Move it to AK to
prevent further duplication.

This API will consume escaped Unicode code points of the form:
    \\u{code point}
    \\unnnn (where each n is a hexadecimal digit)
    \\unnnn\\unnnn (where the two escaped values are a surrogate pair)
2021-08-19 23:49:25 +02:00
Timothy Flynn
02e3633b7f AK: Move FormatParser definition from header to implementation file
This is primarily to be able to remove the GenericLexer include out of
Format.h as well. A subsequent commit will add AK::Result to
GenericLexer, which will cause naming conflicts with other structures
named Result. This can be avoided (for now) by preventing nearly every
file in the system from implicitly including GenericLexer.

Other changes in this commit are to add the GenericLexer include to
files where it is missing.
2021-08-19 23:49:25 +02:00
Timothy Flynn
e331656bb9 AK: Add GenericLexer to forwarding header 2021-08-19 23:49:25 +02:00
Andreas Kling
961f727448 Kernel: Consolidate a bunch of i386/x86_64 code paths
Add some arch-specific getters and setters that allow us to merge blocks
that were previously specific to either ARCH(I386) or ARCH(X86_64).
2021-08-19 23:22:02 +02:00
Kenneth Myhra
3f5a42b3dd LibC: Add FNM_NOMATCH to fnmatch.h
Adding FNM_NOMATCH fixes the currently broken curl port.
2021-08-19 22:27:26 +02:00
fladd
1de104c6c4 LibCore: Fix build error in File.cpp on macOS
struct stat on macOS doesn't have st_atim.tv_sec and therefore broke the
Lagom build. Replacing it with st_atime fixes that.
2021-08-19 19:47:34 +01:00
Idan Horowitz
ee608f58ee LibJS: Add type range checks to the Date make_day AO
As the specification says "but if this is not possible (because some
argument is out of range), return NaN."
2021-08-19 19:15:00 +01:00
Idan Horowitz
95bc8e4641 LibCore: Make DateTime's members signed
Core::DateTime is essentially a C++ wrapper of the tm struct, so we
should support the same signed range as the underlying tm.
2021-08-19 19:15:00 +01:00
Andrew Kaster
332b29c741 LibTest+Utilities: Print a start message before each test in run-tests
It can sometimes be difficult to tell from the debug.log and test stdout
which test was the last to run before the test runner hangs or exits the
QEMU instance unexpectedly.

Print out a start message before each test is executed, along with a
progress message indicating which test out of how many tests we're about
to run.
2021-08-19 18:42:34 +02:00
Jesse Buhagiar
6666230d3e Kernel/USB: Remove unused free function from QueueHead
This function is no longer required as the freeing is done
inside of the controller class through the pool interface.
2021-08-19 18:42:07 +02:00
Jesse Buhagiar
3f94857e7c Kernel/USB: Harden Descriptor memory allocation
The previous version of this was pretty bad and caused a lot of
odd behevaiour to occur. We now abstract a lot of the allocation
behind a `template`d pool class that handles all of the memory
allocation.
2021-08-19 18:42:07 +02:00
Jesse Buhagiar
ebb0d3e0eb Kernel/USB: Remove unused include from UHCIController.cpp 2021-08-19 18:42:07 +02:00
Jesse Buhagiar
4abf399a74 Kernel/USB: Move UHCI related structures to subdirectory
The number of UHCI related files is starting to expand to the point
where it's best if we move this into their own subdirectory. It'll
also make it easier to manage when we decide to add some more
controller types (whenever that may be)
2021-08-19 18:42:07 +02:00
Itamar
43392c567e HackStudio: Fix "navigate to include"
This fixes an off-by-one error in the "navigate to include" feature
of HackStudio.
2021-08-19 17:20:37 +02:00
Itamar
9ae98bc81b LibCpp: Handle circular imports gracefully
This patch prevents CppComprehensionEngine from endlessly looping when
there's a circular #include in the code.

We now keep track of the set of currently processed files, and will not
re-process a file if it already exists in this set.
When we're done with processing a file it is removed from this set.

The pragma once directive is not yet implemented, but regardless a
mechanism that prevents #include loops even in the absence of
pragma once is desired.
2021-08-19 17:20:37 +02:00
Jesse Buhagiar
68d895eb7c LibGL: Don't crash on invalid pname value in glGetFloatv
This brings `glGetFloatv` more inline with the other `glGet`
functions. We should prevent crashing in the driver as much as
possible and instead let the application deal with the generated
GL error.
2021-08-19 17:08:04 +02:00
Brian Gianforcaro
ca9619c750 Meta: Explicitly configure source directory in debug-kernel.sh
Previously debug-kernel.sh wouldn't detect source if you launched the
script from the wrong path. By explicitly setting the name, source will
be loaded by gdb in all situations.
2021-08-19 11:42:20 +02:00
Edward Palmer
abccb45060 Kernel: Move set_metadata_dirty calls to notify_watchers 2021-08-19 10:41:54 +02:00
Brian Gianforcaro
8e41d96618 AK: Enable IntrusiveList self reference to be optimized out when empty
If a member is an empty class, the standard normally stats that it needs
to have a size of at least 1 byte in order to guarantee that the
addresses of distinct objects of the same type are always distinct.

However as of c++20, we can use [[no_unique_address]] to instruct the
compiler that if the member has an empty type, it may optimize it to
occupy no space.
2021-08-19 08:07:45 +04:30
Linus Groh
0e201fbb42 LibJS: Implement Temporal.PlainDate.prototype.toJSON() 2021-08-19 00:26:09 +01:00
Linus Groh
73d888e9e6 LibJS: Implement Temporal.PlainDate.prototype.toLocaleString() 2021-08-19 00:23:48 +01:00
Linus Groh
402f04c2fc LibJS: Implement Temporal.PlainDate.prototype.toString() 2021-08-19 00:14:17 +02:00
Linus Groh
310192f918 LibJS: Make Temporal's get_option() take a PropertyName directly
Instead of constructing a String and converting that to a PropertyName
on the fly, we can just leverage CommonPropertyNames, add a couple more
and directly pass ready-to-use PropertyNames with pre-allocated Strings.
2021-08-19 00:14:17 +02:00
sin-ack
705e5a3d87 WindowServer: Only clear the hovered item if the item was enabled
Otherwise, we emit a menu_item_left to the WindowServer client even
though the mouse never left the menu item (as is the case when a
disabled menu item is clicked).
2021-08-19 00:11:42 +02:00
sin-ack
d8fd4eee9b LibGUI: Move common action definitions to CommonActions.cpp
This makes Action.cpp itself only talk about the Action object, and
makes it easier to navigate.
2021-08-19 00:11:42 +02:00
Linus Groh
092f924cfd LibJS: Reflect naming consistency editorial changes in the Temporal spec
See:

- https://github.com/tc39/proposal-temporal/commit/2aa7dce
- https://github.com/tc39/proposal-temporal/commit/13daa33
- https://github.com/tc39/proposal-temporal/commit/8085873
2021-08-18 23:03:22 +01:00
Stephan Unverwerth
c4de2bb5e5 LibGL: Leave render loop early if color mask empty 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
addbcd42d7 LibGL: Fix triangle winding calculation
Since we operate in screen space where y points down we need to reverse
what is considered clock wise and what is considered counter clockwise.

The rasterizer always expects triangles with a consistent winding order
thus swap 2 vertices if necessary to reverse the winding before passing
the triangle on to the rasterization stage.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
220ac5eb02 LibGL: Fix clipping and interpolate vertex attributes
The previous clipping implementation was problematic especially when
clipping against the near plane. Triangles are now correctly clipped
using homogenous coordinates against all frustum planes.

Texture coordinates and vertex colors are now correctly interpolated.
The earier implementation was just a placeholder.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
39ff1459f8 LibGL: Improve texture sampling performance
GL_NEAREST: Remove unnecessary modulo. UV is always in range due to
wrapping.
GL_LINEAR: Rewrite filter equation to save a few math operations.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
59998ff0b2 LibGL: Return white texel when sampling uninitialized texture 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
894d81c1b8 LibGL: Complete glGetString implementation
GL_VERSION: The spec mandates the following format: x.y or x.y.z
optionally followed by text separated by space.

GL_EXTENSIONS: Return empty string. We do not support any extensions.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
5b9c87a8b5 LibGL: Implement glDepthFunc 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
a97dbd2317 LibGL: Implement glDepthRange 2021-08-18 20:30:58 +02:00