Commit graph

49583 commits

Author SHA1 Message Date
Jelle Raaijmakers
0f22dfa634 LibAudio: Make WavWriter check if a file was set during destruction
`WavWriter` can be constructed without a file, which should probably be
made impossible at some point. For now, let's not crash `Piano` when you
close the application.
2023-04-25 15:34:14 +02:00
Andreas Kling
1c6c3685c4 Ladybird: Remove Web::Platform plugins for Qt in favor of LibCore
Now that the Core::EventLoop is driven by a QEventLoop in Ladybird,
we don't need to patch LibWeb with Web::Platform plugins.

This patch removes EventLoopPluginQt and TimerQt.

Note that we can't just replace the Web::Platform abstractions with
LibCore stuff immediately, since the Web::Platform APIs use
JS::SafeFunction for callbacks.
2023-04-25 14:48:40 +02:00
Andreas Kling
3494c2382d Ladybird: Run the Core::EventLoop with a Qt backend
This patch adds EventLoopImplementationQt which is a full replacement
for the Core::EventLoopImplementationUnix that uses Qt's event loop
as a backend instead.

This means that Core::Timer, Core::Notifier, and Core::Event delivery
are all driven by Qt primitives in the Ladybird UI and WC processes.
2023-04-25 14:48:40 +02:00
Andreas Kling
31289a8d57 LibCore: Add a hook for custom construction of EventLoopImplementation 2023-04-25 14:48:40 +02:00
Andreas Kling
16c47ccff6 LibCore: Big first step towards pluggable Core::EventLoop
The EventLoop is now a wrapper around an EventLoopImplementation.
Our old EventLoop code has moved into EventLoopImplementationUnix and
continues to work as before.

The main difference is that all the separate thread_local variables have
been collected into a file-local ThreadData data structure.

The goal here is to allow running Core::EventLoop with a totally
different backend, such as Qt for Ladybird.
2023-04-25 14:48:40 +02:00
Andreas Kling
3de8dd921e Userland: Remove serialize-to-JSON functions only used for Inspector 2023-04-25 14:48:40 +02:00
Andreas Kling
c756e021a7 Userland: Remove "Inspector" program and related utilities
This program has never lived up to its original idea, and has been
broken for years (property editing, etc). It's also unmaintained and
off-by-default since forever.

At this point, Inspector is more of a maintenance burden than a feature,
so this commit removes it from the system, along with the mechanism in
Core::EventLoop that enables it.

If we decide we want the feature again in the future, it can be
reimplemented better. :^)
2023-04-25 14:48:40 +02:00
Andreas Kling
203e84c378 LibCore: Remove unused EventLoop::Private::lock
This mutex is no longer used for anything.
2023-04-25 14:48:40 +02:00
Andreas Kling
a6a2caf6db LibCore: Remove unused "client ID" from InspectorServerConnection
This was sharing an ID allocator with event loop timers for some reason.
More importantly, it wasn't actually used for anything.
2023-04-25 14:48:40 +02:00
Andreas Kling
8e7d7b0ec2 LibCore: Remove some unnecessary includes from EventLoop.h 2023-04-25 14:48:40 +02:00
Andreas Kling
029f5b0dad LibCore: Move deferred_invoke() implementation out of line 2023-04-25 14:48:40 +02:00
Andreas Kling
411d36719e LibCore: Simplify Core::Notifier by only allowing one event type
Not a single client of this API actually used the event mask feature to
listen for readability AND writability.

Let's simplify the API and have only one hook: on_activation.
2023-04-25 14:48:40 +02:00
Andreas Kling
1587caef84 LibCore: Move event queueing to a per-thread event queue
Instead of juggling events between individual instances of
Core::EventLoop, move queueing and processing to a separate per-thread
queue (ThreadEventQueue).
2023-04-25 14:48:40 +02:00
Andreas Kling
3a70a16ca7 LibCore: Remove unused EventLoop::wake_current() 2023-04-25 14:48:40 +02:00
Andreas Kling
9601b516b8 LibCore: Remove awkward EventLoop::wake_once() API
This was used in exactly one place, to avoid sending multiple
CustomEvents to the enqueuer thread in Audio::ConnectionToServer.

Instead of this, we now just send a CustomEvent and wake the enqueuer
thread. If it wakes up and has multiple CustomEvents, they get delivered
and ignored in no time anyway. Since they only get ignored if there's
no work to be done, this seems harmless.
2023-04-25 14:48:40 +02:00
Tim Ledbetter
896d1e4f42 LibSQL: Handle statements with malformed exists expressions correctly
Previously, statements containing malformed exists expressions such as:

