Commit graph

45306 commits

Author SHA1 Message Date
Sam Atkins 306676792c Solitaire: Make Game creation fallible 2023-01-06 16:03:50 +01:00
Sam Atkins 6e0ad5536f AK: Export adopt_nonnull_ref_or_enomem to the global namespace 2023-01-06 16:03:50 +01:00
Sam Atkins d7ba577c90 LibCards+Games: Make CardGame::add_stack() fallible
And while we're at it, handle the CardStack allocation (and failure
thereof) internally.
2023-01-06 16:03:50 +01:00
Timothy Flynn 08ff87b3ce Solitaire: Preview cards in a stack with the right mouse button 2023-01-06 15:55:37 +01:00
Timothy Flynn 2a1fb77faf LibCards: Support "previewing" cards that may be covered by other cards
For example, in Solitaire, the vertical normal stacks cover the suit of
all but the topmost card in the stack. To see the suit of covered cards
the user currently has to move the cards on top of them out of the way.

This adds an API for games to set a card at a location to be previewed,
which will draw that card on top of all other cards without moving it.
2023-01-06 15:55:37 +01:00
Lucas CHOLLET c0bc3b9814 FileSystemAccessServer: Use Core::Stream
This patch also updates corresponding functions from
`LibFileSystemAccessServerClient`.

From the FileSystemAccessClient point of view, it only makes the server
take `Core::Stream::OpenMode` instead of `Core::OpenMode`. So, `enum`
conversions only happen within deprecated functions and not in the new
`Core::Stream` friendly API.

On the server side, it just removes two usages of `Core::File::open()`.
2023-01-06 14:52:29 +00:00
Lucas CHOLLET 4e164c9de7 Meta: Pass Core::Stream::OpenMode by value in the IPCCompiler 2023-01-06 14:52:29 +00:00
Lucas CHOLLET fe2ab2bd8c LibIPC: Add File(Core::Stream::File& file, ...) 2023-01-06 14:52:29 +00:00
Lucas CHOLLET f0d2a8dd57 LibCore: Add Stream::File::leak_fd(Badge<IPC::File>) 2023-01-06 14:52:29 +00:00
Tim Ledbetter 0cf29f6c45 PixelPaint: Draw polygonal select tool lines with two colors
This stops lines from disappearing when entering a dark area of the
image.
2023-01-06 15:41:48 +01:00
Tim Ledbetter 2f6c71c829 PixelPaint: Draw the lasso tool preview path with two colors
This stops the preview path disappearing when entering a dark area of
the image.
2023-01-06 15:41:48 +01:00
Luke Wilde a6716e694d CI: Automatically apply pull request labels for generic PR actions
Generic PR actions include opening a PR, submit review comments, adding
new commits, etc. This prevents the reviewer and PR submitter from
having to manually bounce the labels back and forth in the general
case. The reviewer also may not have permission to set labels, meaning
the reviewer won't be able to update the labels accordingly themselves.

This does not handle more subjective labels such as pr-is-blocked and
pr-unclear. Unfortunately, there does not seem to be a GitHub Actions
trigger for when a PR has merge conflicts, so the pr-has-conflicts
label cannot be automatically applied.

Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
2023-01-06 15:25:30 +01:00
Andreas Kling 3332ce01ce LibGUI: Simplify GUI::Label preferred height calculation
No need to use a TextLayout here, we can just count the number of lines
and multiply that by the font's preferred line height.

In addition to being much simpler, it also fixes a bug where labels were
got too tall if we calculated their preferred height before assigning
a final width to them.
2023-01-06 13:43:04 +01:00
Andreas Kling ef7eb60f22 Terminal: Run clang-format on main.cpp 2023-01-06 13:04:20 +01:00
Andreas Kling 70c0c1c845 LibWeb: Use default system fonts for serif, sans-serif, etc. 2023-01-06 12:02:21 +01:00
Andreas Kling b2d3ceaec5 LibGfx: Make text painting better at aligning vector fonts vertically
This is achieved by simplifying the logic in TextLayout. We get rid
of all the various ways that the layout bounding rect can get cropped.
Then we make sure to use the right pixel metrics.

Finally we use the font's own line gap metrics instead of hard-coding 4.

