Commit Graph

21069 Commits

Author SHA1 Message Date
Gunnar Beutner
3526fbbc5f LibC: Add definition for PRIxPTR 2021-05-25 17:36:02 +02:00
Brendan Coles
16094baffc HexEditor: Construct Find dialog from GML 2021-05-25 13:17:28 +01:00
Andreas Kling
7997c02b6c ls: Fix incorrect -t sort order
Dr. POSIX says -t should sort the output by mtime ascending.
2021-05-25 13:23:17 +02:00
Brian Gianforcaro
6830963321 Kernel: Validate we don't hold s_mm_lock during context switch
Since `s_mm_lock` is a RecursiveSpinlock, if a kernel thread gets
preempted while accidentally hold the lock during switch_context,
another thread running on the same processor could end up manipulating
the state of the memory manager even though they should not be able to.
It will just bump the recursion count and keep going.

This appears to be the root cause of weird bugs like: #7359
Where page protection magically appears to be wrong during execution.

To avoid these cases lets guard this specific unfortunate case and make
sure it can never go unnoticed ever again.

The assert was Tom's idea to help debug this, so I am going to tag him
as co-author of this commit.

Co-Authored-By: Tom <tomut@yahoo.com>
2021-05-25 10:35:41 +02:00
Tom
fe679de791 Kernel: Release the paging lock while reading from the disk
Because reading from the disk may preempt, we need to release the
paging lock.
2021-05-25 10:35:41 +02:00
Tom
1110c659ee Kernel: Add ScopedLockRelease to temporarily release a Lock 2021-05-25 10:35:41 +02:00
Gunnar Beutner
a808fff2ec Revert "Revert "Kernel: Fix PCI layout of i440fx QEMU machine""
This reverts commit 72c097530f.

With that patch applied audio doesn't work anymore.

Fixes #7445.
2021-05-25 09:38:25 +02:00
Tobias Christiansen
820224bb48 LibWeb: Match the :not pseudoclass
When a Selector features a :not() pseudoclass we now check whether the
current element matches with the given selector in the :not and act
accordingly.
2021-05-24 22:10:08 +01:00
Tobias Christiansen
1ab82afee6 LibWeb: Add :not pseudoclass to the CSS parser
The selector given in the :not() is stored in the SimpleSelector as a
String.
2021-05-24 22:10:08 +01:00
Matthew Olsson
78f3bad7e6 LibPDF: Pre-initialize common FlyStrings in CommonNames.h 2021-05-25 00:24:09 +04:30
Matthew Olsson
cf3eb27108 PDFViewer: Add a toolbar
The toolbar has an option to toggle the sidebar, a number input to
set the current page, and two buttons to go up and down by one page
2021-05-25 00:24:09 +04:30
Matthew Olsson
cea7dbce42 PDFViewer: Add a tab bar with outlines and thumbnails
Outlines are in theory implemented (though I'm having trouble finding
a simple PDF with outlines to test it on), and thumbnails are not.
2021-05-25 00:24:09 +04:30
Matthew Olsson
67b65dffa8 LibPDF: Handle string encodings
Strings can be encoded in either UTF16-BE or UTF8. In either case,
there are a few initial bytes which specify the encoding that must
be checked and also removed from the final string.
2021-05-25 00:24:09 +04:30
Matthew Olsson
a08922d2f6 LibPDF: Parse outline structures 2021-05-25 00:24:09 +04:30
Matthew Olsson
777c232e16 AK: Add String::repeated(StringView, size_t count) 2021-05-25 00:24:09 +04:30
Matthew Olsson
be6e4b6f3c LibPDF: Store indirect value refs in Value objects
IndirectValueRef is so simple that it can be stored directly in the
Value class instead of being heap allocated.