`INSERT INTO t(a) VALUES (SELECT 1)`;

could cause the parser to crash. The parser will now return an error
message instead.
2023-04-25 08:32:21 -04:00
Emil Militzer
880878e552 LibWeb: Add missing valid-identifiers for display CSS property 2023-04-25 13:46:11 +02:00
Aliaksandr Kalenik
ce9d9a10b8 LibWeb: Start fleshing out Navigable::navigate()
Start implementation of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate

Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-25 12:54:01 +02:00
Aliaksandr Kalenik
1ee4a3e310 LibWeb: Add m_ongoing_navigation in Navigable 2023-04-25 12:54:01 +02:00
Andreas Kling
2626e28bb6 LibWeb: Add HTML::Task::Source::NavigationAndTraversal 2023-04-25 12:54:01 +02:00
Andreas Kling
aef36ce828 LibWeb: Add ReferrerPolicy::EmptyString
One of the valid enum values for "referrer policy" is the empty string.
Since we're using an enum for this, just add it as an enum value.
2023-04-25 12:54:01 +02:00
Andreas Kling
4d8edf65b5 LibWeb: Add HistoryHandlingBehavior::Push
Also add FIXMEs about removing no-longer-used enum values.
2023-04-25 12:54:01 +02:00
Aliaksandr Kalenik
5446c7adc3 LibWeb: Add HTML::POSTResource
This is "POST resource" from the HTML spec.
2023-04-25 12:54:01 +02:00
Emil Militzer
50af15e6b8 LibWeb: Fix the update of the favicon during navigation
The check on the currently active document for an existing favicon has
been removed. It caused an issue during navigation because the active
document will only be updated after the load and the favicon check has
been executed against the old document.
2023-04-25 06:50:34 -04:00
Zaggy1024
eba72fa3a7 LibVideo/VP9: Wait for workers to finish when there are decoding errors
Previously, the `Parser::decode_tiles()` function wouldn't wait for the
tile-decoding workers to finish before exiting the function, which
could mean that the data the threads are working with could become
invalid if the decoder is deleted after an error is encountered.
2023-04-25 06:35:13 -04:00
Pankaj Raghav
8944ca830f Kernel: Remove is_sharing_with_others API from GenericInterruptHandler
is_sharing_with_others API was never really put to use properly since
it was introduced. The only place where it is used in Interrupts.cpp is
in conjuction with is_shared_handler() which is only true for
SharedIRQHandler and is_sharing_with_others will always return false.

Remove that API.
2023-04-25 10:18:39 +02:00
Pankaj Raghav
756a73471e Kernel: Use SpinlockProtected list in SharedIRQHandler
Adding handlers to the SharedIRQHandler without any lock is not thread
safe. Use SpinlockProtected list instead.
2023-04-25 10:18:39 +02:00
Pankaj Raghav
fd8a154f8c Kernel: Set IRQHandler m_shared_with_others when the irq is shared
If IRQHandler's IRQ is shared, then disable_irq() should not call the
controller to disable that IRQ as some other device might be using it.
IRQHandler had a private variable to indicate if it is being shared:
m_shared_with_others but it was never modified even if the IRQ was
shared.

Add a new member function set_shared_with_others() to enable/disable
m_shared_with_others member of IRQHandler class. This function is
called when an IRQHandler is being added/removed as a part of
SharedIRQHandler.
2023-04-25 10:18:39 +02:00
Tim Ledbetter
868a3912f4 Base: Update reference to Help man file location 2023-04-25 02:16:48 -06:00
Tim Ledbetter
05c8aa71f2 Applications: Update man page links for applications
This commit updates all application man page links to point to the
Applications subdirectory.
2023-04-25 02:16:48 -06:00
Tim Ledbetter
9d30eb4b34 LibManual: Allow paths that include subsections when creating PageNodes
Previously, attempting to open a man file within a subsection would
fail.
2023-04-25 02:16:48 -06:00
Tim Ledbetter
2618639bdb Help: Ensure window title is updated when a subsection is selected 2023-04-25 02:16:48 -06:00
Tim Ledbetter
10700ca4c1 LibManual: Associate SubsectionNode with similarly named markdown file
For a subsection named `Foo` with a markdown file `Foo.md` in the same
directory, the document `Foo.md` will be returned when the subsection is
selected.

