Commit graph

26697 commits

Author SHA1 Message Date
Stephan Unverwerth a595345e7c AK: Make declaration of std::move and std::forward optional
This introduces a new define AK_DONT_REPLACE_STD that disables our own
implementation of std::move and std::forward. Some ports include both
STL and AK headers which causes conflicts when trying to resolve those
functions. The port can define AK_DONT_REPLACE_STD before including
Serenity headers in that case.
2021-09-04 16:32:54 +02:00
Liav A f2ba44cbdf Kernel/DevFS: Remove unnecessary include 2021-09-04 16:19:12 +02:00
Liav A d189cb6a24 Kernel/Devices: Remove unnecessary virtual method
The is_disk_device method is not being overrided by any class or called
by anyone, so let's just remove it.
2021-09-04 16:19:12 +02:00
Idan Horowitz 1a19d2c2df LibGfx: Stop using a Utf8View that points to a temporary String 2021-09-04 16:13:30 +02:00
Idan Horowitz 72b21343ad LibGfx: Convert line text into a Utf8View before finding its direction
We were accidentally calling TextDirection::get_text_direction with a
String instead of a UtfView, which meant each byte was treated as a
codepoint, resulting in incorrect identification of text direction.
2021-09-04 16:13:30 +02:00
Tobias Christiansen 5d732711a2 PixelPaint: Fix broken opening of files from Shell
The fd would get closed when the File went out of scope, so we couldn't
open any file specified by 'pp <path to file>'. We need the fd to be
alive and we solemnly swear to take good care of it and close it
ourselves later.
2021-09-04 16:07:10 +02:00
David Isaksson 9699648b2a SystemMonitor: Make memory statistics dynamically formatted by size
Previously all memory values on the performance was formatted as KiB,
but with such formatting it can be quite hard to read large numbers
(as mentioned by Andreas on todays office hours livestream :^)).
This patch makes use of the human readable formatting utilies and
displays them in an easier to read format.
2021-09-04 16:05:32 +02:00
Ben Wiederhake 7224308358 LibGfx: Reject GIFs with ridiculously large symbols
This also prevents exploitation by malicious GIFs.
Found by OSS Fuzz, long-standing issue
(since 259f8541fc)
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29034
2021-09-04 16:00:25 +02:00
Ben Wiederhake 39c09cec88 LibGfx: Elide predictable reallocations in GIF loader 2021-09-04 16:00:25 +02:00
Timothy Flynn 90971673c7 LibJS: Implement Intl.Locale.prototype.minimize 2021-09-04 13:51:40 +01:00
Timothy Flynn a77f323dfb LibUnicode: Implement the Remove Likely Subtags method
Unlike Add Likely Subtags, this method doesn't require generated data.
Instead, it is defined in terms of Add Likely Subtags.
2021-09-04 13:51:40 +01:00
Timothy Flynn 0b1f5118d5 LibJS: Implement Intl.Locale.prototype.maximize 2021-09-04 13:51:40 +01:00
Timothy Flynn 03d7f01e0c LibJS: Add a constructor to create an Intl.Locale object from a LocaleID 2021-09-04 13:51:40 +01:00
Timothy Flynn 3abfe7f7db LibJS: Add missing Intl.Locale initializer for plain boolean type 2021-09-04 13:51:40 +01:00
Timothy Flynn e6a2ab1202 LibUnicode: Generate an implementation of the Add Likely Subtags method 2021-09-04 13:51:40 +01:00
Timothy Flynn 28ae63177e LibUnicode: Generate the entire locale likely-subtags dataset
The amount of aliases in the likely-subtags dataset is quite large, so
this also needed to change the way the data is generated. Otherwise, the
compiler would complain about the size of the generated code.

