Commit graph

49558 commits

Author SHA1 Message Date
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
Kenneth Myhra 9ef3704ce8 Meta: Use common method exit_if_running_as_root() in serenity.sh
This replaces the inline check for running as root with the common
method exit_if_running_as_root().
2023-04-25 01:53:42 -06:00
Kenneth Myhra b4a0fee03d Meta: Add exit_if_running_as_root() to shell_include.sh
This adds the method exit_if_running_as_root() which checks if the
script is executed under root, and if that's the case exits the script.
2023-04-25 01:53:42 -06:00
Sigmund Lahn f2f14ad9bd LibWeb+WebContent: Make document background and Viewport transparent
This means iframes are transparent by default (as in firefox/chrome).

Painting the outermost canvas background is moved to the PageHost.
2023-04-25 09:33:35 +02:00
Tim Schumacher 5e7c838160 AK: Rename Stream::format() to Stream::write_formatted()
This brings the function name in line with how we usually name those
functions, which is with a `read_` or `write_` prefix depending on what
they do.

While at it, make the internal `_impl` function private and not-virtual,
since there is no good reason to ever override that function.
2023-04-25 07:30:16 +01:00
Lucas CHOLLET ddbe65e2f8 LibGfx/JPEG: Factorize chunk size reading 2023-04-25 06:01:39 +02:00
Lucas CHOLLET 105a40f4f6 LibGfx/JPEG: Rename qtable_id => quantization_table_id 2023-04-25 06:01:39 +02:00
Lucas CHOLLET dd5d2e3505 LibGfx/JPEG: Support up to 4 quantization tables
We used to limit this number to two and name them with their usual
usage. The specification is however broader, and you can find files that
use more tables as in the following link:

https://www.w3.org/MarkUp/Test/xhtml-print/20050519/tests/A_2_1-BF-01.htm
2023-04-25 06:01:39 +02:00
Lucas CHOLLET f46e3e6644 LibGfx/JPEG: Add myself to the copyright header 2023-04-25 06:01:39 +02:00
Lucas CHOLLET 0d3b62cbb7 LibGfx/JPEG: Use more explicit types and add a bunch of const 2023-04-25 06:01:39 +02:00
Pankaj Raghav 83b87a5ade Kernel: Add bar_address_mask to mask the last 4 bits of a BAR address
Create a bar_address_mask constant to mask the last 4 bits of a BAR
address instead of hand coding the mask all over the kernel.
2023-04-24 21:41:54 +02:00
Sam Atkins 20d517f1da LibChess: Remove use of DeprecatedString in Move::from_algebraic() 2023-04-24 20:58:35 +02:00
Sam Atkins a10cc37ef0 LibChess: Return ErrorOr<String> from to-algebraic/fen methods
Also, avoid creating temporary Strings for numbers, and stop appending
empty StringViews.
2023-04-24 20:58:35 +02:00
Sam Atkins 5f6dd87163 LibChess: Add and use Square::{file,rank}_char() methods
This saves us having to build and allocate a String, just to then use
one character of it.
2023-04-24 20:58:35 +02:00
Sam Atkins c73c697f94 LibChess: Make piece_for_char_promotion() more generally useful
- Rename to make it clear it's not just for promotion
- Understand 'p' for pawns
- Take a char parameter instead of StringView since it's always 1 char
2023-04-24 20:58:35 +02:00
Sam Atkins b111782f18 LibChess: Include pawns in FEN output
Previously, the initial position would look like this:

rnbqkbnr//8/8/8/8//RNBQKBNR w KQkq - 0 1

Now, we correctly give pawns the P/p character in FEN output:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Also, we only ever have 1 or 0 characters for a piece, so let's return
`Optional<char>` instead of `StringView` from `char_for_piece()`.
2023-04-24 20:58:35 +02:00
Sam Atkins 8529e660ca LibChess: Move inputs when creating chess Commands 2023-04-24 20:58:35 +02:00
Sam Atkins 29c41e953b LibChess: Convert Commands to use String and propagate errors 2023-04-24 20:58:35 +02:00
Sam Atkins 6576bbc098 LibChess: Return Commands by pointer from FooCommand::from_string()
This removes this slightly silly pattern:
`make<FooCommand>(FooCommand::from_string(s))`

Also, let's propagate OOM here, even if nobody reacts to it yet.
2023-04-24 20:58:35 +02:00
Sam Atkins b904435866 LibChess: Fix typo that always created DebugCommands as "on" 2023-04-24 20:58:35 +02:00
Timothy Flynn 8b7c5db186 LibVideo: Do not invoke Vector2D's destructor in order to resize it
This leads to all kinds of undefined behavior, especially when callers
have a view into the Vector2D.
2023-04-24 18:21:01 +02:00
thankyouverycool 683c8284cf Meta: Fix a typo in CONTRIBUTING.md 2023-04-24 16:48:37 +01:00
Jelle Raaijmakers 99451b14b2 Aplay: Determine absolute path before first unveil
`Core::DeprecatedFile::absolute_path` uses `stat` to determine whether a
file exists, which will always fail after the first `unveil` call
`aplay` does. Reorder things so we don't get a stack trace thrown at us
for each file being played.
2023-04-24 14:50:11 +02:00
Timothy Flynn f08499b4cf WebContent: Add the 'thread' pledge for video playback
This is required after 036eb82aca.
2023-04-24 14:49:42 +02:00
Timothy Flynn 8fe846eb7f Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every file 2023-04-24 14:49:04 +02:00
Aliaksandr Kalenik 269c25e1d2 LibWeb/Fetch: Pass recursive=false to manual navigation redirect
Implement ca10f49748

Fixes the issue I found while working on navigation:
https://github.com/whatwg/fetch/issues/1629
2023-04-24 13:38:37 +01:00