The end result is that text painted with vector fonts now gets pretty
reasonable vertical alignment in most cases.
2023-01-06 12:02:21 +01:00
Andreas Kling f5e18dda2b LibGfx: Make BitmapFont's line gap be Gfx::Painter::LINE_SPACING
This is the closest thing we have to the OpenType line gap metrics.
Using it here will allow us to unify more of the text painting logic.
2023-01-06 12:02:21 +01:00
Andreas Kling f9a62900b7 LibGfx: Round menu font size up when calculating menubar height 2023-01-06 12:02:21 +01:00
Andreas Kling c8b286084b WindowServer: Round menu item font sizes up when calculating height 2023-01-06 12:02:21 +01:00
Andreas Kling dd8d65ada0 LibGUI: Tweak GUI::Label auto-sizing logic for floating point font sizes
We have to ceil the font size or we risk being 1px too small.
2023-01-06 12:02:20 +01:00
Andreas Kling d2195f8088 LibGfx: Use Gfx::Rect::align_within() to simplify text drawing logic
Instead of doing this manually, just use the helper we already have.
2023-01-06 12:02:20 +01:00
Andreas Kling 6b421fb521 LibGfx: Slim down Gfx::TextLayout API by removing unused accessors
Also store the Font as a const reference instead of a raw pointer,
since we don't allow a null Font here.
2023-01-06 12:02:20 +01:00
Andreas Kling 65c8cd37e3 LibGfx: Make ScaledFont::glyph_height() return the pixel height
This was returning the point height which didn't match BitmapFont and
led to bogus line heights in GUI::TextEditor.
2023-01-06 12:02:20 +01:00
Andreas Kling cddcf531b1 LibGfx: Remove unused Font::point_size() 2023-01-06 12:02:20 +01:00
Andreas Kling 2a61d66b0a LibGfx: Make Font::preferred_line_height() more correct
Return a float, and fix a bogus calculation of ascender + descender.
2023-01-06 12:02:20 +01:00
Andreas Kling 43a10674d0 Terminal: Add zoom in/out action to increment/decrement the font size 2023-01-06 12:02:20 +01:00
Andreas Kling 8887766607 LibGfx: Remove bogus rounding in FontPixelMetrics::line_spacing() 2023-01-06 12:02:20 +01:00
Andreas Kling bb0c5f8ab4 LibGfx/OpenType: Use typographic metrics when asked to by the OS/2 table 2023-01-06 12:02:20 +01:00
Andreas Kling c3018f8beb LibVT: Simplify TerminalWidget::widget_size_for_font()
Reuse the base size calculation from compute_base_size() instead of
duplicating it.
2023-01-06 12:02:20 +01:00
Andreas Kling ddc0c13007 LibVT: Use font pixel height (pixel_size) when calculating line heights 2023-01-06 12:02:20 +01:00
Andreas Kling 2e1b8b90f4 LibVT: Compute the font metrics once and cache them
The height of a line or column doesn't change unless the font changes,
and we were already caching the line height. This patch extends it so
we also cache the column width.
2023-01-06 12:02:20 +01:00
Andreas Kling b4946eac6e LibVT: Fix bug where terminal size got lost on font size change
When changing the font size, we now resize the terminal widget *before*
setting the font. This ensures that we keep the same logical terminal
size after the font change.
2023-01-06 12:02:20 +01:00
Timothy Flynn 4cbdc747ab LibCards+Solitaire: Elevate card highlight management to the card stack
Instead of indicating which individual cards should be highlighted, card
games now indicate which stack is highlighted. This lets the stack draw
empty stacks with a highlight (e.g. the Foundation stack in Solitaire).
If the stack is non-empty, the stack can delegate highlighting to the
top-most card.
2023-01-06 12:02:10 +01:00
Timothy Flynn 8d8fcd0d64 LibCards: Draw the inside of card highlight rects with rounded corners
Currently, the outside of the card highlight has rounded corners, but
the inside has square corners. It looks a bit more polished if they are
both rounded.
2023-01-06 12:02:10 +01:00
Aliaksandr Kalenik c6d494513e AK: Fix typo in -= operator of DistinctNumeric 2023-01-06 12:01:46 +01:00
Aliaksandr Kalenik b2a04ff48a LibWeb: Consider percent and fixed widths in table column distribution
Change column distribution to take in account is_length() and
is_percentage() width values instead of treating all cells like
they have auto width by implementing it in the way described
in CSS Tables 3 spec:
https://www.w3.org/TR/css-tables-3/#width-distribution-algorithm