Previously, a static method was generated that would effectively parse
the dataset into a HashMap of Unicode::LanguageID at runtime. We now
perform that parsing at generation-time, and instead generate an Array
of a structure similar to Unicode::LanguageID (we cannot use the same
structure because it contains String and Optional, which cannot be used
at compile-time).
2021-09-04 13:51:40 +01:00
Timothy Flynn ca90231794 LibUnicode: Define is_unicode_*_subtag helpers inline in their header
The UnicodeLocale generator will need to parse canonicalized locale
strings, and will require using these methods. However, the generator
cannot depend on LibUnicode because Locale.cpp within LibUnicode already
depends on the generated file. Instead, defining the methods that the
generator needs inline allows the generator to use them without linking
against LibUnicode.
2021-09-04 13:51:40 +01:00
Andreas Kling 74ce098d58 Kernel: Delete the rvalue-ref qualified version of KResultOr::value()
This makes calling value() on a temporary KResultOr be a compile-time
error. This exposed a number of missing error checks (fixed in the
preceding commits.)
2021-09-04 13:08:37 +02:00
Andreas Kling d065de1fcf Kernel: Add missing error check when opening TTY for a new process 2021-09-04 13:08:37 +02:00
Andreas Kling 4b3bc3805b Kernel: Add missing error check when opening root file system 2021-09-04 13:08:37 +02:00
Andreas Kling b02eb8224c Kernel/VirtIO: Add two missing error checks in VirtIO::ConsolePort 2021-09-04 13:08:37 +02:00
Karol Kosek 791309a3d2 Utilities: Support grepping recursively from paths in the argument
Previously, the recursive flag always searched for file contents from
the current directory, ignoring the path argument entirely.
2021-09-04 15:36:31 +04:30
Liav A 8cb4fcdbd8 Meta: Add q35grub option in run.sh
This option is similar to the qgrub option, but instead of starting a
QEMU PIIX4 machine, it starts a QEMU Q35 machine, booting a grub image
disk within it.
2021-09-04 12:54:00 +02:00
Mustafa Quraish 1da081bf86 Mandelbrot: Use the new Zoom cursor
It makes it really clear now that you can use the mouse to zoom
when you see the zoom cursor.
2021-09-04 03:35:23 +02:00
Mustafa Quraish 92df9d464a PixelPaint: Use Zoom and Eyedropper cursors
Use the newly added cursors for ZoomTool and PickerTool
2021-09-04 03:35:23 +02:00
Mustafa Quraish 30e91ecff6 Cursors: Add new Magnifying glass cursor
There are a few places in the system where this could be useful,
such as PixelPaint and the MandelBrot demo. It seems general enough
that it is probably useful to have it as a system-wide cursor rather
than loading it manually each time.
2021-09-04 03:35:23 +02:00
Mustafa Quraish 30ce1d8562 Cursors: Add new Eyedropper cursor
This can be used immediately in PixelPaint (separate commit), but
I am adding this as a system-wide cursor since it may also be useful
for other applications that want to use it.
2021-09-04 03:35:23 +02:00
Musab Kılıç 81326ac8c7 PixelPaint: Add invert filter 2021-09-04 03:35:17 +02:00
Mustafa Quraish 280cbf2e18 PixelPaint: Make tools use the new API for property change shortcuts
Every tool that has a slider now registers the primary/secondary
sliders and now uses the same keyboard shortcuts to modify the
primary and secondary properties. `[` and `]` for the primary,
`{` and `}` for the secondary.
2021-09-04 03:33:44 +02:00
Mustafa Quraish d28fb8926f PixelPaint: Add mechanism for tools to use keyboard shortcuts
There are quite a few tools that might want to change certain values
based on consistent keyboard shortcuts. This commit allows tools to
hook up a "primary" and "secondary" slider with the base `Tool`
class, which can then handle updating those sliders with the common
shortcuts.

