Commit graph

45152 commits

Author SHA1 Message Date
Timothy Flynn
10bf86de2c Demos: Rename Screensaver to GradientScreensaver
This is to avoid naming conflicts with an upcoming Screensaver launcher
application.
2023-01-03 17:56:55 +01:00
BodilessSleeper
1f1b2f4d26 LibJS: Rename ToPositiveInteger -> ToPositiveIntegerWithTruncation
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@768b916
2023-01-03 17:53:51 +01:00
BodilessSleeper
4e6beaabcb LibJS: Update comments in Temporal/Calendar.cpp
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@08cc0fb
2023-01-03 17:53:51 +01:00
Timothy Flynn
ee95cb37cd LibGUI: Don't highlight extension text when saving files with FilePicker
By default, only highlight the base name of the file to-be-saved. When
the file includes an extension, it's useful to be able to just start
typing a file name without having to manually de-select the extension
(or having to rewrite the extension).
2023-01-03 11:50:18 -05:00
Andreas Kling
0fe4f4fe53 Demos: Remove "Cube" application
This wasn't doing anything interesting enough to justify being its own
demo application. If we need a spinning cube, we can just load a cube
model into 3DFileViewer. :^)
2023-01-03 15:43:10 +01:00
Davide Cavalca
1fc7740152 Ladybird: Install SQLServer binary
Install the SQLServer binary added in 2cb3ae1 so that it's actually
available on the target system when doing a standalone build of
Ladybird.
2023-01-03 09:32:07 -05:00
Andreas Kling
555d7a6fce LibGfx: Make Font::glyph_width*() APIs return float 2023-01-03 15:25:02 +01:00
Andreas Kling
3407ab0fd1 LibGfx: Make Font::width() return a float 2023-01-03 15:25:02 +01:00
Andreas Kling
b9d2b8f7b2 LibGfx: Adjust ClassicWindowTheme titlebar height calculation
Use the Font::pixel_size() as reference, and put a little less vertical
padding around the text at sizes above the palette limit.
2023-01-03 15:25:02 +01:00
Andreas Kling
268d661138 LibGfx: Make ClassicWindowTheme menubar heights respect the font size 2023-01-03 15:25:02 +01:00
Andreas Kling
bfa7381852 LibGfx: Make Font::pixel_size() return a float
Here's yet another place where we were chopping of decimals.
2023-01-03 15:25:02 +01:00
Andreas Kling
09a125bcab LibGfx/Font: Make Glyph metrics floating point 2023-01-03 15:25:02 +01:00
Andreas Kling
8cea9fe56d LibGfx/Font: Make ScaledGlyphMetrics floating point
By rounding the scaled glyph metrics, we were losing valuable precision,
especially at smaller sizes.
2023-01-03 15:25:02 +01:00
Andreas Kling
15b920c730 WindowServer: Write new config to disk when system fonts are changed
This makes system font changes actually persist across reboots.
2023-01-03 15:25:02 +01:00
Andreas Kling
f4168be700 WindowServer: Only load /etc/WindowServer.ini once and keep it loaded
Instead of opening and reparsing WindowServer.ini at random occasions,
just keep the file open after loading it in serenity_main().

