Commit graph

32559 commits

Author SHA1 Message Date
Timothy Flynn
2b5840296a AK: Add AK::Time factory method to construct from individual time fields 2022-01-11 23:56:35 +01:00
Timothy Flynn
548643bcc9 AK: Redeclare a few AK::Time helpers as constexpr
This is to allow using these methods within an upcoming constexpr
factory method.
2022-01-11 23:56:35 +01:00
Jelle Raaijmakers
c7e021c1f1 Ports: Add GLTron
The patches mainly convert this SDL1 game to SDL2. It has some
graphical artifacts, but it's playable!
2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
1c2e07d42a LibGL: Set q parameter for glTexCoord to 1 by default
According to the manual, if `q` is not specified, it is 1.
2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
260663567a LibGL: Implement glTexCoord2i 2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
17ec433326 LibSoftGPU: Only render complete primitives
Previously, we were expecting triangles and quads to consist of
complete sets of vertices. However, a more common behavior is to ignore
all vertices that do not make up a full primitive. For example, OpenGL
specifies for `GL_QUADS`:

  "The total number of vertices between Begin and End is 4n + k, where
   0 ≤ k ≤ 3; if k is not zero, the final k vertices are ignored."

This changes the behavior of `Device::draw_primitives()` to both return
early if no full set of vertices was provided, and to ignore any
additional vertices that are not part of a full set.
2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
69eb3b0838 LibGL: Remove duplicate private: from SoftwareGLContext.h 2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
a4a666152b LibGfx+LibGL: Do not crash if matrix inverse does not exist
Allow `Matrix::inverse()` to return an error and deal with those in
LibGL. Also use this opportunity to more efficiently calculate the
transpose of the model view matrix for the normal transformation.
2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
03c1f1780d LibGL: Stub glPointSize 2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
6363797e80 LibGL: Implement glLightModeli 2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
e2f79c8b5f LibGL: Implement glTexEnvi 2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
eea1b95ead LibGL: Implement glRotated 2022-01-11 23:47:42 +01:00
Jelle Raaijmakers
a29534b531 LibGL: Implement glColor3d and glColor3ubv 2022-01-11 23:47:42 +01:00
Idan Horowitz
a8537ad096 CI: Require a blank line between commit titles and bodies 2022-01-11 23:45:14 +02:00
Linus Groh
14f6856d1d CI: Bump prettier to latest version (2.5.1) 2022-01-11 22:43:43 +01:00
Linus Groh
355fbcb702 LibJS: Actually implement get_iana_time_zone_offset_nanoseconds()
Instead of hard-coding an UTC offset of zero seconds, which worked for
the sole UTC time zone, we can now get the proper offset from the TZDB!
2022-01-11 22:17:39 +01:00
Linus Groh
d527eb62da LibJS: Support non-UTC time zones in Temporal :^)
We can now recognize & normalize all time zones from the IANA time zone
database and not just 'UTC', which makes the LibJS Temporal
implementation a lot more useful! Thanks to the newly added LibTimeZone,
this was incredibly easy to implement :^)