This prevents PageNodes and SubsectionNodes from sharing the same
name, which fixes an issue in Help where subsections could not be
navigated.
2023-04-25 02:16:48 -06:00
Timothy Flynn
f9d8e42636 LibVideo: Allocate Vector2D underlying storage with new, not malloc
Using malloc does not invoke T's constructor, nor were were invoking T's
constructor ourselves. Accessing T without invoking its constructor is
undefined behavior.
2023-04-25 02:11:11 -06:00
Emanuele Torre
bb045b3c70 Documentation: Fix markdown syntax
Use regular ascii backticks instead of U+00B4 (acute accent).
2023-04-25 01:58:05 -06:00
Karol Baraniecki
190a6650bd cal: Add the -y option to show the current year
Without `-y`, to show the current full year you'd have to specify which
one: `cal 2023`. Adding `-y` makes it possible to see the full current
year without remembering what year we are in.

This option is also stolen from FreeBSD :^)

Additionally, validate args: prevent passing both -3 and -y at the
same time. Passing both `--three-month-mode` and `--year` to `cal`
doesn't make sense. You'd either want the one or the other.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
dab82e1531 cal: Add the -3 option
This allows to view just the previous, current, and next month
simultaneously. The idea for this is shamelessly stolen from FreeBSD :^)
2023-04-25 01:54:53 -06:00
Karol Baraniecki
94e14bbe65 cal: Get default week start day from Calendar
Making it configurable in system settings :^)
The --start-day option can still overwrite this global default.

This change makes it no longer possible to use unveil: as we have
to load the Calendar config file, which might be in a dynamic location.

It's also neccessary to add `cpath` to the pledge, as opening a
nonexistent config file with Core::ConfigFile::open_for_app creates it.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
114da3a275 cal: Make start of the week configurable
Making all the other parts of the world happier :^)

Add a `--starting-day` (`-s`) option to be compatible with GNU cal,
which has a similar option. The GNU option takes allows passing either
an int or a day name. Let's do something similar using weekdays we
already have in AK/DateConstants.h.

Also add myself to the copyright header, as by now I've modified most of
the lines in this file.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
b4bec4dd2f cal: Pad days on the left with spaces instead of zeroes
I think this looks a lot prettier:
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

than that:
         01 02 03 04
05 06 07 08 09 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
2023-04-25 01:54:53 -06:00
Karol Baraniecki
af2a606f25 cal: Only show year next to each month in one-month-mode
Additionally rename a loop variable in serenity_main() because
after introducing the `Header` enum IMO it's less readable with `i`.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
a3e6b18efc cal: Fix width calculation by not leaving an extra space at month's end
Do this by constructing month rows from a Vector of Strings.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
1d47d5bb8b cal: Display month names
For now let's use them from AK/DateConstants.h, in accordance with the
FIXME those propably should be provided by the locale.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
79f5fb798a cal: Use global string widths instead of hardcoding them
...in the format strings. Additionally, get rid of magic numbers,
and make them `constexpr`.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
905f2ca152 cal: Center the month-year text
For now this only has an effect when displaying two-digit years, but
when month names get implemented this will be helpful.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
119dc042ab cal: Mark the current day as inverted text
...instead of putting a star `*` next to it. This makes `cal`s output
much prettier, and gets rid of one FIXME. :^)

Don't use the escape sequence from the deleted FIXME - \e[30;47m would
set the background to white and foreground to black - which presumably
wouldn't do much on a light-theme terminal. Instead use \e[7m which sets
the color as "inverted".
2023-04-25 01:54:53 -06:00
Karol Baraniecki
71cc35ae40 cal: Rewrite cal to use new Strings and handle errors
This additionally fixes a couple of code quality issues in `cal`,
removes reading from unset variables and writing to variables which are
never read.
2023-04-25 01:54:53 -06:00
Karol Baraniecki
812225a70c cal: Correctly identify current day
This fixes cal not highlighting the current day.

After this commit `cal` will show something like this among its output
for the 23rd day of the month

          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23*24 25
26 27 28
2023-04-25 01:54:53 -06:00
Karol Baraniecki
b57c718418 cal: Don't accept passing a [day]
Every other cal implementation just highlights the current day instead
of letting you specify a custom one to highlight. It doesn't seem to be
that useful, and is currently broken - no day gets highlighted at all,
because the `target_day` global is never written to.

Moreover, this complicates parsing the arguments. This commit also fixes
parsing a case where just a year is provided to `cal` - for example `cal
2023`.
2023-04-25 01:54:53 -06:00
Kenneth Myhra
f5cb46e316 Toolchain: Exit Build*.sh scripts if executed as root 2023-04-25 01:53:42 -06:00