Commit graph

30030 commits

Author SHA1 Message Date
Andreas Kling
583fbf7111 WindowServer: Make WindowFrame::shadow_bitmap() const
There is no reason for callers to mutate the shadow bitmaps returned by
this function.
2021-11-14 12:23:04 +01:00
Lady Gegga
530360ce77 Base: Add Mende Kikakui characters to font Katica Regular 10
U1E800-1E8DF https://www.unicode.org/charts/PDF/U1E800.pdf
2021-11-14 11:11:01 +00:00
Timothy Flynn
15c5fbd9e9 LibJS: Implement number grouping for Intl.NumberFormat
For example, in en-US, the number 123456 should be formatted as the
string "123,456". In en-IN, it should be formatted as "1,23,456".
2021-11-14 10:35:19 +00:00
Timothy Flynn
3b7f5af042 LibUnicode: Generate primary and secondary number grouping sizes
Most locales have a single grouping size (the number of integer digits
to be written before inserting a grouping separator). However some have
a primary and secondary size. We parse the primary size as the size used
for the least significant integer digits, and the secondary size for the
most significant.
2021-11-14 10:35:19 +00:00
Liav A
0e5983e603 Kernel/AHCI: Simplify wait and timeout pattern significantly
Instead of repeating ourselves with the pattern of waiting for some
condition to be met, we can have a general method for this task,
and then we can provide the retry count, the required delay and a lambda
function for the checked condition.
2021-11-13 23:35:27 +01:00
Liav A
557351724a Kernel/AHCI: Remove unnecessary AHCIPort class member 2021-11-13 23:35:27 +01:00
Tim Schumacher
2e8330f78c Utilities/tr: Rework squeezing to be supported during more operations 2021-11-13 23:34:49 +01:00
David Lindbom
3c98a9430b LibVT: Show action of double click in tooltip
When hovering an item in Terminal we now show what application will
handle it, e.g "Open app-catdog.png in ImageViewer".

If the file is its own handler, i.e an executable, it will show
"Execute myscript.sh"
2021-11-13 23:33:46 +01:00
Luke Wilde
f6ab63993a LibJS: Implement Temporal.ZonedDateTime.prototype.round 2021-11-13 19:48:54 +00:00
Timothy Flynn
3450def494 LibJS: Implement Intl.NumberFormat.prototype.formatToParts 2021-11-13 19:01:25 +00:00
Timothy Flynn
40973814e9 LibJS: Throw an exception in NumberFormat.prototype.format for BigInts
Rather than crashing in the call to as_double(), throw an exception for
now.
2021-11-13 19:01:25 +00:00
Timothy Flynn
c65dea64bd LibJS+LibUnicode: Don't remove {currency} keys in GetNumberFormatPattern
In order to implement Intl.NumberFormat.prototype.formatToParts, do not
replace {currency} keys in the format pattern before ECMA-402 tells us
to. Otherwise, the array return by formatToParts will not contain the
expected currency key.

Early replacement was done to avoid resolving the currency display more
than once, as it involves a couple of round trips to search through
LibUnicode data. So this adds a non-standard method to NumberFormat to
do this resolution and cache the result.

Another side effect of this change is that LibUnicode must replace unit
format patterns of the form "{0} {1}" during code generation. These were
previously skipped during code generation because LibJS would just
replace the keys with the currency display at runtime. But now that the
currency display injection is delayed, any {0} or {1} keys in the format
pattern will cause PartitionNumberPattern to abort.
2021-11-13 19:01:25 +00:00
Timothy Flynn
d872d030f1 LibJS: Avoid potential for dangling string views in partition patterns
There aren't any dangling views in as of yet, but a subsequent commit
will cause the "part" variable to be a view into an internally generated
string. Therefore, after returning from PartitionNumberPattern, that
view will be pointed at freed memory.