This already includes these recent editorial changes in the Temporal
spec: https://github.com/tc39/proposal-temporal/commit/27bffe1
2022-01-11 22:17:39 +01:00
Linus Groh
205d63c3f0 LibTimeZone: Operate in UTC-only mode when !ENABLE_TIME_ZONE_DATA
Instead of only having dummy functions that don't work with any input,
let's at least support one time zone: 'UTC'. This matches the basic
Temporal implementation for engines without ECMA-262, for example.
2022-01-11 22:17:39 +01:00
Linus Groh
f1276144ba LibJS: Check if input was exhausted after parsing UTC offset fraction
Previously parse_time_zone_numeric_utc_offset_syntax() would return true
to indicate success when parsing a string with an invalid number of
digits in the fractional seconds part (e.g. 23:59:59.9999999999).
We need to check if the lexer has any characters remaining, and return
false if that's the case.
2022-01-11 21:16:33 +01:00
Linus Groh
de07312cc7 LibJS/Tests: Add Temporal.TimeZone() tests for numeric UTC offset
This works now, let's test it :^)
2022-01-11 21:16:33 +01:00
creator1creeper1
d92558b3b3 Applets/Audio: Propagate errors by extracting out GUI initialization
This commit extracts out the GUI initialization in AudioWidget into
the new try_initialize_graphical_elements function. This function
is now able to use try_set_main_widget instead of set_main_widget.
It's only called by the fallible try_create method.
2022-01-11 09:19:09 -08:00
creator1creeper1
b4eed25872 Applets/ResourceGraph: Propagate errors in create_applet
We now return an error if we fail to parse the applet spec in the
expected format. We can now also use try_set_main_widget instead of
set_main_widget.
2022-01-11 09:19:09 -08:00
Junior Rantila
0d328f3c86 LibCore+flock: Make Core::System::waitpid more ergonomic 2022-01-11 16:04:29 +01:00
Marcus Nilsson
315e1c705f LibGUI: Don't paint text cursor if TextEditor is disabled
This looked a bit odd in the rare case of disabling a focused
TextEditor.
2022-01-11 16:00:48 +01:00
Marcus Nilsson
bcf764cecf LibGUI: Change gradient colors when ValueSlider is disabled
Make it more obivous when ValueSlider is disabled by changing the
gradient colors.
2022-01-11 16:00:48 +01:00
Jesse Buhagiar
5e20c45174 Ports: Add Half-Life Port :^)
Add a port of Half-Life, the classic game by VALVe Software
2022-01-11 15:03:55 +01:00
Andrew Kaster
4ebcae9f4f Ports: Add mold port
The port exposes some dynamic loader and toolchain shortcomings,
namely RTLD_NEXT, RTLD_NOLOAD, and std::filesystem. Hopefully we can
discover a ton of multi-threading bugs in Serenity with this port :^)
2022-01-11 11:47:48 +01:00
Andrew Kaster
b13846e688 LibC: Add daemon(3) implementation to match behavior of Linux and BSDs
This helper that originally appeared in 4.4BSD helps to daemonize
a process by forking, setting itself as session leader, chdir to "/" and
closing stdin/stdout.
2022-01-11 11:47:48 +01:00
Lady Gegga
6fdd9cddb7 Base: Add add Arrows to font Katica Regular 10
21AD, 21AE, 21BC-21FF https://www.unicode.org/charts/PDF/U2190.pdf
2022-01-11 11:47:34 +01:00
Lady Gegga
8c6646a034 Base: Adjust 21B9, 2190, 2192, 219D, 219C in font Katica Regular 10
Adjust them (make them a bit wider) for clearity.
2022-01-11 11:47:34 +01:00
Lady Gegga
0a07dc6a42 Base: Add Supplemental Arrows-A to font Katica Regular 10
27F0-27FF https://www.unicode.org/charts/PDF/U27F0.pdf
2022-01-11 11:47:34 +01:00
Lady Gegga
8e92f513e6 Base: Add Unified Canadian Aboriginal Syllabics Ext. to KaticaReg.10
18B0-18F5 https://www.unicode.org/charts/PDF/U18B0.pdf
2022-01-11 11:47:34 +01:00
Lady Gegga
3c83611dbe Base: Add 30EC8, 30ED5, 8E47, 96AC, 9C7B to font CJK Biáng 2022-01-10 23:46:13 -08:00
Lady Gegga
54626754d2 Base: Add 7228, 9F96, 2A6A5 to font CJK Biáng 2022-01-10 23:46:13 -08:00
Lady Gegga
d465bac60d Base: Add new bitmap font CJK Biáng 2022-01-10 23:46:13 -08:00
Andreas Kling
a4b4b358ff AK+Kernel: Remove one_ref_left() footgun
This mechanism was unsafe to use in any multithreaded context, since
the hook function was invoked on a raw pointer *after* decrementing
the local ref count.

Since we don't use it for anything anymore, let's just get rid of it.
2022-01-11 01:12:16 +01:00
Andreas Kling
08e927f084 Kernel: Synchronize removals from TmpFS inode map
Previously we were uncaching inodes from TmpFSInode::one_ref_left().
This was not safe, since one_ref_left() was effectively being called
on a raw pointer after decrementing the local ref count and observing
it become 1. There was a race here where someone else could trigger
the destructor by unreffing to 0 before one_ref_left() got called,
causing us to call one_ref_left() on a deleted inode.

