Commit graph

20972 commits

Author SHA1 Message Date
Thomas Keppler
883d0d2466 FontSettingsWidget: Display the default (fixed-width) font's name
Previously, the font was applied to the Labels but the name wasn't
updated on initial startup.
This meant that the Label's content was only correct in the default
state but not if the user changed the defaults.
2021-05-24 09:08:23 +01:00
Gunnar Beutner
ad6587424f Kernel: Disable profiling if setting up the buffer or timer failed 2021-05-24 09:10:50 +02:00
Andreas Kling
d3f298c592 LibIPC: Fix unaligned u32 access in drain_messages_from_peer()
Caught by userspace UBSAN. :^)
2021-05-24 09:04:22 +02:00
Andreas Kling
8f2425125e LibGfx+Base: Tweak bitmap fonts to ensure glyph data is 4-byte aligned
When building userland with UBSAN enabled (#7434), we were getting
spammed to death by unaligned access errors.

Fix these by adding 2 bytes of padding to the FontFileHeader struct,
and adjusting all our font files to match the new format. :^)
2021-05-24 08:18:34 +02:00
Jelle Raaijmakers
22d8778437 LibGfx/Matrix: Add inverse() and friends
Matrix inversion comes in quite handy in 3D projections, so let's add
`Matrix<N,T>.inverse()`. To support matrix inversion, the following
methods are added:

* `Matrix.first_minor()`
  See: https://en.wikipedia.org/wiki/Minor_(linear_algebra)
* `Matrix.adjugate()`
  See: https://en.wikipedia.org/wiki/Adjugate_matrix
* `Matrix.determinant()`
  See: https://en.wikipedia.org/wiki/Determinant
* `Matrix.inverse()`
  See: https://en.wikipedia.org/wiki/Invertible_matrix
* `Matrix.operator/()`
  To support easy matrix division :-)

Code loosely based on an implementation listed here:
https://www.geeksforgeeks.org/adjoint-inverse-matrix/
2021-05-24 00:33:18 +01:00
Daniel Bertalan
06c835f857 Kernel: Signal EOF/EOL characters properly in TTY
I introduced a regression in #7184 where `TTY` would report 1 byte read
in canonical mode even if we had no more characters left. This was
caused by counting the '\0' that denotes EOF into the number of
characters that were read.

The fix was simple: exclude the EOF character from the number of bytes.

This still wouldn't be correct by itself, as the EOF and EOL control
characters could change between when the data was written to the TTY and
when it is read. We fix this by signaling out-of-band whether something
is a special character. End-of-file markers have a value of zero and
have their special bits set. Any other bytes with a special flag are
treated as line endings. This is possible, as POSIX doesn't allow
special characters to be 0.

Fixes #7419
2021-05-24 00:06:06 +01:00
Lynn
d3aae59478 tar: Ignore "extended headers"
Looking around online, it seems like this is normally a bit of
metadata that the extract operation can safely ignore.
2021-05-24 00:01:01 +01:00
Marcus Nilsson
6b85c7647c
Browser: Add context menu with history for back/forward button
Right clicking on back or forward will now show a context menu with
URLs to navigate to. Also added an optional argument for the number of
steps in go_back() and go_forward().
2021-05-23 23:58:00 +01:00
Gunnar Beutner
0688e02339 Kernel: Make sure we only log profiling events when m_profiling is true
Previously the process' m_profiling flag was ignored for all event
types other than CPU samples.

The kfree tracing code relies on temporarily disabling tracing during
exec. This didn't work for per-process profiles and would instead
panic.