This commit is to set the precendence of not returning a view to "part".
2021-11-13 19:01:25 +00:00
Timothy Flynn
0c9711efba LibUnicode: Handle all space code points when creating currency patterns
Previously, we were checking if the code point immediately before/after
the {currency} key was U+00A0 (non-breaking space). Instead, to handle
other spacing code points, we must check if the surrounding code point
has the separator general category.
2021-11-13 19:01:25 +00:00
Timothy Flynn
ada4bab405 LibUnicode: Remove GeneralCategory::Symbol string lookup
When I originally wrote this method, I had it in LibJS, where we can't
refer to the GeneralCategory enumeration directly. This is a big TODO,
anyone outside of LibUnicode can't assume the generated enumerations
exist and must get these values by string lookup. But this function
ended up living in LibUnicode, who can reference the enumeration.
2021-11-13 19:01:25 +00:00
Linus Groh
dbe70e7c55 LibJS: Implement Temporal.Duration.prototype.total() 2021-11-13 18:50:54 +00:00
Linus Groh
656efe5d6c LibJS: Fix days calculation in round_duration() for "year" - "day" units
This relies on floating point division, which is not possible with
LibCrypto bigints at the moment. So, instead of completely ignoring the
remainder we now first do a bigint division, then convert the remainder
to a double, and do another native floating point division to get the
final result.
2021-11-13 18:50:54 +00:00
Sam Atkins
28a8e4a105 ThemeEditor: Correct GroupBox margins
Now that GroupBoxes have intrinsic margins, we don't need to provide
such large margin values in the GML.
2021-11-13 17:59:51 +00:00
Linus Groh
f11277b50d LibJS: Fix missing handling of "week" largest_unit in balance_duration()
It would crash because of VERIFY(largest_unit == "nanosecond"sv) in the
final else branch when passing "week", because it's not handled in any
of the previous branches.
2021-11-13 14:21:08 +00:00
Linus Groh
8c73d85a65 LibJS: Fix logic typo in round_duration() remainder calculation
For unit == "hour", the remainder would not return the difference
between fractional_hours and hours, but fractional_hours and days.
2021-11-13 13:33:00 +00:00
Linus Groh
f0cd727d74 LibJS: Fix logic typo in balance_duration() hours calculation
By using milliseconds_division_result instead of seconds_division_result
here, the result for hours was off by a factor of 60.
2021-11-13 13:32:35 +00:00
faxe1008
b97f9f8e17 LibConfig: Add removal/notifcation for keys 2021-11-13 12:55:46 +01:00
faxe1008
a4a89a63cb ConfigServer: Add method and notification for key removal
This addresses the FIXME of detecting ConfigFile key removal.
2021-11-13 12:55:46 +01:00
Liav A
3ea49259df Kernel/Storage: Don't use interrupts when resetting SATA AHCI devices
Don't use interrupts when trying to reset a device that is connected to
a port on the AHCI controller, and instead poll for changes in status to
break out from the loop. At the worst case scenario we can wait 0.01
seconds for each SATA reset.
2021-11-13 12:53:57 +01:00
Andrew January
c0d6e37ab3 LibGUI: Add support for Ctrl+Delete in TextEditor
Allow deleting the word after the cursor using Ctrl+Delete in a similar
manner to how Ctrl+Backspace deletes the word before the cursor.
2021-11-13 12:53:29 +01:00
Andrew January
22e80bae29 LibGUI: Change delete key handling from action to keydown_event
Having the delete key handling be done via an action limits our ability
to support key modifiers (e.g. ctrl+delete deleting the word in front of
the cursor).

The fact that it was an action _did_ allow us to have a delete button in
the TextEditor UI. However, this is an odd choice in the first place
that isn't common in other text editors, so I just removed it.
2021-11-13 12:53:29 +01:00
Timothy Flynn
a701ed52fc LibJS+LibUnicode: Fully implement currency number formatting
Currencies are a bit strange; the layout of currency data in the CLDR is
not particularly compatible with what ECMA-402 expects. For example, the
currency format in the "en" and "ar" locales for the Latin script are:

    en: "¤#,##0.00"
    ar: "¤\u00A0#,##0.00"

