Commit graph

32242 commits

Author SHA1 Message Date
RasmusNylander
9678ff15a8 KeyboardMapper: Propagate errors using ErrorOr and TRY
KeyboardMapperWidget's load_map_from_file, load_map_from_system, save,
and save_to_file now all return ErrorOr<void> and no longer handles
alerting the user to potential errors.

main is now responsible for handling errors originating from its calls
to these four functions; it will simply alert the user using the new
method KeyboardMapperWidget::show_error_to_user(Error), which simply
creates a MassageBox displaying the error's string_literal.

This makes the whole program slight more clean feeling :^).
2022-01-06 17:54:03 +01:00
RasmusNylander
4e65c4dae4 LibKeyboard: Change some Optional<T> returns to ErrorOr<T>
Makes CharacterMapFile::load_from_file and CharacterMap::load_from_file
return ErrorOr instead of Optional. This makes them a little nicer to
use and a little easier to read, as they seem to have been approximating
this.
2022-01-06 17:54:03 +01:00
RasmusNylander
017135b44e KeyboardMapper: Port to LibMain 2022-01-06 17:54:03 +01:00
RasmusNylander
64684cbd5d KeyboardMapper: Fix discrepancy between cursor and button clickability
KeyButton now only responds to clicks on the key-cap's face. This
corresponds to when the cursor switches from the default arrow to a
hand.
2022-01-06 17:54:03 +01:00
RasmusNylander
35afd32a51 KeyboardMapper: Fix displaying null characters
Fixes a bug where KeyButtons would display null characters. A single
null character should be handled as an empty string.
2022-01-06 17:54:03 +01:00
RasmusNylander
41b0795f99 KeyboardMapper: Name formerly inlined variables
Renames some variables in KeyButton.cpp to increase clarity and grants
some slightly opaque inline variables names.
2022-01-06 17:54:03 +01:00
RasmusNylander
c4b2efd95e KeyboardMapper: Show multiple pressed keys at once
When depressing a key, KeyboardMapperWidget::keydown_event() will now
update only the pressed state of the button associated with the specific
key, instead of also setting the pressed state of the all the buttons to
false.

This makes it possible to highlight multiple pressed keys at once and
makes the code more consistent; the implementation of keyup_event
implied that this was a feature of the program.
2022-01-06 17:54:03 +01:00
RasmusNylander
a1531dba91 KeyboardMapper: Extract method map_from_name
Extract the mapping of a name to a character map into its own method.
This only slightly reduces the number of lines, going from 24 to 17
lines, but makes the code somewhat more readable and reduces repetition.
2022-01-06 17:54:03 +01:00
RasmusNylander
b2a6c9e5ea KeyboardMapper: Extract creation of map-selection buttons
Extract the creation of map-selection radio buttons from create_frame
into the new private method add_map_radio_button(map_name, button_text)
turning 24 lines into 4 + 6 lines. This makes create_frame a little
easier to read. :^)
2022-01-06 17:54:03 +01:00
martinfalisse
8eb8949d9c LibGUI: Calculate row position for scroll into view
When a user is navigating a table view with arrow keys and a row is
outside of the current view, then scroll_into_view is called, and the
position of the rectangle passed to this should take into account the
column headers.

This can be seen making more pleasant the navigation in the System
Monitor in the Processes view, for example.
2022-01-06 17:48:04 +01:00
martinfalisse
938380e88b LibGUI: Table View navigating with arrow keys continuity after update
When a user is navigating a table view with arrow keys and a row is
outside of the current view, then scroll_into_view is called, and the
position of the rectangle passed to this should take into account the
column headers.

This can be seen making more pleasant the navigation in the System
Monitor in the Processes view, for example.
2022-01-06 17:48:04 +01:00
Tobias Christiansen
923979ca93 PixelPaint: Unveil FileIconProvider.ini
This is used by the Filter Gallery and previously complained in the
debug log that it was not unveiled.
2022-01-06 15:13:05 +01:00
Jun Zhang
0ac7931545 Utilities/ln: Port to LibMain
This patch simply ports the utility ln to LibMain :^)
2022-01-06 13:32:22 +01:00
Linus Groh
81492b3cee LibJS: Remove the now unused custom VM unwind mechanism
Goodbye VM::m_unwind_until, you served us well :^)
2022-01-06 12:36:23 +01:00
Linus Groh
9d0d3affd4 LibJS: Replace the custom unwind mechanism with completions :^)
This includes:

- Parsing proper LabelledStatements with try_parse_labelled_statement()
- Removing LabelableStatement
- Implementing the LoopEvaluation semantics via loop_evaluation() in
  each IterationStatement subclass; and IterationStatement evaluation
  via {For,ForIn,ForOf,ForAwaitOf,While,DoWhile}Statement::execute()
- Updating ReturnStatement, BreakStatement and ContinueStatement to
  return the appropriate completion types
- Basically reimplementing TryStatement and SwitchStatement according to
  the spec, using completions
