Commit Graph

20781 Commits

Author SHA1 Message Date
Marcus Nilsson
ee48dac300 Bitmap: Don't call Bitmap::create with width/height equal to 0
With very small bitmaps and small scale factor, such as tile.png, the
type conversion in the call to Bitmap:create would cause width or
height to be 0.

Fixes #7352
2021-05-22 13:26:08 +02:00
Gunnar Beutner
1ae18c1228 Hearts: Let the AI pick better lead cards
Instead of picking the card with the lowest value we should pick the
card with the highest value for which we know no lower value card is
in play anymore and that someone else still has an even higher value
card.
2021-05-22 12:03:31 +01:00
Gunnar Beutner
c2a4b581fe Hearts: Prefer to play Queen of Spades when we're the trailing player
Previously in a trick like 2S, KS, 5S we'd rather follow up with AS
instead of QS. We should prefer to play QS in this case.
2021-05-22 12:03:31 +01:00
Gunnar Beutner
0dd22c4e23 Hearts: Fix crash when starting an animation when there already is one
This ensures that the preceding animation is stopped first.
2021-05-22 12:03:31 +01:00
Gunnar Beutner
630430379e LibCards: Correct a spelling mistake 2021-05-22 12:03:31 +01:00
Gunnar Beutner
dfa2075887 Hearts: Remove dead code 2021-05-22 12:03:31 +01:00
Liav A
72c097530f Revert "Kernel: Fix PCI layout of i440fx QEMU machine"
This reverts commit 5018b3b4b7.

Let's help our future selves by making sure we don't introduce a bug
because of duplicating a network interface name or related bug to this
topic. Therefore, we can have multiple e1000 devices in the system now.
2021-05-22 11:19:50 +01:00
Liav A
8d0280ca09 Kernel/Net: Make interfaces to have persistent names
There's no good reason to distinguish between network interfaces based
on their model. It's probably a good idea to try keep the names more
persistent so scripts written for a specific network interface will be
useable after hotplug event (or after rebooting with new hardware
setup).
2021-05-22 11:19:50 +01:00
Lenny Maiorani
1c6d2ff21c IntrusiveList: Remove redundant constructor
Problem:
- The constructor is defined to be the default constructor.

Solution:
- Let the compiler generate the destructor by setting it to the
  default.
2021-05-22 10:11:14 +01:00
Ryan Wilson
1965d60aeb
GameOfLife: Add choosable patterns 2021-05-22 09:54:58 +01:00
Ali Mohammad Pur
b808815e57 Meta: Display DistinctNumeric as its alias name in GDB if possible
All DistinctNumerics are given an identifying tag, if the tag is
generated by the macro, print the alias instead of DistinctNumeric.
2021-05-22 13:21:00 +04:30
Ali Mohammad Pur
3d0786f96b Meta: Add GDB pretty printer for AK::Variant 2021-05-22 13:21:00 +04:30
Ali Mohammad Pur
37651a28e1 Meta: Pretty-print the types in serenity_gdb.py
DistinctNumeric<T, ...> and some other types are very long, but the
template arguments provide no particular value, so just don't show them
2021-05-22 13:21:00 +04:30
Brendan Coles
d1623350b5 HexEditor: Add 'Select All' action 2021-05-22 13:13:49 +04:30
Andreas Kling
ee5cf92b3d LibVT: Don't cache bold variant of VT font in a member variable
Remove some leftovers from back when we had to resolve a bold variant
of the terminal font manually. Now we can just use bold_variant().
2021-05-22 10:21:52 +02:00
Andreas Kling
636c43db6c WindowServer: Notify window-less clients about theme/font changes 2021-05-22 10:21:52 +02:00
Jelle Raaijmakers
3dc0657e58 AK/Vector: Constify find_first_index() 2021-05-22 09:34:55 +02:00
Ali Mohammad Pur
6b4d7b6c19 AK: Fix Variant construction from lvalue references
Fixes #7371 and appends its test cases.
2021-05-22 09:34:31 +02:00
Ali Mohammad Pur
3f350c3b65 AK: Remove [[gnu::noinline]] attribute from some variant members
These were left-overs from a debugging session :P
2021-05-22 09:34:31 +02:00
Idan Horowitz
3bc3a7a23a AK: Use calculate_base64_encoded_length in encode_base64
We were accidentally calling calculate_base64_decoded_length instead,
which resulted in extra allocations during the StringBuilder::append
calls that can be avoided.
2021-05-22 08:54:32 +04:30
Tobias Christiansen
155d876c44 LibGfx: Support alpha in rendering methods for border-radius
The methods used in displaying border-radius were ignoring alpha.
2021-05-22 00:21:02 +02:00
Mart G
e16a50b586
Kernel: Remove an allocation from VFS::resolve_path_without_veil (#7287)
Use GenericLexer to replace a call to StringView::split() since that
returns its result in a heap-allocating Vector.
2021-05-22 00:12:32 +02:00
Andrew Kaster
467ceb15aa Base/CI: Create and check test-results.log file for on-target tests
Change run-tests-and-shutdown.sh to output a dead simple results file
that just records how many tests failed.

In the CI script, mount the _disk_image after running tests and verify
that the number of failed tests is 0. Otherwise, fail the build :^)