Note how the "ar" locale has a non-breaking space after the currency
symbol (¤), but "en" does not. This does not mean that this space will
appear in the "ar"-formatted string, nor does it mean that a space won't
appear in the "en"-formatted string. This is a runtime decision based on
the currency display chosen by the user ("$" vs. "USD" vs. "US dollar")
and other rules in the Unicode TR-35 spec.

ECMA-402 shies away from the nuances here with "implementation-defined"
steps. LibUnicode will store the data parsed from the CLDR however it is
presented; making decisions about spacing, etc. will occur at runtime
based on user input.
2021-11-13 11:52:45 +00:00
Timothy Flynn
e9493a2cd5 LibUnicode: Ensure UnicodeNumberFormat is aware of default content
For example, there isn't a unique set of data for the en-US locale;
rather, it defaults to the data for the en locale. See this commit for
much more detail: 357c97dfa8
2021-11-13 11:52:45 +00:00
Timothy Flynn
9421d5c0cf LibUnicode: Generate currency unit-pattern number formats
These are used when formatting a number as currency with a display
option of "name" (e.g. for USD, the name is "US Dollars" in en-US).

These patterns appear in the CLDR in a different manner than other
number formats that are pluralized. They are of the form "{0} {1}",
therefore do not undergo subpattern replacements.
2021-11-13 11:52:45 +00:00
Timothy Flynn
39e031c4dd LibJS+LibUnicode: Generate all styles of currency localizations
Currently, LibUnicode is only parsing and generating the "long" style of
currency display names. However, the CLDR contains "short" and "narrow"
forms as well that need to be handled. Parse these, and update LibJS to
actually respect the "style" option provided by the user for displaying
currencies with Intl.DisplayNames.

Note: There are some discrepencies between the engines on how style is
handled. In particular, running:

new Intl.DisplayNames('en', {type:'currency', style:'narrow'}).of('usd')

Gives:

  SpiderMoney: "USD"
  V8: "US Dollar"
  LibJS: "$"

And running:

new Intl.DisplayNames('en', {type:'currency', style:'short'}).of('usd')

Gives:

  SpiderMonkey: "$"
  V8: "US Dollar"
  LibJS: "$"

My best guess is V8 isn't handling style, and just returning the long
form (which is what LibJS did before this commit). And SpiderMoney can
handle some styles, but if they don't have a value for the requested
style, they fall back to the canonicalized code passed into of().
2021-11-13 11:52:45 +00:00
Timothy Flynn
6cfd63e5bd LibUnicode: Parse numbers in number formats a bit more leniently
The parser was previously expecting number sections within a pattern to
start with "#", but they may also begin with "0".
2021-11-13 11:52:45 +00:00
Maciej
f88b4dfb58 Base: Add some geometric shapes to Katica10Regular
U+25A0 - U+25B1
2021-11-13 12:52:31 +01:00
Pedro Pereira
15bc043114 3DFileViewer: Clean some code for increased readability on Mesh
This replaces all usages of 'm_triangle_list[i]' with 'triangle' in
order to improve readability of the code.
2021-11-13 12:52:22 +01:00
Pedro Pereira
ed41f48ea4 3DFileViewer: Calculate face-normal from vertex-normals of the triangle
This change calculates the face-normal of the triangle by adding
the three vertex-normals and then normalizing. This results in an
average of the three vertex-normals.
2021-11-13 12:52:22 +01:00
Pedro Pereira
5fd58a2663 3DFileViewer: Add 'normals' to Mesh constructor
This change allows a Mesh object to be created with a vector of normals.
2021-11-13 12:52:22 +01:00
Pedro Pereira
7fb8af73bf 3DFileViewer: Add vertex normal parsing to WavefrontOBJLoader
This change allows us to parse vertex-normal lines "vn x y z"
and map them to the correct index on face lines ("f v1/vt1/vn1").
2021-11-13 12:52:22 +01:00
Andreas Kling
a8fed919e7 WindowServer: Clear active input tracking window on menu popup
This fixes an issue with menus not being immediately "usable" with the
the right mouse button after opening a context menu.