- Honoring result completion types in AsyncBlockStart and
  OrdinaryCallEvaluateBody
- Removing any uses of the VM unwind mechanism - most importantly,
  VM::throw_exception() now exclusively sets an exception and no longer
  triggers any unwinding mechanism.
  However, we already did a good job updating all of LibWeb and userland
  applications to not use it, and the few remaining uses elsewhere don't
  rely on unwinding AFAICT.
2022-01-06 12:36:23 +01:00
Linus Groh
eed764e1dd LibJS: Implement the LoopContinues AO 2022-01-06 12:36:23 +01:00
Linus Groh
fc474966bc LibJS: Implement LabelledStatement & LabelledEvaluation semantics
Instead of slapping 0..N labels on a statement like the current
LabelableStatement does, we need the spec's LabelledStatement for a
proper implementation of control flow using only completions - it always
has one label and one labelled statement - what appears to be 'multiple
labels' on the same statement is actually nested LabelledStatements.

Note that this is unused yet and will fully replace LabelableStatement
in the next commit.
2022-01-06 12:36:23 +01:00
Jelle Raaijmakers
558fd5b166 LibCore: Make EventLoop::pump() return event count
Sometimes, pumping the event loop will cause new events to be
generated. For example, an IPC message could be delivered which then
dispatches a new event to be handled by the GUI. To the invoker of
`EventLoop::pump()`, it is not obvious if any events were processed at
all.

Libraries like SDL2 might not have the opportunity to run the event
loop often enough that events can be processed swiftly, since it might
spend time doing other things. This can result in stuttering GUI
interactions.

This changes `EventLoop::pump()` to return the number of processed
events. This functionality will be used by our SDL2 port in another PR.
2022-01-06 11:30:04 +01:00
Tim Schumacher
fa902cd5d5 Ports: Fix the sha256sum for libjpeg
While the modification time still points back to 2020, it looks like the
tarball got updated secretly.
2022-01-05 22:53:53 -08:00
Sam Atkins
93ef8c8080 LibMarkdown: Output alignment when rendering HTML tables
Previously, only terminal output aligned table column contents
correctly. Now, we apply a `text-align` to each cell. This does not
actually *work* however, since LibWeb's table layout code is not yet
fully functional.
2022-01-06 08:22:46 +03:30
Rafał Babiarz
fee43e3544 Ports: Updated libogg to version 1.3.5 2022-01-05 16:35:49 -08:00
Lucas CHOLLET
75d1840cfc FileManager: Show Dotfiles when passing a Dotfile as an argument
Before this patch, FileManager was failing to open the directory and
open `/` instead.
2022-01-05 15:20:54 -08:00
Lucas CHOLLET
693ae73606 FileManager: Use String const& instead of String
Change ErrorOr<int> run_in_windowed_mode(String, String)
to ErrorOr<int> run_in_windowed_mode(String const&, String const&)
2022-01-05 15:20:54 -08:00
Luke Wilde
3e0c19d6ea LibJS: Add tests for all the unscopable Array prototype properties
When I was writing for tests for groupBy and groupByToMap, I noticed
there were no tests for these.
2022-01-05 20:31:25 +01:00
Timothy Flynn
260d2099da LibJS: Implement Date.UTC according to the spec
This fixes all failing Date.UTC test262 tests, which failed due to not
handling invalid input and evaluating inputs out of order. But this also
avoids using timegm(), which doesn't work on macOS for years before 1900
(they simply return -1 for those years).

