Commit Graph

12965 Commits

Author SHA1 Message Date
Andreas Kling
8f5b92865d HexEditor: Use widget override cursors 2020-09-11 14:37:30 +02:00
Andreas Kling
5872cb398c LibWeb: Use widget override cursors 2020-09-11 14:28:05 +02:00
Andreas Kling
7a2faecc15 LibGUI: Use widget override cursors in GUI::TextEditor 2020-09-11 14:26:37 +02:00
Andreas Kling
e2050ea0ce LibGUI: Use widget override cursors in GUI::Splitter 2020-09-11 14:26:37 +02:00
Andreas Kling
f475fa3f54 LibVT: Show an I-beam cursor over TerminalWidget
..and implement this using the new widget override cursor mechanism.
2020-09-11 14:26:37 +02:00
Andreas Kling
cf429a788c LibGUI: Add Widget override cursor concept
We got ourselves into a mess by making widgets override the window
cursor whenever they wanted a custom cursor. This patch introduces a
better solution to that issue: per-widget override cursors.

Each widget now has an override cursor that overrides the window
cursor when that widget is hovered.
2020-09-11 14:26:37 +02:00
Andreas Kling
b4f307f982 LibGUI+WindowServer: Rename window "override cursor" to just "cursor"
Let's just say each window has a cursor, there's not really overriding
going on.
2020-09-11 14:26:37 +02:00
Sergey Bugaev
40fbdd4e9e Ports: Add libffi 2020-09-10 19:57:38 +02:00
Tom
0fab0ee96a Kernel: Rename Process::is_ring0/3 to Process::is_kernel/user_process
Since "rings" typically refer to code execution and user processes
can also execute in ring 0, rename these functions to more accurately
describe what they mean: kernel processes and user processes.
2020-09-10 19:57:15 +02:00
Tom
19ffd9d677 Kernel: Fix detecting in what ring a crash happened
The ring is determined based on the CS register. This fixes crashes
being handled as ring 3 crashes even though EIP/CS clearly showed
that the crash happened in the kernel.
2020-09-10 19:57:15 +02:00
Andreas Kling
0f9be82826 LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and
error-prone.
2020-09-10 19:25:13 +02:00
Andreas Kling
c063a02979 Base: Improved I-beam cursor
Make the I-beam cursor white with a black outline, like all the other
cursors. This makes it show up on dark backgrounds. :^)
2020-09-10 19:05:01 +02:00
Andreas Kling
e860a9aa80 LibGUI: Unregister AbstractView from model on destruction
It was possible to leave stale view pointers in the model after a view
was destroyed while attached to a model.
2020-09-10 18:45:00 +02:00
Andreas Kling
4e0df06f86 IRCClient: Use NonnullRefPtr<IRCClient> throughout
To protect against mishaps during app exit teardown, make sure everyone
who needs to be is a co-owner of the IRCClient object.

Fixes #3451.
2020-09-10 18:45:00 +02:00
Sergey Bugaev
039e529dbe Userland: Fix a signal race condition
It has been possible for a signal to arrive in between us checking
g_interrupted and exiting - sucessfully, even though we were interrupted.

This way, if a signal arrives before we reset the disposition, we
will reliably check for it later; if it arrives afterwards, it'll
kill us automatically.
2020-09-10 16:00:11 +02:00
asynts
0055a28710 AK: Replace LogStream operator for ReadonlyBytes with dump_bytes.
It wasn't actually possible to call

    const LogStream& operator<<(const LogStream&, ReadonlyBytes);

because it was shadowed by

    template<typename T>
    const LogStream& operator<<(const LogStream& stream, Span<T> span);

not sure how I didn't find this when I added the overload.

It would be possible to use SFINAE to disable the other overload,
however, I think it is better to use a different method entirely because
the output can be very verbose:

    void dump_bytes(ReadonlyBytes);
2020-09-10 14:15:02 +02:00
Avery
06218a4074 IPv4: Truncate raw socket reads past buffer length
In addition to being the proper POSIX etiquette, it seems like a bad idea
for issues like the one seen in #3428 to result in a kernel crash. This patch
replaces the current behavior of failing on insufficient buffer size to truncating
SOCK_RAW messages to the buffer size. This will have to change if/when MSG_PEEK
is implemented, but for now this behavior is more compliant and logical than
just bailing.
2020-09-10 12:03:56 +02:00
Nico Weber
61060c0da8 LibVT: Let Terminal keep history in a circular buffer
This makes Terminal::scroll_up() O(1) instead of O(n) in the
size of the history. (It's still O(n) in the size of visible
lines.)