This avoids a bunch of unnecessary work, and also fixes an issue where
WindowManager::m_config might re-write stale values to disk.
2023-01-03 15:25:02 +01:00
martinfalisse
481c0419ba LibGUI: Fix highlighting of elements in TreeView
Previously, incorrect items were highlighted when hovering over
elements in TreeView when there was a column header.
2023-01-03 12:46:51 +00:00
networkException
4c7a99fe06 Ladybird: Remove separate LICENSE file
Since ladybird is part of the serenity monorepo now there's no need to
keep a separate LICENSE file around :^)
2023-01-03 12:37:18 +01:00
Tim Schumacher
9818766742 LibCompress: Port ZlibCompressor to Core::Stream 2023-01-03 10:01:09 +00:00
Tim Schumacher
f0b035b66c LibCompress: Switch ZlibCompressor to a constructor pattern
We don't have anything fallible in the constructor yet, but what's there
should be fallible and once we switch to Core::Stream it will be
fallible.
2023-01-03 10:01:09 +00:00
Tim Schumacher
23a9d62f39 LibCompress: Rename Compress::Zlib to Compress::ZlibDecompressor
Because that's what it is, even if it mainly relies on
`DeflateDecompressor` to do the heavy lifting.
2023-01-03 10:01:09 +00:00
Tim Schumacher
edd004fe90 Tests: Add a simple compression test for Zlib 2023-01-03 10:01:09 +00:00
Tim Schumacher
dd948b046c LibCore: Add Stream::WrapInAKOutputStream 2023-01-03 10:01:09 +00:00
Baitinq
bd65ecf05c PixelPaint: Cleanup the Image class
This patch just introduces some general cleanup regarding unused
imports and adding the const qualifier to eligible functions and
variables.
2023-01-03 09:58:02 +00:00
Baitinq
e89c649be1 PixelPaint: Propagate errors in {flip,crop,rotate,resize} functions
We now propagate errors when using the {Layer,Image}::flip(),
{Layer,Image}::crop(), {Layer,Image}::rotate() and
{Layer,Image}::resize() functions.

We handle these errors by show an error DialogBox with the error's
message.

This removes 8 FIXMEs:))
2023-01-03 09:58:02 +00:00
Ben Wiederhake
65b420f996 Everywhere: Remove unused includes of AK/Memory.h
These instances were detected by searching for files that include
AK/Memory.h, but don't match the regex:

\\b(fast_u32_copy|fast_u32_fill|secure_zero|timing_safe_compare)\\b

This regex is pessimistic, so there might be more files that don't
actually use any memory function.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
6b7ce19161 Everywhere: Remove unused includes of LibC/stdlib.h
These instances were detected by searching for files that include
stdlib.h, but don't match the regex:

\\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_
uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex
it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs|
ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble
n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o
penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo
c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete
nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou
l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use anything from the stdlib.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
f07847e099 Everywhere: Remove unused includes of AK/Concepts.h
These instances were detected by searching for files that include
AK/Concepts.h, but don't match the regex:

\\b(AnyString|Arithmetic|ArrayLike|DerivedFrom|Enum|FallibleFunction|Flo
atingPoint|Fundamental|HashCompatible|Indexable|Integral|IterableContain
er|IteratorFunction|IteratorPairWith|OneOf|OneOfIgnoringCV|SameAs|Signed
|SpecializationOf|Unsigned|VoidFunction)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any concepts.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
c2a900b853 Everywhere: Remove unused includes of AK/StdLibExtras.h
These instances were detected by searching for files that include
AK/StdLibExtras.h, but don't match the regex:

\\b(abs|AK_REPLACED_STD_NAMESPACE|array_size|ceil_div|clamp|exchange|for
ward|is_constant_evaluated|is_power_of_two|max|min|mix|move|_RawPtr|RawP
tr|round_up_to_power_of_two|swap|to_underlying)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any "extra stdlib" functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
0bde4e66fa Piano: Remove unused include of AK/StdLibExtraDetails.h
This instance was detected by searching for files that include
AK/StdLibExtraDetails.h, but don't match the regex:

\\b(AddConst|__AddConstToReferencedType|AddConstToReferencedType|AddLval
ueReference|__AddReference|AddRvalueReference|__AssertSize|AssertSize|__
CommonType|CommonType|__Conditional|Conditional|CopyConst|__Decay|Decay|
declval|DependentFalse|FalseType|__IdentityType|IdentityType|IndexSequen
ce|IntegerSequence|IntegralConstant|IsArithmetic|IsAssignable|IsBaseOf|I
sCallableWithArguments|IsClass|IsConst|IsConstructible|IsConvertible|IsC
opyAssignable|IsCopyConstructible|IsDestructible|IsEnum|__IsFloatingPoin
t|IsFloatingPoint|IsFunction|IsFundamental|IsHashCompatible|__IsIntegral
|IsIntegral|IsLvalueReference|IsMoveAssignable|IsMoveConstructible|IsNul
lPointer|IsOneOf|IsOneOfIgnoringCV|IsPOD|IsPointer|__IsPointerHelper|IsP
ointerOfType|IsRvalueReference|IsSame|IsSameIgnoringCV|IsSigned|IsSpecia
lizationOf|IsTrivial|IsTriviallyAssignable|IsTriviallyConstructible|IsTr
iviallyCopyable|IsTriviallyCopyAssignable|IsTriviallyCopyConstructible|I
sTriviallyDestructible|IsTriviallyMoveAssignable|IsTriviallyMoveConstruc
tible|IsUnion|IsUnsigned|IsVoid|MakeIndexSequence|MakeIntegerSequence|ma
ke_integer_sequence_impl|__MakeSigned|MakeSigned|__MakeUnsigned|MakeUnsi
gned|__RemoveConst|RemoveConst|RemoveCV|RemoveCVReference|__RemovePointe
r|RemovePointer|__RemoveReference|RemoveReference|__RemoveVolatile|Remov
eVolatile|TrueType|UnderlyingType|Void|VoidType)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any "detailed extra stdlib" functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
6fd478b6ce Everywhere: Remove unused includes of AK/Format.h
These instances were detected by searching for files that include
AK/Format.h, but don't match the regex:

\\b(CheckedFormatString|critical_dmesgln|dbgln|dbgln_if|dmesgln|FormatBu
ilder|__FormatIfSupported|FormatIfSupported|FormatParser|FormatString|Fo
rmattable|Formatter|__format_value|HasFormatter|max_format_arguments|out
|outln|set_debug_enabled|StandardFormatter|TypeErasedFormatParams|TypeEr
asedParameter|VariadicFormatParams|v_critical_dmesgln|vdbgln|vdmesgln|vf
ormat|vout|warn|warnln|warnln_if)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any formatting functions.

Observe that this revealed that Userland/Libraries/LibC/signal.cpp is
missing an include.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
345662d617 Userland: Remove unused includes of AK/Math.h
These instances were detected by searching for files that include
Kernel/Debug.h, but don't match the regex:

\\b(acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|cos|cosh|E|exp|exp2
|fabs|fmod|hypot|log|log10|log2|NaN|Pi|pow|product_even|product_odd|rema
inder|round_to|rsqrt|sin|sincos|sinh|sqrt|Sqrt1_2|Sqrt2|tan|tanh)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any math functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
8a331d4fa0 Everywhere: Move AK/Debug.h include to using files or remove 2023-01-02 20:27:20 -05:00
Ben Wiederhake
a55360781b LibGL: Move AK/Debug.h include to where it is used 2023-01-02 20:27:20 -05:00
Ben Wiederhake
143a64f9a2 Kernel: Remove unused includes of Kernel/Debug.h
These instances were detected by searching for files that include
Kernel/Debug.h, but don't match the regex:
\\bdbgln_if\(|_DEBUG\\b
This regex is pessimistic, so there might be more files that don't check
for any real *_DEBUG macro. There seem to be no corner cases anyway.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
kleines Filmröllchen
a6a439243f Kernel: Turn lock ranks into template parameters
This step would ideally not have been necessary (increases amount of
refactoring and templates necessary, which in turn increases build
times), but it gives us a couple of nice properties:
- SpinlockProtected inside Singleton (a very common combination) can now
  obtain any lock rank just via the template parameter. It was not
  previously possible to do this with SingletonInstanceCreator magic.
- SpinlockProtected's lock rank is now mandatory; this is the majority
  of cases and allows us to see where we're still missing proper ranks.
- The type already informs us what lock rank a lock has, which aids code
  readability and (possibly, if gdb cooperates) lock mismatch debugging.
- The rank of a lock can no longer be dynamic, which is not something we
  wanted in the first place (or made use of). Locks randomly changing
  their rank sounds like a disaster waiting to happen.
- In some places, we might be able to statically check that locks are
  taken in the right order (with the right lock rank checking
  implementation) as rank information is fully statically known.

This refactoring even more exposes the fact that Mutex has no lock rank
capabilites, which is not fixed here.
2023-01-02 18:15:27 -05:00
Ben Wiederhake
363cc12146 Revert "LibJS: Implement MakeDay without using AK::years_to_days_since…"
This reverts commit 032664332b.

Now that AK::years_to_days_since_epoch has acceptable performance, we
can go back to the "easy" way of computing the unix epoch time.
2023-01-02 16:19:35 -05:00
Ben Wiederhake
3334cf675a AK+Kernel: Eliminate UB (signed overflow) from days_since_epoch 2023-01-02 16:19:35 -05:00
Ben Wiederhake
7a69219a35 AK+Tests: Replace years_to_days_since_epoch by near-instant function
This solves half the problem of #12729. Note that the inverse function
time_to_tm() in LibC/time.cpp still uses a slow for-loop.

See also #13138
2023-01-02 16:19:35 -05:00
Ben Wiederhake
60ee695287 AK+Tests: Demonstrate slowness of years_to_days_since_epoch
In practice, this function does not take any perceptible amount of time.
However, this benchmark demonstrates that for extreme values, the
internal for-loop does matter.
2023-01-02 16:19:35 -05:00
Lenny Maiorani
e0ab7763da AK: Combine SinglyLinkedList and SinglyLinkedListWithCount
Using policy based design `SinglyLinkedList` and
`SinglyLinkedListWithCount` can be combined into one class which takes
a policy to determine how to keep track of the size of the list. The
default policy is to use list iteration to count the items in the list
each time. The `WithCount` form is a different policy which tracks the
size, but comes with the overhead of storing the count and
incrementing/decrementing on each modification.

This model is extensible to have other forms of counting by
implementing only a new policy instead of implementing a totally new
type.
2023-01-02 20:13:24 +00:00
Arda Cinar
0105600120 AK+Tests: Add a test for formatting numbers in base 10 units
Added a test case to TestNumberFormat to test the new base 10 formatting
capability
2023-01-02 20:11:18 +00:00
Arda Cinar
0dbb1be81c AK: Add an option to format numbers with 1000 based units
Instead of only allowing 1024-based units.
2023-01-02 20:11:18 +00:00
Arda Cinar
ccb6b4f943 AK: Make sure no overflow occurs in number_string_with_one_decimal
A possible integer overflow might have occured inside the function in
case (number % unit) * 10 did not fit into a u64. So it is verified that
this does not happen at the beginning of the function.
2023-01-02 20:11:18 +00:00
Arda Cinar
76fce0b899 df: Add an option to display used/available inodes 2023-01-02 20:11:18 +00:00
Arda Cinar
c8fadff9b1 AK: Add a human_readable_quantity helper to NumberFormat.h
This can be used for displaying large quantities that are not measured
in bytes in a more human-readable format.
2023-01-02 20:11:18 +00:00
Arda Cinar
3e924e2a37 AK: Move the functions in NumberFormat.h out of line 2023-01-02 20:11:18 +00:00
Arda Cinar
ef71104620 df: Show used percentages for each listed entry 2023-01-02 20:11:18 +00:00
Ben Wiederhake
b2cd935efd LibCore: Remove unused include MemMem
These instances were detected by searching for files that include
MemMem.h, but don't match the regex:
\\b(MemMem(?!\.h>)|bitap_bitwise|memmem|memmem_optional)\\b
These are the only symbols defined by MemMem.h.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:08:35 +00:00
Ben Wiederhake
c1676cdddb Everywhere: Remove unused includes of AK/IterationDecision.h
These instances were detected by searching for files that include
IterationDecision.h, but don't match the regex:
\\bIterationDecision(?!\.h>)\\b
This is the only symbol defined by IterationDecision.h.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:08:35 +00:00
Ben Wiederhake
a8391d5a60 Everywhere: Remove unused includes of AK/Array.h
These instances were detected by searching for files that include
Array.h, but don't match the regex:
\\b(Array(?!\.h>)|iota_array|integer_sequence_generate_array)\\b
These are the three symbols defined by Array.h.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:08:35 +00:00