Note that any derived classes that want to override the `on_keydown`
function will manually need to call `Tool::on_keydown()`.
2021-09-04 03:33:44 +02:00
Thitat Auareesuksakul 8d36893ddf SoundPlayer: Add spacebar keyboard shortcut for play/pause 2021-09-04 03:33:35 +02:00
Mustafa Quraish 8f2521ce52 HexEditor: Use FileSystemAccessClient, add unveils
Most of the code here is based off the implementation of how
TextEditor uses FileSystemAccessClient.
2021-09-04 03:32:58 +02:00
Mustafa Quraish eae21c7e31 PDFViewer: Use FileSystemAccessClient to open files 2021-09-04 03:32:30 +02:00
Mustafa Quraish d645f637f1 PixelPaint: Add separator in image menu
I think it looks a bit nicer having a separator between the
"flip" and "rotate" sections.
2021-09-04 03:30:03 +02:00
Mustafa Quraish 7263e57ce8 PixelPaint: Allow modifiable thickness for RectangleTool :^) 2021-09-04 03:30:03 +02:00
Mustafa Quraish 9ed32582e2 LibGfx/Painter: Add draw_rect_with_thickness method
Previously there was no way to draw rectangles with any specific
thickness, like we can do with ellises, for instance. This method
is just a simple wrapper around `draw_line()` several times. At
least for now, we don't need to do anything sophisticated since
this will only be used by PixelPaint.`
2021-09-04 03:30:03 +02:00
Mustafa Quraish 6910cbc075 PixelPaint: Add Copy Merged action
This allows the user to copy the merged bitmap (all visible layers).
2021-09-04 03:30:03 +02:00
Tobias Christiansen 65d52467f4 PixelPaint: Parse saved Guides from the ProjectLoader in main
This patch allows PixelPaint to recreate saved Guides from .pp files.
2021-09-04 03:29:09 +02:00
Tobias Christiansen 508d563189 PixelPaint: Add ProjectLoader to abstract away opening of files
This new class will open and parse files (either images directly or .pp
project files) and one can get the parsed Image as well as other
information from it.

This patch removes a bunch of 'try_create_from..." methods from Image in
favor of using the ProjectLoader.

The only json_metadata that is available are Guides for now.
2021-09-04 03:29:09 +02:00
Tobias Christiansen b3f53a0b5a PixelPaint: Save Guides when writing project to file 2021-09-04 03:29:09 +02:00
Tobias Christiansen e867e4b84b PixelPaint: Move saving a project from Image into ImageEditor
The ImageEditor knows more about the image than Image itself. So to save
a project with all the information known to the program about an image
it's logical that ImageEditor performs that task rather than the Image.

There isn't any additional data added yet, but now there's the
possibility to do so.
2021-09-04 03:29:09 +02:00
Tobias Christiansen 60e526fdd2 PixelPaint: Move serialization of Image into seperate function
This eliminates duplicated code.
2021-09-04 03:29:09 +02:00
Karol Kosek d81ba98976 SoundPlayer: Don't try to dereference null-pointer buffers
d049626f40 tried to resample the buffer
before checking if it points to a valid location.
This caused a crash, generally at the end of the file.
2021-09-04 03:28:33 +02:00
Musab Kılıç 0139a56aa5 Piano: Format slider values when initially set 2021-09-04 03:24:03 +02:00
Musab Kılıç 7b45653331 ImageViewer: Kindly ask the user if they want to delete a file 2021-09-04 03:22:46 +02:00
Andreas Kling 7dda773426 AK: Add rvalue-ref qualifiers for Optional's value() and value_or()
This avoids a value copy when calling value() or value_or() on a
temporary Optional. This is very common when using the HashMap::get()
API like this:

    auto value = hash_map.get(key).value_or(fallback_value);
2021-09-04 03:02:08 +02:00
Andreas Kling 0b36499f46 AK: Convert Optional.h to east-const style 2021-09-04 03:02:08 +02:00
Musab Kılıç 764d31b6c3 Piano: Draw note names on top of notes 2021-09-03 23:34:38 +02:00
Daniel Bertalan d7b6cc6421 Everywhere: Prevent risky implicit casts of (Nonnull)RefPtr
Our existing implementation did not check the element type of the other
pointer in the constructors and move assignment operators. This meant
that some operations that would require explicit casting on raw pointers
were done implicitly, such as:
- downcasting a base class to a derived class (e.g. `Kernel::Inode` =>
  `Kernel::ProcFSDirectoryInode` in Kernel/ProcFS.cpp),
- casting to an unrelated type (e.g. `Promise<bool>` => `Promise<Empty>`
  in LibIMAP/Client.cpp)

This, of course, allows gross violations of the type system, and makes
the need to type-check less obvious before downcasting. Luckily, while
adding the `static_ptr_cast`s, only two truly incorrect usages were
found; in the other instances, our casts just needed to be made
explicit.
2021-09-03 23:20:23 +02:00
brapru bad23e3f8c Kernel: Convert Routing to east-const style 2021-09-03 23:18:50 +02:00