The bug was that we were clearing a local pointer to the active input
tracking window instead of the pointer in WindowStack.
2021-11-13 12:48:43 +01:00
Andreas Kling
68dc2e62fb WindowServer: Replace "Pin/Unpin Window" => "Always on Top" 2021-11-13 12:48:43 +01:00
Andreas Kling
d21dc1f451 Everywhere: Replace "virtual desktop" => "workspace" 2021-11-13 12:48:43 +01:00
Tim Schumacher
8417c0fb1e Tests/LibRegex: Add tests for line end anchors in PosixBasic 2021-11-13 15:06:52 +03:30
Tim Schumacher
ff38062318 LibRegex: Correctly translate BRE pattern end anchors
Previously we were always choosing the "nothing special" code path, even
if the dollar symbol was at the end of the pattern (and therefore should
have been considered special).

Fix that by actually checking if the pattern end follows, and emitting
the correct instruction if necessary.
2021-11-13 15:06:52 +03:30
Daniel Bertalan
fe1726521a Meta: Resolve cyclic dependency between LibPthread and libc++
libc++ uses a Pthread condition variable in one of its initialization
functions. This means that Pthread forwarding has to be set up in LibC
before libc++ can be initialized. Also, because LibPthread is written in
C++, (at least some) parts of the C++ standard library have to be linked
against it.

This is a circular dependency, which means that the order in which these
two libraries' initialization functions are called is undefined. In some
cases, libc++ will come first, which will then trigger an assert due to
the missing Pthread forwarding.

This issue isn't necessarily unique to LibPthread, as all libraries that
libc++ depends on exhibit the same circular dependency issue.

The reason why this issue didn't affect the GNU toolchain is that
libstdc++ is always linked statically. If we were to change that, I
believe that we would run into the same issue.
2021-11-13 11:15:33 +00:00
Maciej
62169fda03 SystemMonitor: Ask user before trying to kill/stop process
These actions can be dangerous, especially for important system
processes. Let's make accidental breaking of the system a bit
harder. :^)
2021-11-13 11:14:20 +00:00
Maciej
7f7db7dbec SystemMonitor: Add Delete as alternate shortcut for killing a process
This matches behaviour of other "system monitors", like Windows's Task
Manager
2021-11-13 11:14:20 +00:00
Elyse
f19cb6bb22 SoundPlayer: Add keyboard shortcuts for stop and volume
These shortcuts allow us to stop the player (key S) and adjust
the volume level (key Up and key Down).
2021-11-13 11:53:31 +01:00
Elyse
ccced92ac2 SoundPlayer: Make 'volume_slider' a member variable
This change will allow us to modify the volume slider from any event
inside the widget.
2021-11-13 11:53:31 +01:00
Elyse
11a4fa6067 SoundPlayer: Allow volume output of up to 150%
Previously the volume slider could go up to 150% but the real
output volume stayed the same between 100% and 150%.
2021-11-13 11:53:31 +01:00
Andreas Kling
ea8c6e796f SystemMonitor: Shrink oversized GroupBox margins
Now that GroupBox reports accurate content margins, we don't need to
account for the title height in internal layout margins.
2021-11-13 11:47:46 +01:00
Tim Schumacher
6fe37a1e52 Utilities/grep: Implement using multiple patterns 2021-11-13 11:42:26 +01:00
Tim Schumacher
c94574d313 Utilities/tar: Ignore directory entry if it already exists 2021-11-13 11:42:08 +01:00