As the comment in Value says, however, in theory the max bits needed to
store is 48 (16 for the generation index and 32(?) for the object
index), but 32 should be good enough for now. We can increase it to u64
later if necessary.
2021-05-25 00:24:09 +04:30
Matthew Olsson
534a2e95d2 LibPDF: Add basic color space support to the renderer
This commit only supports the three most basic color spaces:
DeviceGray, DeviceRGB, and DeviceCMYK
2021-05-25 00:24:09 +04:30
Matthew Olsson
f4941f5940 LibGfx: Add Color::from_cmyk 2021-05-25 00:24:09 +04:30
Matthew Olsson
f2d2f3fae7 LibPDF: Add a very poor path clipping implementation
This completely ignores the actual path and just uses its bounding box,
since our painter doesn't support clipping to paths.
2021-05-25 00:24:09 +04:30
Matthew Olsson
b6c884d20c LibGfx: Add Path::clear 2021-05-25 00:24:09 +04:30
Matthew Olsson
bf96ad674c LibPDF: Implement stubs for all graphical commands 2021-05-25 00:24:09 +04:30
Matthew Olsson
477e3946e5 LibPDF: Add support for stream filters
This commit also splits up StreamObject into PlainTextStreamObject and
EncodedStreamObject, which is essentially just a stream object which
does not own its bytes vs one which does.
2021-05-25 00:24:09 +04:30
Matthew Olsson
97cc482087 LibPDF: Make Reader::dump_state a bit more readable 2021-05-25 00:24:09 +04:30
Matthew Olsson
8c7ebc7a3f LibPDF: Do not assume value is an object in parse_indirect_value 2021-05-25 00:24:09 +04:30
Daniel Bertalan
e401ff0802 Userland: Fix stty not setting control characters
`AK::Result` does not work if both the error and value types are
integers.
2021-05-24 20:14:21 +01:00
Brendan Coles
7982f9aa70 HexEditor: Store UI layout preferences in config file 2021-05-24 20:11:41 +01:00
Andreas Kling
d1c8f4a2e0 Meta: Add Stephan Unverwerth to the contributors list :^) 2021-05-24 21:05:49 +02:00
Jelle Raaijmakers
dbbc583860 LibGUI/AbstractView: Expose activates_on_selection 2021-05-24 23:31:42 +04:30
Ali Mohammad Pur
27572c9d34 Base: Document the Shell's new termios allow-list
Also add `stty` to that list by default.
2021-05-24 23:26:49 +04:30
Ali Mohammad Pur
b2ef18d538 LibLine+Shell: Allow some programs to modify the current termios
This setting can be controlled by setting the
PROGRAMS_ALLOWED_TO_MODIFY_DEFAULT_TERMIOS _local_ shell variable to a
list containing such programs.
2021-05-24 23:26:49 +04:30
Ali Mohammad Pur
e318f12263 LibLine: Add bracketed paste mode support
This mode makes the editor insert all the "pasted" text into the buffer
without interpreting it in any way.
2021-05-24 23:26:49 +04:30
Stephan Unverwerth
e54d96d53e LibGL: Implement glReadPixels() 2021-05-24 19:03:25 +01:00
Stephan Unverwerth
d6c84ca4df LibGL: Implement glReadPixels() stub with argument validation 2021-05-24 19:03:25 +01:00
Stephan Unverwerth
24e74750d5 LibGL: Implement glReadBuffer() 2021-05-24 19:03:25 +01:00
Daniel Bertalan
0c6f019285 LibVT: Fix out-of bounds line insert
Unless DECOM mode is enabled, the cursor positions are measured from the
top left corner of the screen. We counted from the top margin, causing
line inserts in `vim` to go out-of-bounds and crash the terminal.
2021-05-24 22:26:54 +04:30
Daniel Bertalan
6465f87827 LibVT: Fix issues running nano
This commit fixes 3 correctness issues with the ANSI escape sequence
handling logic:
1. Default parameters were not handled correctly: the specification says
   that 0-valued CSI escape sequence parameters should take their
   default values.
2. We did not call `scroll_{up, down}` when encountering RI/IND commands
   that reached the scroll margins. This caused nano to only scroll the
   first line.
2021-05-24 22:26:54 +04:30
Daniel Bertalan
146bd794eb LibVT: Add Alternate Screen Buffer support
The Alternate Screen Buffer is used by full-screen terminal applications
(like `vim` and `nano`). Its data is stored separately from the normal
buffer, therefore after applications using it exit, everything looks
like it was before, the bottom of their interfaces isn't visible. An
interesting feature is that it does not support scrollback, so it
consumes less memory by not having to allocate lines for history.

