Commit graph

47779 commits

Author SHA1 Message Date
Sam Atkins
3c25a9b5fe MouseSettings: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
1b776bffcf KeyboardSettings: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
8f3c77a5a3 ImageViewer: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
c325a656ec GamesSettings: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
442dd133bb FileManager: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
3daaf47607 Assistant: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
728b07fbf6 Tests: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
23aec16e8b LibCore: Introduce a new directory iteration API
`Core::Directory::for_each_entry()` takes a callback which is passed the
DirectoryEntry and the parent Directory. It returns any error from
creating the iterator, iterating the entries, or returned from the
callback.

As a simple example, this:

```c++
Core::DirIterator piece_set_iterator { "/res/icons/chess/sets/",
        Core::DirIterator::SkipParentAndBaseDir };
while (piece_set_iterator.has_next())
    m_piece_sets.append(piece_set_iterator.next_path());
```

becomes this:

```c++
TRY(Core::Directory::for_each_entry("/res/icons/chess/sets/"sv,
        Core::DirIterator::SkipParentAndBaseDir,
        [&](auto const& entry, auto&) -> ErrorOr<IterationDecision> {
    TRY(m_piece_sets.try_append(entry.name));
    return IterationDecision::Continue;
}));
```
2023-03-05 20:23:42 +01:00
Sam Atkins
ceaed7440e LibCore: Remove unused Directory::create_iterator() method 2023-03-05 20:23:42 +01:00
Sam Atkins
a4667fdc9b LibCore: Expose Directory file descriptor 2023-03-05 20:23:42 +01:00
Sam Atkins
7864898f52 LibCore: Ensure that Directory always has a path
`Directory::path()` returning `ErrorOr` makes it awkward to use, and all
current users create a Directory with a path. If we find we need
pathless directories later, we can come up with a clever solution
then. :^)
2023-03-05 20:23:42 +01:00
Sam Atkins
774f328783 LibCore+Everywhere: Return an Error from DirIterator::error()
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
2023-03-05 20:23:42 +01:00
Sam Atkins
a98ae8f357 LibCore: Expose file type from DirIterator
Our `find` utility makes use of the `dirent::d_type` field for filtering
results, which `Core::DirIterator` didn't expose. So, now it does. :^)

We now store the name and type of the entry as the "next" value instead
of just the name. The type is exposed as a `DirectoryEntry::Type`
instead of a `DT_FOO` constant, so that we're not tied to posixy
systems, and because proper enums are nice. :^)
2023-03-05 20:23:42 +01:00
Timothy Flynn
bc0bb98c01 LibGUI: Paint emoji using text in the EmojiInputDialog
This widget originally used text, but at the time we did not support
painting multi-code point emoji as text at all. So it was changed to
paint emoji with their bitmaps in commit 8190120f95.

Now that we can paint text with multi-code point emoji, revert this
widget to use text again. This has the added benefit that the dialog has
a what-you-see-is-what-you-get effect; any emoji with text presentation
in the font (e.g. U+00A9 Copyright) will be displayed as such in the
dialog, which is how the text would be painted when selected anyways.

Note that to accommodate some emoji sizes, this also had to bump the
button sizes a bit, otherwise they would be displayed with an ellipsis.
2023-03-05 20:21:57 +01:00
Timothy Flynn
054297431a LibGUI: Fix typo in the name of the EmojiCategory struct 2023-03-05 20:21:57 +01:00
Timothy Flynn
153218ed76 LibGUI: Allow overriding toolbar button tooltips
The EmojiInputDialog, for example, will want its toolbar buttons to have
a tooltip which differs from its text. If no tooltip override has been
provided, we fall back to the button text still.
2023-03-05 20:21:57 +01:00
Timothy Flynn
f8a0365002 LibUnicode: Detect ZWJ sequences when filtering by emoji presentation
This was preventing some unqualified emoji sequences from rendering
properly, such as the custom SerenityOS flag. We rendered the flag
correctly when given the fully qualified sequence:

    U+1F3F3 U+FEOF U+200D U+1F41E

But were not detecting the unqualified sequence as an emoji when also
filtering for emoji-presentation sequences:

    U+1F3F3 U+200D U+1F41E