distribute_width_to_column() is structured to follow schema:
w3.org/TR/css-tables-3/images/CSS-Tables-Column-Width-Assignment.svg
2023-01-06 12:01:46 +01:00
Aliaksandr Kalenik 21d89a2153 LibWeb: Use available space to resolve table cells width
It is not possible to use width of containing block to resolve
cells width because by the time compute_table_measures() is
called row width is not known yet.
2023-01-06 12:01:46 +01:00
BodilessSleeper 90b43712e6 LibJS: Rename ToIntegerThrowOnInfinity to ToIntegerWithTruncation
This commit ticks away two of the boxes in #15525
Temporal commits: tc39/proposal-temporal@f274678 and
tc39/proposal-temporal@a63a0fb
2023-01-06 11:16:55 +01:00
BodilessSleeper 18122c0368 LibJS: Replace "is not zero" language in Temporal comments
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@9cd448a
2023-01-06 11:16:55 +01:00
Liav A 3d87445c82 Kernel: Restore setting i8042 scan code set to scan code set 2 sequence
This seems to work perfectly OK on my ICH7 test machine and also it
works on QEMU, so it is probably OK to restore this.
This will ensure we always get scan code set 1 input, because we enable
scan code set 2 and PS/2 translation on the first (keyboard) port.
2023-01-06 11:09:56 +01:00
Liav A 0f7cc468b2 Kernel: Make i8042 controller initialization sequence more robust
The setting of scan code set sequence is removed, as it's buggy and
could lead the controller to fail immediately when doing self-test
afterwards. We will restore it when we understand how to do so safely.

Allow the user to determine a preferred detection path with a new kernel
command line argument. The defualt option is to check i8042 presence
with an ACPI check and if necessary - an "aggressive" test to determine
i8042 existence in the system.
Also, keep the i8042 controller pointer on the stack, so don't assign
m_i8042_controller member pointer if it does not exist.
2023-01-06 11:09:56 +01:00
Tim Ledbetter fc5bcd8476 PixelPaint: Allow repeated zooming with the zoom tool
Previously, the zoom tool only allowed the user to zoom in or out
once, as it didn't take account of the current zoom level.
2023-01-06 00:34:38 +01:00
Liav A a9839d7ac5 Kernel/SysFS: Don't refresh/set-values inside the Jail spinlock scope
Only do so after a brief check if we are in a Jail or not. This fixes
SMP, because apparently it is crashing when calling try_generate()
from the SysFSGlobalInformation::refresh_data method, so the fix for
this is to simply not do that inside the Process' Jail spinlock scope,
because otherwise we will simply have a possible flow of taking
multiple conflicting Spinlocks (in the wrong order multiple times), for
the SysFSOverallProcesses generation code:
Process::current().jail(), and then Process::for_each_in_same_jail being
called, we take Process::all_instances(), and Process::current().jail()
again.
Therefore, we should at the very least eliminate the first taking of the
Process::current().jail() spinlock, in the refresh_data method of the
SysFSGlobalInformation class.
2023-01-05 23:58:13 +01:00
Timothy Flynn 76b9d06b19 LibJS: Add and begin using a completion-compatible string builder
ThrowableStringBuilder is a thin wrapper around StringBuilder to map
results from the try_* methods to a throw completion. This will let us
try to throw on OOM conditions rather than just blowing up.
2023-01-05 22:07:44 +01:00
VayuDev fab8ef3dfc LibWeb: Pass FloatRect to Painter::draw_text in fill_text
Don't round float values to int values in
CanvasRenderingContext2D::fill_text when passing them to
Painter::draw_text.

This also fixes a fixme.
2023-01-05 15:47:40 -05:00
MacDue 93737a4b00 LibWeb: Return floats from color stop resolution functions
These don't deal with pixels so should not return CSSPixels. This
removes one suspicious looking cast.
2023-01-05 19:56:43 +01:00
Sam Atkins 33b6ac0306 Base: Add some unlisted test pages to welcome.html 2023-01-05 18:54:33 +00:00
BodilessSleeper 8e6920a18d LibJS: Convert calendar operation results to floats
This commit ticks away one of the boxes in #15525
Temporal commit:  tc39/proposal-temporal@11aad40
2023-01-05 19:49:09 +01:00
Ben Wiederhake c25bef59aa Kernel: Repair build for aarch64
This broke in 6fd478b6ce due to
insufficient testing on my part. Sorry!
2023-01-05 19:47:07 +01:00
Nico Weber 7f4680a377 Kernel/aarch64: Remove counterproductive volatile
Should not be needed, and triggers -Wvolatile in gcc.
See discussion on #16790.
2023-01-05 19:45:27 +01:00