Because of the need to save and restore state between the switches, some
correctness issues relating to it were also fixed in this commit.
2021-05-24 22:26:54 +04:30
Valtteri Koskivuori
cb8d0c8d0d LibCore+Userland: Add 13 more detectable file types
This patch adds 13 new detectable file formats, which are as follows in
alphabetical order:
.blend, .isz, ext* filesystem, Lua bytecode, Matroska container, NES
ROM, .pdf, qcow image, .rtf, WebAssembly bytecode, Windows 3.1X/95
compressed archive and raw zlib stream

Some are a tad esoteric, but the more file types we detect, the more
useful this utility becomes! :^)
2021-05-24 18:55:56 +01:00
Tobias Christiansen
9a1ac662f1 LibWeb: Don't try to load anything if src is empty in <img>
Previously we tried to load "" if the src was present but empty and
essentially only waited for RequestServer to time out.
2021-05-24 17:45:09 +01:00
Daniel Bertalan
708f835477 LibVT: Implement Bracketed Paste Mode
This mode allow us to escape any data that was not directly typed by the
user. `vim` currently uses this. If we implement it in the shell, we
could prevent newlines from being injected into the shell by pasting
text or dragging files into it (see #7276).
2021-05-24 16:58:57 +04:30
Daniel Bertalan
ee24f2eb2d LibVT: Add title stack support
This feature allows applications to reset the window title once they
exited. It is used by `vim` if `set title` is enabled.
2021-05-24 16:58:57 +04:30
Andreas Kling
439dc9b734 Meta: Add Jean-Baptiste Boric to contributors list :^) 2021-05-24 13:33:52 +02:00
Jean-Baptiste Boric
e4394b1605 LibGfx: Use anonymous buffer instead of raw anon_fd for Gfx::Bitmap
Instead of using a low-level, proprietary API inside LibGfx, let's use
Core::AnonymousBuffer which already abstracts anon_fd and offers a
higher-level API too.
2021-05-24 13:31:01 +02:00
Andreas Kling
de395a3df2 AK+Everywhere: Consolidate String::index_of() and String::find()
We had two functions for doing mostly the same thing. Combine both
of them into String::find() and use that everywhere.

Also add some tests to cover basic behavior.
2021-05-24 11:59:18 +02:00
Daniel Bertalan
875a2cbb71 LibVT+Kernel: Add support for setting cursor styles
This commit introduces support for 3 new escape sequences:
1. Stop blinking cursor mode
2. `DECTCEM` mode (enable/disable cursor)
3. `DECSCUSR` (set cursor style)

`TerminalWidget` now supports the following cursor types: block,
underline and vertical bar. Each of these can blink or be steady.
`VirtualConsole` ignores these (just as we were doing before).
2021-05-24 11:27:58 +02:00
Thomas Keppler
7dfc804d7d FontSettingsWidget: Reduce duplication in Label setup code
Pull out the Label updating code into its own function.
Ideally, we should probably transform this code to use its own widget
rather than doing this all in-line.
I.e., having a `FontSettingWidget` that that ties the FontPicker, Label
and Button into its own little widget, so that we can stay extendible in
the main widget and reduce duplication some more!
2021-05-24 09:08:23 +01:00
Thomas Keppler
a1f8c10fe5 FontSettingsWidget: Promote Labels as instance members
In order to not resolve the widgets twice, we capture them in ivars.
2021-05-24 09:08:23 +01:00
Thomas Keppler
883d0d2466 FontSettingsWidget: Display the default (fixed-width) font's name
Previously, the font was applied to the Labels but the name wasn't
updated on initial startup.
This meant that the Label's content was only correct in the default
state but not if the user changed the defaults.
2021-05-24 09:08:23 +01:00
Gunnar Beutner
ad6587424f Kernel: Disable profiling if setting up the buffer or timer failed 2021-05-24 09:10:50 +02:00
Andreas Kling
d3f298c592 LibIPC: Fix unaligned u32 access in drain_messages_from_peer()
Caught by userspace UBSAN. :^)
2021-05-24 09:04:22 +02:00