This updates the profiling code so that the m_profiling flag isn't
ignored.
2021-05-23 23:54:30 +01:00
Idan Horowitz
a8ca4751b9
CI: Update comment-on-pr to a version that supports pull_request_target (#7431)
The previous version unfortunately didn't work for that workflow type if
the author of the PR did not already have write access to the repo.
2021-05-23 23:37:45 +01:00
Andrew Kaster
d3af011562 CI: Enable more verbose and strict sanitizer options
Options shamelessly stolen from this article on systemd's website:

https://systemd.io/TESTING_WITH_SANITIZERS/

We make ASAN more strict and tell UBSAN to print more verbose output on
failure. One of the more interesting ASAN options,
detect_stack_use_after_return, sadly causes both UBSAN and ASAN failures
in test-js.
2021-05-23 23:30:46 +01:00
Max Wipfli
6837634f31 Calculator: Remove unused headers 2021-05-23 23:18:54 +01:00
Max Wipfli
bb38328d39 Calculator: Fix behavior when entering number starting with decimal
This fixes a bug where entering a number like ".15" would result in "15"
instead of "0.15"
2021-05-23 23:18:54 +01:00
Max Wipfli
7b53ca5309 Calculator: Use Checked to ensure entered values do not overflow
This replaces the types of m_int_value and m_frac_value with
Checked<u64> which makes it possible to check if the value overflowed
when entering a digit. If that happens, the digit will just be ignored.

This fixes #1263.
2021-05-23 23:18:54 +01:00
Max Wipfli
7a5407982f Calculator: Show decimal point immediately when typed 2021-05-23 23:18:54 +01:00
Max Wipfli
2675d25453 Calculator: Handle keydown events correctly with all keyboard layouts
This changes the keydown_event handler to use codepoints instead of key
codes for comparison if possible. This is so the functionality still
works as intended with keyboard layouts where e.g. typing '+' actually
results in KeyCode::Key_ExclamationPoint rather than KeyCode::Key_Plus.

This also removes the unnecessary call to atoi().
2021-05-23 23:18:54 +01:00
Tobias Christiansen
b53dac6e88 LibWeb: Add support for more pseudoclasses
:disabled, :enabled and :checked are now parsed and matched. There
surely are more nuances to consider.
2021-05-24 02:14:11 +04:30
Andreas Kling
4f4cde2379 LibDebug: Pre-allocate capacity for the LineProgram::LineInfo vector
This shaves another ~15% off of "bt 12" on my machine :^)
2021-05-23 23:17:26 +02:00
Andreas Kling
0bf3df28b9 LibDebug: Memoize resolved paths in DebugInfo::prepare_lines()
When loading debug info, we encounter the same filename over and over
(since files usually have many lines!) and we were wasting a ton of
time re-checking if the filename was part of the Toolchain or libgcc,
along with some other checks.

This patch makes prepare_lines() significantly faster by memoizing
the result of these checks per filename.

This makes "bt 12" ~25% faster (from 850ms to 650ms on my machine.) :^)
2021-05-23 23:01:11 +02:00
Josh Perry
d27616cf36 Hearts: Allow player to set their name
Added a new settings dialog to Hearts with a textbox to allow the
player to set a name, which is persisted in the Hearts config file.
2021-05-23 20:43:53 +01:00
Brian Gianforcaro
e706de8f91 LibM: Fix linking with LibM when compiling Userland without -O2
While playing with conditionally disabling -O2 optimization when
building the Userland subdirectory, I discovered that we can no longer
link errors without -O2. This happens as LibM.so doesn't link to
anything else, resulting in no stack protector implementation. It
appears that optimization somehow avoids this problem?

To fix this inject LibC/ssp.cpp as we do with in dynamic loader.
2021-05-23 20:17:00 +01:00
Daniel Bertalan
d23425bfc0 LibC: Use \010 for erasing instead of \0177
We ignore \0177 in the terminal -- as the ANSI standard dictates.

Fixes #7415
2021-05-23 19:32:31 +02:00
Gunnar Beutner
39f0739381 LibC+UE: Keep more unused chunked blocks around
Previously each malloc size class would keep around a limited number of
unused blocks which were marked with MADV_SET_VOLATILE which could then
be reinitialized when additional blocks were needed.

This changes malloc() so that it also keeps around a number of blocks
without marking them with MADV_SET_VOLATILE. I termed these "hot"
blocks whereas blocks which were marked as MADV_SET_VOLATILE are called
"cold" blocks because they're more expensive to reinitialize.

In the worst case this could increase memory usage per process by
1MB when a program requests a bunch of memory and frees all of it.