While we're here, bump the timeout for the tests up to 30 minutes, to
make sure that less powerful runners don't fail the job unecessarily.
2021-05-21 22:59:07 +01:00
Andrew Kaster
b86d597938 CI: Add canonical-server/server-backports PPA to get updated QEMU
Ubuntu 20.04 only ships QEMU 4.2.1, which is quite an older release.

The BuildQemu.sh script uses version 6.0.0, while the server-backports
PPA is currently shipping 5.2.1. If it turns out the server-backports
PPA is not right, then we can switch to manually building and caching
the source build.
2021-05-21 22:59:07 +01:00
Lenny Maiorani
6ac454e70a DevTools: Remove redundant default destructor and forward declarations
Problem:
- Default destructors (and constructors) are in `.cpp` files. This
  prevents the compiler's optimizer from inlining them when it thinks
  inlining is appropriate (unless LTO is used).
- Forward declarations can prevent some optimizations, such as
  inlining of constructors and destructors.

Solution:
- Remove them or set them to `= default` and let the compiler handle
  the generation of them.
- Remove unneeded forward declarations.
2021-05-21 22:53:33 +01:00
Luke
4d34802f74 LibJS: Expose TypedArray.prototype.byteOffset 2021-05-21 22:52:35 +01:00
Luke
58afd71ad2 LibJS: Expose TypedArray.prototype.byteLength 2021-05-21 22:52:35 +01:00
Luke
8004a2dc77 LibJS: Expose TypedArray.prototype.buffer 2021-05-21 22:52:35 +01:00
Luke
6f1688279a LibJS: Expose BYTES_PER_ELEMENT on each TypedArray 2021-05-21 22:52:35 +01:00
Andreas Kling
7d12f49e74 Base: Unregister "md" extension from Browser
These are already handled by TextEditor, and I think it's a lot nicer
to open them there anyway.
2021-05-21 23:38:29 +02:00
Liav A
5e81464245 Kernel/Commandline: Allow the user to specify an embedded string
This is by default left empty, so people won't run the kernel in a mode
which they didn't want to. The embedded string will override the
supplied commandline from the bootloader, which is good for debugging
sessions.

This change seemed important for me, because I debug the kernel on bare
metal with iPXE, and every change to the commandline meant that I needed
rewrite a new iPXE USB image with a modified iPXE script.
2021-05-21 22:38:26 +01:00
Liav A
b8f0a9c974 Kernel/CPU: Fix awkward printing early on boot
This usage of the word "installing" seemed for me for a long time as
a wrong thing, so let's make it better now.
2021-05-21 22:38:26 +01:00
Liav A
df84fdfd2c Kernel: Print commandline after initializing it 2021-05-21 22:38:26 +01:00
Liav A
e9ef3b59d8 Kernel/VirtualConsole: Fix grammar error in comment 2021-05-21 22:38:26 +01:00
Gunnar Beutner
c3efae85f2 Games: Add Hearts 2021-05-21 23:38:18 +02:00
Gunnar Beutner
3e47eec862 Solitaire: Move cards functionality into LibCards 2021-05-21 23:38:18 +02:00
Max Wipfli
9440a3c280 LibWeb: Improve Unicode compatibility of HTML contenteditable
This patch updates the Page::keydown_event event handler to implement
crude Unicode support. It implements new method in EditEventHandler to
more easily handle deleting a single character after the cursor.
Furthermore, it makes use of the previously implemented methods to
increment and decrement the cursor position, which take into account
that Unicode codepoint may be multiple bytes wide.

This means it is now possible to mostly edit Unicode in editable DOM
nodes without any crashes. :^)
2021-05-21 21:57:03 +02:00
Max Wipfli
7181cb3a9c LibWeb: Frame/Position: Implement cursor increment/decrement methods
This introduces methods to increment and decrement the cursor position.
This is non-trivial as the cursor position is specified in bytes rather
than codepoints. Thus, it sometimes needs to be incremented or
decremented by more than one, depending on the codepoint to "jump over".

Because the cursor blink cycle needs to be reset after moving the
cursor, methods calling the ones in DOM::Position are implemented in
Frame. Furthermore, this allows the cursor_position() getter to stay
const. :^)