We fix this by using the new remove_from_secondary_lists() mechanism
in ListedRefCounted and synchronizing all access to the TmpFS inode
map with the main Inode::all_instances() lock.

There's probably a nicer way to solve this.
2022-01-11 01:12:16 +01:00
Andreas Kling
3550f12543 Kernel: Make ListedRefCounted::unref() call optional list removal helper
Look for remove_from_secondary_lists() and call it on the ref-counting
target if present *while the lock is held*.

This allows listed-ref-counted objects to be present in multiple lists
and still have synchronized removal on final unref.
2022-01-11 01:12:16 +01:00
Andreas Kling
a4b3bf1d63 Kernel: Remove empty Ext2FSInode::one_ref_left() 2022-01-11 01:12:16 +01:00
Andreas Kling
b66bb11ed1 Kernel: Remove empty ISO9660Inode::one_ref_left() 2022-01-11 01:12:16 +01:00
Timothy Flynn
09c0324880 LibTimeZone: Begin generating GMT offset rules for each time zone
This is a rather naive implementation, but serves as a first pass at
determining the GMT offset for a time zone at a particular point in
time. This implementation ignores DST (because we are not parsing any
RULE entries yet), and ignores any offset patterns of the form "Mon>4"
or "lastSun".
2022-01-11 00:36:45 +01:00
Timothy Flynn
e9c42d0bc5 LibTimeZone: Add methods to canonicalize a time zone name 2022-01-11 00:36:45 +01:00
Timothy Flynn
1c2c98ac5d LibTimeZone: Add method to convert a time zone to a string 2022-01-11 00:36:45 +01:00
Timothy Flynn
14535fb67a LibTimeZone: Perform time-zone-from-string lookups case insensitively
Time zone names in the TZDB are defined to be case insensitive.
2022-01-11 00:36:45 +01:00
Timothy Flynn
b493c2ca90 LibTimeZone: Add a unit test for generated time zone data 2022-01-11 00:36:45 +01:00
Timothy Flynn
ccce9e5c7f LibTimeZone: Tweak the enumeration generated for parsed time zones
For example, generate "Etc/GMT+12" as "Etc_GMT_Ahead_12" (instead of as
"Etc_GMT_P12"). A little clearer what the name means without having to
know off-hand what "P" was representing.
2022-01-11 00:36:45 +01:00
Timothy Flynn
d627367489 LibTimeZone: Do not separate the generated data from the main library
This CMakeLists.txt was basically copy-pasted from LibUnicode, where the
generated data is separated into its own library. This was to let other
libraries / applications decide if they actually want to link the data
because it is so large. LibTimeZone's generated data is significantly
smaller, so this separation really isn't needed.
2022-01-11 00:36:45 +01:00
Timothy Flynn
b543c3e490 Meta: Don't assume how each generator wants to generate keyed map names
The generate_mapping helper generates a series of structs like:

    Array<SomeType, 1> s_mapping_key_0 {};
    Array<SomeType, 2> s_mapping_key_1 {};
    Array<SomeType, 3> s_mapping_key_2 {};
    Array<Span<SomeType const>> s_mapping { {
        s_mapping_key_0.span(),
        s_mapping_key_1.span(),
        s_mapping_key_2.span(),
    } };

Where the names of the struct were generated by the format_mapping_name
lambda inside the helper. Rather than this lambda making assumptions on
how each generator wants to name its structs, add a parameter for the
caller to provide a naming formatter.

This is because the TimeZoneData generator will want pretty specific
identifier formatting rules.
2022-01-11 00:36:45 +01:00
Timothy Flynn
6da1bfeeea Meta: Support generating case-insensitive value-from-string methods
This also extracts the default parameters for generate_value_from_string
to a structure. This is just to make it cleaner to add new options.
2022-01-11 00:36:45 +01:00
Timothy Flynn
3dccaa39d8 AK: Define a traits helper for case-insensitive StringView hashing
Currently, we define a CaseInsensitiveStringTraits structure for String.
Using this structure for StringView involves allocating a String from
that view, and a second string to convert that intermediate string to
lowercase.

This defines CaseInsensitiveStringViewTraits (and the underlying helper
case_insensitive_string_hash) to avoid allocations.
2022-01-11 00:36:45 +01:00