Commit Graph

32567 Commits

Author SHA1 Message Date
Jelle Raaijmakers
c0c72c6b91 Repository: Protect port patches from CRLF/LF normalization
This allows source files with CRLF line endings to be patched.
2022-01-12 01:08:38 +01:00
Timothy Flynn
c1a1370c2a LibJS: Use new LibUnicode API to format time zone names 2022-01-11 23:56:35 +01:00
Timothy Flynn
e2dfbe8f67 LibUnicode: Parse and generate long and short generic time zone names
This implements the CalendarPatternStyle::{Long,Short}Generic styles of
time zone name formatting.
2022-01-11 23:56:35 +01:00
Timothy Flynn
d50f5e14f8 LibUnicode: Fall back to GMT offset when a time zone name is unavailable
The following table in TR-35 includes a web of fall back rules when the
requested time zone style is unavailable:
https://unicode.org/reports/tr35/tr35-dates.html#dfst-zone

Conveniently, the subset of styles supported by ECMA-402 (and therefore
LibUnicode) all either fall back to GMT offset or to a style that is
unsupported but itself falls back to GMT offset.
2022-01-11 23:56:35 +01:00
Timothy Flynn
8d35563f28 LibUnicode: Implement TR-35's localized GMT offset formatting
This adds an API to use LibTimeZone to convert a time zone such as
"America/New_York" to a GMT offset string like "GMT-5" (short form) or
"GMT-05:00" (long form).
2022-01-11 23:56:35 +01:00
Timothy Flynn
6409900a5b LibUnicode: Add an API to retrieve a locale's default numbering system 2022-01-11 23:56:35 +01:00
Timothy Flynn
cc5e9f0579 LibJS+LibUnicode: Move replacement of number system digits to LibUnicode
There are a few algorithms in TR-35 that need to replace digits before
returning any results to callers. For example, when formatting time zone
offsets, a string like "GMT+12:34" must have its digits replaced with
the default numbering system for the desired locale.
2022-01-11 23:56:35 +01:00
Timothy Flynn
5aa144193c LibTimeZone: Use new AK::Time factory method in generated code 2022-01-11 23:56:35 +01:00
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