Additionally, it adds a offset_is_at_end_of_node() method which checks
if the current offset points to the end of the node.
2021-05-21 21:57:03 +02:00
Max Wipfli
08d09c4afb LibWeb: Improving cursor behavior in editable DOM nodes
This patch makes two modifications to improve the behavior of cursors in
editable DOM nodes, such as HTML tags with the contenteditable
attribute.

When the cursor blink cycle is reset in an editable DOM node, a repaint
should be initiated. For this, set_needs_display() needs to be called on
the layout node. Previously, the cursor blink cycle would not reset
properly and moving the cursor with the arrow keys did not feel
intuitive.

Furthermore, this modifies one of the conditions necessary to actually
paint the cursor, which previously prevented it from being painted when
at the end of a text node, after all the text present.
2021-05-21 21:57:03 +02:00
Max Wipfli
d7df6de6a6 LibWeb: Do nothing when pressing modifier keys in HTML contenteditable
Before this patch, pressing modifier keys such as Ctrl would insert
whitespace into editable DOM nodes. This patch crudely fixes that
behavior by checking if the codepoint associated with the event is
non-zero.
2021-05-21 21:57:03 +02:00
Max Wipfli
157f72e9d7 LibWeb: Replace some TODO() calls with FIXME comments in EventHandler
This patch downgrades some TODO() calls when the cursor in an editable
DOM node should move to the previous or next node. Previously, the
process would crash, whereas now, the cursor will just stay where it
was.

This seems more sensible for now, as there is no reason to crash just
because of this.
2021-05-21 21:57:03 +02:00
Max Wipfli
a72bb34970 AK: Add Utf8View::iterator_at_byte_offset method
This implements a method to get a Utf8CodepointIterator at a specified
byte offset.
2021-05-21 21:57:03 +02:00
Max Wipfli
c1b452f754 AK: Add substring methods to Utf8View
This patch implements a Unicode-safe substring method, which can be used
when offset and length should be specified in actual characters instead
of bytes.

This can be used to mitigate issues where a string is split in the
middle of a UTF-8 multi-byte character, which leads to invalid UTF-8.

Furthermore, it implements to common shorthands for substring methods
which take only an offset and return the substring until the end of the
string.
2021-05-21 21:57:03 +02:00
Max Wipfli
8c19c2f296 AK: Change some argument and return types in Utf8View from int to size_t
This changes the return type of Utf8View::byte_length and the argument
types of substring_view from int to size_t.
2021-05-21 21:57:03 +02:00
Gunnar Beutner
7cd49ba2a2 Kernel: Ignore interfaces without an IP address when routing packages
Let's not route packages through interfaces which don't have an address
yet unless we're explicitly asked to (e.g. by DHCPClient).
2021-05-21 21:55:52 +02:00
Gunnar Beutner
eb1cecc03d Kernel: Make sure network adapters have unique names
Previously we'd just slap 0 onto the adapter's basename. This ensures
we actually end up with unique names.
2021-05-21 21:55:52 +02:00
Andrew Kaster
c6eff55439 Shell: Make sure all tests put their temp dirs in /tmp
Follow-on to #7337. Been seeing other CI test failures that point to
these temp directories, so let's just move all of them to /tmp. I'm sure
someone will write ext2fs stress tests later :^)

Example:

/usr/Tests/Shell/control-structure-as-command.sh
  Core::Socket: Failed to connect() to /tmp/portal/inspectables: ...
  + rm -rf shell-test 2>/dev/null
  + mkdir shell-test
  Error: The action has timed out.
2021-05-22 00:24:27 +04:30
Liav A
5018b3b4b7 Kernel: Fix PCI layout of i440fx QEMU machine
Some folks on discord said adding another e1000 network adapter made it
so we don't have networking on the system anymore.
To fix this, we will use other unsupported PCI device instead.
2021-05-21 21:20:10 +02:00
Andreas Kling
8f96d20b86 Tests: Remove default font tests from LibGfx/TestFontHandling
The system default font functions now rely on communication with
WindowServer and so we can't really test them here.
2021-05-21 21:02:43 +02:00
Linus Groh
3a4cbbf01c LibJS: Fix indexed access of TypedArray with byte offset
By doing the offset calculation in {get,put}_by_index() we would
delegate these operations to Object for any index >= (array length -
byte offset). By doing the offset calculation in data() instead, we can
just use the unaltered property index for indexing the returned Span.
In other words: data()[0] now returns the same value as indexing the
TypedArray at index 0 in JS.

This also fixes a bug in the js REPL which would not consider the byte
offset and subsequently access the underlying ArrayBuffer data with a
wrong index.
2021-05-21 19:29:23 +01:00