Reduces time to run `disasm /bin/id` with the default terminal
window size from 530ms to 409ms (min-of-5) on my system.
2020-09-10 12:01:26 +02:00
Nico Weber
90d9c83067 LibVT: Let Terminal only expose history_size, not storage 2020-09-10 12:01:26 +02:00
AnotherTest
927e2fc6bc Shell: Do not reset the terminal attributes when command is run in bg
Also removes a FIXME that no longer applies.
2020-09-10 11:20:22 +02:00
AnotherTest
c296bcc1d9 Base: Tweak Shell(5) manpage a bit
Someone brought to my attention that "or missing" is not correct there.
2020-09-10 11:20:22 +02:00
Devashish Jaiswal
2a3166e523
JPGLoader: Check existence of Huffman tables in scan header segment (#3442)
DC and AC table IDs read in the scan header segment weren't validated
against the IDs of Huffman tables read in the DHT segment. This caused
an OOB read when a Huffman table was accessed using the ID read in the
scan header segment. Furthermore, the decoder now replaces the old DC
or AC table if a redefinition has been found prior to the scan header.

Fixes #3439.
2020-09-10 11:20:04 +02:00
Andreas Kling
d830c107ce LibJS: Deal with a FIXME in Shape::ensure_property_table()
Prevent GC while messing with the shape transition chain.
2020-09-09 21:34:02 +02:00
Andreas Kling
606f83436d test-js: Catch SIGINFO and dump the current test name + pass/fail/skip
This is pretty handy if the JS tests take a long time to run and you
wonder what they're doing. :^)
2020-09-09 21:10:23 +02:00
Andreas Kling
f8e59addf7 Kernel+LibC+UE: Introduce SIGINFO (generated with ^T)
This signal is ignored by default, but can be caught to implement state
reporting a la BSD. :^)
2020-09-09 21:10:23 +02:00
Andreas Kling
687aad01be test-js: Add -g option to run a garbage collection on each allocation
This is very slow, but very good at flushing out GC bugs. :^)
2020-09-09 21:10:23 +02:00
Nico Weber
01ff17d374 LibGUI: Do not paint scrollbar button highlight for scrollbars without scrubber
If a scrollbar doesn't have a scrubber (because the view it scrolls is
large enough to display all its contents without scrolling), then
it ignores all clicks. We shouldn't draw a hover highlight that suggests
clickability in that case.
2020-09-09 21:04:15 +02:00
AnotherTest
34d210ecf5 Shell: Update the Shell(5) manpage
This patchset adds the following to the manpage:
- Mention `if` expressions.
- Add section about subshells
- Mention that control structures can now be used as commands
- Update the grammar.
- Fix small header size mistake with "Example"'s being larger than their
  containing sections.
2020-09-09 20:35:21 +02:00
AnotherTest
2488815bdb Shell: Add some tests for subshells 2020-09-09 20:35:21 +02:00
AnotherTest
b194d79c53 Shell: Add the (now) free subshell support 2020-09-09 20:35:21 +02:00
AnotherTest
0fd8d5ad3d Shell: Add a test for control structures as commands 2020-09-09 20:35:21 +02:00
AnotherTest
54b453be57 Shell: Fix event loop processing and backgrounding in subshells 2020-09-09 20:35:21 +02:00
AnotherTest
c3dbe77024 LibCore: Add 'notify_forked()' to tear down the eventloop in forked child
This makes the forked process capable of constructing a new event loop,
should it choose to.
2020-09-09 20:35:21 +02:00
AnotherTest
aa2df9277d Shell: Allow control structures to appear in pipe sequences
This makes commands like the following to be possible:
```sh
$ ls && for $(seq 10) { echo $it }
$ ls | for $(seq 1) { cat > foobar }
```
2020-09-09 20:35:21 +02:00
AnotherTest
7b5ead64a5 Shell: Announce job events at the right times
This fixes a duplicate message when running `jobs` for the first time
after a job has been moved to the background.
Also actually announces background exits now :^)
2020-09-09 20:35:21 +02:00
AnotherTest
715e11f692 Shell: Fix job control and backgrounding
This patchset makes the shell capable of lazily resolving and executing
sequences of commands, to allow for putting logical sequences in the
background.
In particular, it enables And/Or/Sequence nodes to be run in the background,
and consequently unmarks them as `would_execute`.
Doing so also fixes job control to an extent, as jobs are now capable of
having 'tails', so sequences can be put in the background while
preserving their following sequences.
2020-09-09 20:35:21 +02:00
Nico Weber
a2a54f459f sleep: Make variable written in signal handler volatile
No difference in practice, but it's tidier and protects us
if we ever use g_interrupted earlier in main -- in that case,
the compiler might chose to keep the variable in a register without
the volatile.