2023-03-05 20:21:57 +01:00
Kenneth Myhra
ab6bd946d8 LibWeb: Port ProgressEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
fe6b82b01c LibWeb: Port WebGLContextEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
cec1cda8b0 LibWeb: Port SubmitEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
dd2d029952 LibWeb: Port PromiseRejectionEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
bb7ae423d5 LibWeb: Port FormDataEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
eed69e5093 LibWeb: Port MessageEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
84997ab0ee LibWeb: Port ErrorEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
e661f03ffa LibWeb: Port CloseEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
d0f904dd4c LibWeb: Port MediaQueryListEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
97947fdffa LibWeb: Port PageTransitionEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
03ceca4ca1 AK: Add FlyString::to_deprecated_fly_string()
This adds the conversion function to_deprecated_fly_string() to enable
conversion from new FlyString to DeprecatedFlyString.
2023-03-05 18:25:59 +00:00
Nico Weber
efabfd4c66 LibGfx: Fill in remaining values in built-in sRGB profile
The values aren't 100% self-consistent, but it probably doesn't make
a difference for u8 color data. Good enough for now. See all the links
on #17714 for some more background.
2023-03-05 18:21:43 +00:00
Liav A
be1d7c325a Kernel: Move process coredump metadata modification to the prctl syscall 2023-03-05 16:55:08 +01:00
Sam Atkins
822164a686 LibCMake: Add folding regions to syntax highlighter
This creates folding regions for blocks defined by the following:
- if/elseif/else/endif
- foreach/endforeach
- while/endwhile
- macro/endmacro
- function/endfunction

Since there is no guarantee that each keyword will have a matching
partner, we do our best by looking for the most recent possible start
token matching the current end token. If we find one, we link to it and
drop all the other start-tokens that happened in between. For example,
we would define a folding region for this invalid file like so:

[-] if(TRUE)
 │      while()
 └─ endif()
2023-03-05 16:54:10 +01:00
Sam Atkins
631927470a LibCMake: Treat block, endblock and return as control keywords
I missed these before because they weren't mentioned on the language
description page of the CMake manual.
2023-03-05 16:54:10 +01:00
Timothy Flynn
ca2b030336 LibUnicode: Use binary search for lookups into the generated emoji data
This sorts the array of generated emoji data by code point (first by
code point length, then by code point value). This lets us use a binary
search to find emoji data, rather than the current linear search.

In a profile of scrolling around /home/anon/Documents/emoji.txt, this
reduces the runtime of Gfx::Emoji::emoji_for_code_points from 69.03% to
28.42%. Within that, Unicode::find_emoji_for_code_points reduces from
28.42% to just 1.95%.
2023-03-05 16:44:20 +01:00
Linus Groh
2bc54ae56a LibWeb: Remove unused SourceGenerator mappings 2023-03-05 15:37:33 +00:00
Linus Groh
65b1229dae LibWeb: Don't use C++ name for error messages in generated bindings 2023-03-05 15:37:33 +00:00
Linus Groh
a430d78843 LibWeb: Use 'Base::initialize()' in generated bindings 2023-03-05 15:37:33 +00:00
Liav A
39de5b7f82 Kernel: Actually check Process unveil data when creating perfcore dump
Before of this patch, we looked at the unveil data of the FinalizerTask,
which naturally doesn't have any unveil restrictions, therefore allowing
an unveil bypass for a process that enabled performance coredumps.

To ensure we always check the dumped process unveil data, an option to
pass a Process& has been added to a couple of methods in the class of
VirtualFileSystem.
2023-03-05 15:15:55 +00:00
Dan Klishch
882dcfaddb AK+LibAudio: Remove UFixedBigInt::my_size 2023-03-05 13:49:43 +01:00
Liav A
11a7e21c2a Kernel+Userland: Add support for using the PCSpeaker with various tones 2023-03-05 08:38:29 +00:00
Dan Klishch
2d27c98659 AK: Implement Knuth's algorithm D for dividing UFixedBigInt's 2023-03-04 22:10:03 -07:00
Dan Klishch
2470fab05e AK: Delete unused and untested sqrt, pow and pow_mod from UFixedBigInt 2023-03-04 22:10:03 -07:00
Dan Klishch
8f8e31e780 AK+LibCrypto: Delete 64x64 wide multiplication workarounds
Now UFixedBigInt exposes API to do wide multiplications of this kind
efficiently.
2023-03-04 22:10:03 -07:00
Dan Klishch
67ec347bfa AK: Rewrite UFixedBigInt using the framework from BigIntBase.h 2023-03-04 22:10:03 -07:00
Dan Klishch
e132570284 AK: Introduce "BigIntBase.h" for common simple operations on big ints 2023-03-04 22:10:03 -07:00
Dan Klishch
2a6f5ff441 AK: Move compiletime_fail to StdLibExtras.h
This function will be used in the next commit in "BigIntBase.h".
2023-03-04 22:10:03 -07:00
nipos
1fec1741b9 Documentation: Add Ladybird build instructions for OpenIndiana 2023-03-04 21:34:54 -07:00
nipos
e35a858bde AK: Remove signbit definition to prevent conflict in FixedPoint 2023-03-04 21:34:54 -07:00
nipos
aa9f1ee889 AK: Add support for Solaris to StackInfo 2023-03-04 21:34:54 -07:00
nipos
f8ed51e5dc LibCore: Add support for Solaris in anon_create 2023-03-04 21:34:54 -07:00
nipos
1dbc9bcc0b LibWeb: Add Solaris/SunOS platform string to ResourceLoader 2023-03-04 21:34:54 -07:00