Partially addresses #4651. Date.parse.js still fails.
2022-01-05 20:05:12 +01:00
Timothy Flynn
7a0830bb24 LibJS: Use AK::Time to implement the MakeDay AO
We currently use Core::DateTime create, which internally uses mktime().
This has the issues pointed out by the (now removed) FIXME, but also has
an issue on macOS where years before 1900 are not supported.
2022-01-05 20:05:12 +01:00
Timothy Flynn
e8f860048e LibJS: Set the length of Date.UTC to 7
This is a bit unusual because there is only 1 required argument, but the
spec dictates that the length is 7.
2022-01-05 20:05:12 +01:00
Timothy Flynn
bb9db5937a AK: Add Time.h helper to compute the number of days since epoch 2022-01-05 20:05:12 +01:00
Timothy Flynn
0c75a14b4f AK: Move TimeSpecType concept inside the AK namespace
This is just to allow removing the 'clang-format off' directive. This
concept is only used within this header, so it doesn't need to be in the
global namespace.
2022-01-05 20:05:12 +01:00
Andreas Kling
8f5c1ef29c AK: Improve HashTable::remove_all_matching() test slightly
After removing some entries, we now also verify that the correct
entries remain in the table. :^)
2022-01-05 18:57:14 +01:00
Andreas Kling
bcc0186bbc Kernel/Ext2FS: Use HashMap::remove_all_matching() in Ext2FS
This makes the inode cache eviction mechanism quite a bit easier
to understand, thanks to the new expressive API. :^)
2022-01-05 18:57:14 +01:00
Andreas Kling
2375e1bcda LibGUI: Rename ModelSelection::remove_matching => remove_all_matching
Let's be consistent with how Vector, HashTable and HashMap names these.
2022-01-05 18:57:14 +01:00
Andreas Kling
c6bcd0dfe4 LibGUI: Use HashTable::remove_all_matching() in GUI::ModelSelection 2022-01-05 18:57:14 +01:00
Andreas Kling
558fb0a04a AK: Make Vector::remove_all_matching() return removal success
This matches the behavior of other remove_*_matching() functions.
2022-01-05 18:57:14 +01:00
Andreas Kling
5279a04c78 AK: Make Hash{Map,Table}::remove_all_matching() return removal success
These functions now return whether one or more entries were removed.
2022-01-05 18:57:14 +01:00
Andreas Kling
c7ac0c2c80 LibJS: Use HashMap::remove_all_matching() in WeakMap 2022-01-05 18:57:14 +01:00
Andreas Kling
376e5ef912 AK: Add HashMap::remove_all_matching(predicate)
This removes all matching entries from a hash map in a single pass.
2022-01-05 18:57:14 +01:00
Andreas Kling
e08d325124 LibJS: Use HashTable::remove_all_matching() in WeakSet :^) 2022-01-05 18:57:14 +01:00
Andreas Kling
54cf42fac1 AK: Add HashTable::remove_all_matching(predicate)
This removes all matching entries from a table in a single pass.
2022-01-05 18:57:14 +01:00
Lady Gegga
365bd8a0c3 Base: Add Unified Canadian Aboriginal Syllabics Ext-A Katica Reg. 10
11AB0-11ABF https://www.unicode.org/charts/PDF/U11AB0.pdf
2022-01-05 18:42:18 +01:00
Lady Gegga
0305304c91 Base: Adjust 1F41A in font Katica Regular 10
Move 1F41A up 1px to align it with other glyphs
2022-01-05 18:42:18 +01:00
Lady Gegga
765d675d27 Base: Add symbols to font Katica Regular 10
1F990, 1F42C, 1FAB8, 1FAA8, 1FAB7
https://www.unicode.org/charts/PDF/U1F300.pdf
https://www.unicode.org/charts/PDF/U1FA70.pdf
https://www.unicode.org/charts/PDF/U1F900.pdf
2022-01-05 18:42:18 +01:00
Timothy Flynn
ec7d5351ed LibJS+LibUnicode: Handle flexible day periods that roll over midnight
When searching for the locale-specific flexible day period for a given
hour, we were neglecting to handle cases where the period crosses 00:00.
For example, the en locale defines a day period range of [21:00, 06:00).
When given the hour of 05:00, we were checking if (21 <= 5 && 5 < 6),
thus not recognizing that the hour falls in that period.
2022-01-05 16:22:55 +01:00
Mathieu PATUREL
c8addf1a5e LibGUI: Consume initial spaces when going to next/prev word break
This impacts text editors' ctrl+left, ctrl+shift+right, ctrl+backspace,
etc..

For example, consider the text "Hello world   |", pressing
ctrl+backspace each time.

Before: "hello world   |"
        "hello world|"
        "hello |"
        "hello|"
        "|"
 After: "hello world   |"
        "hello|"
        "|"

Note that this breaks a nice symmetry. Doing ctrl+left and then
ctrl+right doesn't necessarily get you to the same place like it use to.

Before: " hello |"
        " hello| "
        " hello |" // same as initial
 After: " hello |"
        "|hello "
        " hello| " // different from initial
2022-01-05 14:18:44 +01:00
Brian Gianforcaro
4b4cf06069 Kernel: Remove temporary Vector from Ext2FS::flush_writes()
Previously we were using this vector to store the inodes as we iterated.
However, we don't need to store all of them, just the previous inode, as
we know it will be safe to remove it once we've iterated past that
element.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
aa77c2ca58 Kernel: Use unchecked_append in PerformanceEventBuffer raw_backtrace()
We always validate the size before we append, so there is
no reason to use the checked append.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
1a2aad287f AK: Disable Vector insert/empend/prepend + a append overload in Kernel
We have whittled away at the usages of these AK::Vector APIs in the
Kernel. This change disables them from being visible when building
the Kernel to make sure no new usages get added.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
538986c991 Kernel+LibVT: Use MUST + try_prepend / try_append
In preparation for making Vector::append + Vector::prepend
unavailable during compilation of the Kernel.

This specific file is compiled into the Kernel as well as LibVT.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
6c66311ade Kernel: Use MUST + Vector::try_empend instead of Vector::empend
In preparation for making Vector::empend unavailable during
compilation of the Kernel.
2022-01-05 14:04:18 +01:00
Brian Gianforcaro
24066ba5ef Kernel: Use MUST + Vector::try_append instead of Vector::append
In preparation for making Vector::append unavailable during
compilation of the Kernel.
2022-01-05 14:04:18 +01:00