Found by @bugaevc, thanks!
2020-09-09 20:25:19 +02:00
asynts
a7f786fc0a AK: Use TypedTransfer in Span::copy_to. 2020-09-09 20:15:50 +02:00
asynts
910924f559 AK: Moved TypedTransfer into it's own header. 2020-09-09 20:15:50 +02:00
Tom
678bbd29ca Kernel: Fix heap expansion loop
By being a bit too greedy and only allocating how much we need for
the failing allocation, we can end up in an infinite loop trying
to expand the heap further. That's because there are other allocations
(e.g. logging, vmobjects, regions, ...) that happen before we finally
retry the failed allocation request.

Also fix allocating in page size increments, which lead to an assertion
when the heap had to grow more than the 1 MiB backup.
2020-09-09 20:14:30 +02:00
Tom
efe2b75017 Kernel: Optimize single physical page allocation and randomize returns
Rather than trying to find a contiguous set of bits of size 1, just
find one single available bit using a hint.

Also, try to randomize returned physical pages a bit by placing them
into a 256 entry queue rather than making them available immediately.
Then, once the queue is filled, pick a random one, make it available
again and use that slot for the latest page to be returned.
2020-09-09 13:02:14 +02:00
Tom
92e400c7f9 AK: Add Bitmap::find_one_anywhere and optimize Bitmap::find_first
Leverage constexpr and __builtin_ffs for Bitmap::find_first. Also add
a variant Bitmap::find_one_anywhere that can start scanning at a
provided hint.

Also, merge Bitmap::fill_range into the already existing Bitmap::set_range
2020-09-09 13:02:14 +02:00
Nico Weber
42153221a5 sleep: On SIGINT, call default SIGINT handler after printing remaining time
With this, hitting ctrl-c twice in `for i in $(seq 10) { sleep 1 }`
terminates the loop as expected (...well, I'd expect it to quit after
just one ctrl-c, but serenity's shell makes a single ctrl-c only
quit the current loop iteration).

Part of #3419.
2020-09-09 12:44:35 +02:00
Tom
92bfe40954 Kernel: Keep signal state in sync
In c3d231616c we added the atomic variable
m_have_any_unmasked_pending_signals tracking the state of pending signals.
Add helper functions that automatically update this variable as needed.
2020-09-09 12:43:56 +02:00
Jakob-Niklas See
dcc2c8a125
LibWeb: Add support for viewport-relative length units (#3433)
We can now use vh, vw, vmax and vmin as length units in CSS.
2020-09-08 20:39:09 +02:00
Andreas Kling
d467a0ffef LibJS: ArrayIterator needs to mark the array it's iterating 2020-09-08 16:20:34 +02:00
Andreas Kling
3143fea1eb LibJS: GlobalObject needs to mark the iterator prototypes
Otherwise they all disappear in the first garbage collection.
2020-09-08 15:37:39 +02:00
Andreas Kling
b32c0c8181 LibJS: Convert two suspicious Vector<Value> to MarkedValueList 2020-09-08 14:16:59 +02:00
Andreas Kling
d85eed585c LibJS: get_iterator_values() should pass Value to callback (not Value&)
Value& implies that the callback is expected/able to modify the value,
which is not the case.
2020-09-08 14:15:13 +02:00
Andreas Kling
b4bfc3ed54 Spreadsheet: Add "final" to JS objects and tweak declarations 2020-09-08 14:11:43 +02:00