Also, in order to make more efficient use of these unused blocks
they're now shared between size classes.
2021-05-23 19:31:39 +02:00
Tobias Christiansen
bd2b17a70e LibGfx: Replace ellipse drawing algorithm
The new one is way more naive and not as fancy as the old one, but it
doesn't crash when trying to draw circles.
This algorithm just sweeps the angles required by the call, makes sure
each segment is at most 1 (pixel) long and just uses the standard
parameterization to find the coordinates of each point on the ellipse.
2021-05-23 18:28:27 +02:00
Gunnar Beutner
6a194869cf Hearts: Add key combinations to letting the AI play for you
A single card can be played with F10 while Shift-F10 toggles the AI
for the current as well as all future tricks.
2021-05-23 18:15:36 +02:00
Gunnar Beutner
2dfced2501 Hearts: Let the AI prefer lead cards for which other cards are in play
When picking a lead card the AI should avoid playing cards where it
knows that no other player has a lower value card of the same type.
2021-05-23 18:15:36 +02:00
Gunnar Beutner
647d0f9f8a Hearts: Fix sorting function for lead cards
The pick_lead_card() function sometimes picks the incorrect card
because the sorted_hand vector wasn't being sorted properly.
2021-05-23 18:15:36 +02:00
Brendan Coles
efef77a154 HexEditor: Add 'Go to Offset...' dialog 2021-05-23 18:13:49 +02:00
Jean-Baptiste Boric
dd6921bfc6 LibProtocol: Fix non-constant usage of PAGE_SIZE 2021-05-23 18:10:29 +02:00
Jean-Baptiste Boric
d92b6423bf Utilities: Fix test-unveil INT_MAX include 2021-05-23 18:10:29 +02:00
Jean-Baptiste Boric
8e6241b78b LookupServer: Fix missing POSIX includes 2021-05-23 18:10:29 +02:00
Jean-Baptiste Boric
5ced9a3dfb ImageDecoder: Fix narrowing cast of loop count 2021-05-23 18:10:29 +02:00
Jean-Baptiste Boric
4d332f3930 Utilities: Fix fgrep assertion include 2021-05-23 18:10:29 +02:00
Idan Horowitz
fd68e606e7 CI: Make BuggieBot reply to pull requests that fail the commit linter
This should help reduce the repeating "Please check the contributing
guide" replies from reviewers.
2021-05-23 18:09:54 +02:00
Andreas Kling
873eb47d2b ps: Sort output by PID :^) 2021-05-23 11:26:19 +02:00
Andreas Kling
a1e133cc6b LibCore: Make ProcessStatisticsReader return results in a Vector
The HashMap API was overkill and made using this less ergonomic than
it should be.
2021-05-23 11:10:15 +02:00
Andreas Kling
a345a1f4a1 Userland: Mark subclasses of IPC::{Client,Server}Connection final 2021-05-23 09:53:55 +02:00
Andreas Kling
c1c252ddb2 LibIPC: Remove unnecessary IPC::ServerConnection::handshake()
This is no longer used by any of our IPC pairs.
2021-05-23 09:53:55 +02:00
Andreas Kling
2eceabdcfd LibGUI: Handle fast_greet stuff in WindowServerConnection constructor
Move the from handshake() to the constructor (and move the constructor
out-of-line while we're at it.)

This prepares getting rid of the handshake() mechanism since this is
the only remaining user.
2021-05-23 09:53:55 +02:00
Andreas Kling
0af69e8917 HackStudio: Greet language servers asynchronously
There's no need to wait for a response after we've sent the project
path to a newly connected language server.
2021-05-23 09:53:55 +02:00
Andreas Kling
67b47d62f3 WebContent: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
6b2f24018d RequestServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
bf33b5df6e WebSocket: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
03df8882df InspectorServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
78b57fcea3 NotificationServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
5424372d50 AudioServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
e7fc46879e LaunchServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
de07dab184 ImageDecoder: Remove unnecessary greet() message
This didn't do anything except induce an IPC stall during startup.
2021-05-23 09:53:55 +02:00
Brian Gianforcaro
6ebec090c3 Userland: Allow nc to connect by hostname instead of just address
Allow the user to pass in a hostname to the connect functionality
instead of just an ip address. The call to gethostbyname(..) handles
both seamlessly for us.

Update the argument name / usage message accordingly.
2021-05-23 09:19:16 +02:00
Brian Gianforcaro
2b10c34f5c Meta: Clarify atomic commits in CONTRIBUTING.md 2021-05-23 08:38:30 +02:00