Commit graph

15185 commits

Author SHA1 Message Date
Andreas Kling
13594b7146 LibGfx+AK: Make text elision work with multi-byte characters
This was causing WindowServer and Taskbar to crash sometimes when the
stars aligned and we tried cutting off a string ending with "..." right
on top of an emoji. :^)
2020-12-28 23:54:10 +01:00
Andreas Kling
9af33e2e4b LibGfx: Make Painter::draw_text() interpret StringView as UTF-8 2020-12-28 23:54:10 +01:00
Lukasz Maciejewski
7e5199a394 LibTextCodec: Fix minor errors in Latin2 decoder 2020-12-28 23:31:12 +01:00
Andreas Kling
7e79563bb9 LibGUI: Show tooltip after a small delay
It always felt a bit jarring that tooltips would pop in right away when
you hover over a toolbar button. This patch adds a 700ms delay before
they appear, and a 50ms delay before they disappear.

Once a tooltip is up, moving the cursor between two widgets that both
have tooltips will leave the tooltip on screen without delays.
2020-12-28 21:28:40 +01:00
Andreas Kling
3717e5dbae WindowServer: Add a GetGlobalCursorPosition IPC request
This tells you where the mouse cursor is in screen coordinates.
2020-12-28 21:28:40 +01:00
Andreas Kling
add01b304b LibCore: Make Core::Timer::create_single_shot() create a stopped timer
None of the code using this actually expected the timer to fire right
away, but they would instead call start() on it once they were ready to
accept a timer fire.

Let's make the API behave the way its clients believed it did. :^)
2020-12-28 21:28:40 +01:00
Andreas Kling
f7116bba43 LibGUI: Refactor AbstractView "multi select" mode into "selection mode"
There are three possible selection modes for a GUI::AbstractView.

- NoSelection
- SingleSelection
- MultiSelection

We don't enforce these modes fully yet, this patch mostly adds them in
place of the old "multi select" flag.
2020-12-28 21:28:40 +01:00
Andrew Kaster
207ecf454a CI: Prevent MacOS Lagom test failures from failing the build.
Also, switch to macos-10.15 runners. They are not as experimental, and
seem to spin up much faster than the Big Sur ones.
2020-12-28 19:35:32 +01:00
Andrew Kaster
8ce7df73fb AK: Enable AK::SharedBuffer for all platforms
A future patch could do some MacOS specific things for
set_volatile/set_nonvolatile. For now, swap out the defined(__linux__)
branches for simple not __serenity__ branches.
2020-12-28 19:35:32 +01:00
Andrew Kaster
02fcf3974e AK/Userland: Use AK/Endian.h for portable byte swapping in ntpquery
Create macros for the byte swap operations one would expect to be in
endian.h or byteswap.h in AK/Endian.h. It's likely a similar/different
change will be needed for BSDs, but there's no github action for those
added to the project yet.
2020-12-28 19:35:32 +01:00
Andrew Kaster
42323d769a Meta: Disable rpath generation for MacOS 2020-12-28 19:35:32 +01:00
Andrew Kaster
1219c65249 AK: Add CLOCK_*_COARSE aliases for darwin and BSD variants
The coarse clocks in time.h are a linux extension that we've adopted.
MacOS and the BSDs don't have it, so we need an alias in a platform
header for Lagom builds.
2020-12-28 19:35:32 +01:00
Luke
3bdaba0b28 Meta: Add macOS workflow to CI
A good number of contributors use macOS. However, we have a bit of
a tendency of breaking the macOS build without realising it.

Luckily, GitHub Actions does actually supply macOS environments,
so let's use it.
2020-12-28 19:35:32 +01:00
Idan Horowitz
b4bb2b141c FileManager: Implement the cut file operation
This exploits the comment lines in the text/uri-list specification:
https://tools.ietf.org/rfc/rfc2483.txt (page 11), which might be a bit
hackish, but the specification suggests doing the same for other uses,
so it should be fine.
2020-12-28 19:13:45 +01:00
Idan Horowitz
7450f20b81 FileManager: Add a delete_path helper for singular paths
This is just the syscalls and error handling that was done for each
file in delete_paths.

This will be used to prevent the unneeded construction of vectors
when performing cut operations
2020-12-28 19:13:45 +01:00
Egor Ananyin
f30d4f22ef LibJS: Add tests for new Math functions 2020-12-28 19:03:11 +01:00
Egor Ananyin
7c9c3a10d3 LibJS: Add almost all Math functions 2020-12-28 19:03:11 +01:00
Andreas Kling
a35693915e LibGUI: Make syntax highlighter communicate boldness instead of font
Now that fonts know their own weight, we no longer need highlighters to
tell us which font to use. Instead, they can just say "this should be
bold" and we'll find the right font ourselves.
2020-12-28 15:53:10 +01:00
Andreas Kling
105eb8e1bc LibGfx: Add FontDatabase::get(family, size, weight)
This function allows you to look up a font by its exact parameters.
2020-12-28 15:53:10 +01:00
Andreas Kling
cd9ad6a05e LibGUI: Tweak AbstractButton and subclass constructors
Taking a "const StringView&" for the initial text does not achieve
anything useful. Just take a "String" and move it into storage.
2020-12-28 15:53:10 +01:00
Peter Nelson
476911e1f9 LibGfx: fix OOB access in LZW decoder on bad input
This fixes an issue where a corrupted LZW code can result in the first
element of an empty buffer being accessed.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27863
2020-12-28 15:12:29 +01:00
Luke
be30dc2b18 LibJS: Implement Object.prototype.isPrototypeOf
Spec: https://tc39.es/ecma262/#sec-object.prototype.isprototypeof
2020-12-28 13:10:07 +01:00
AnotherTest
ee1d9217aa LibRegex: Fail early if eof seen after '(?'
Fixes #4583.
2020-12-28 13:09:22 +01:00
Andreas Kling
92c073a9d1 LIbGUI+LibGfx: Paint focused push buttons with a heavier look
Draw a heavy shadow frame around focused push buttons for emphasis.
For now I've used the ThreedShadow2 color role as it feels dark enough.
2020-12-28 12:41:26 +01:00
Andreas Kling
2bbf3b5d0b LibGUI: Always focus the file name textbox in GUI::FilePicker
Previously we would only auto-focus it when choosing a save location.
It seems nice to have the same behavior when opening a file.
2020-12-28 11:44:29 +01:00
Andreas Kling
a94d1626b5 WindowServer: Remove unnecessary clang-format disabler comment 2020-12-28 11:41:09 +01:00
Andreas Kling
bc67b04399 WindowServer: Don't lookup configuration values in compose()
The compose() function is supposed to be fast since it can execute
60 times per second. Let's not do obviously avoidable things like
configuration value lookups in there. :^)
2020-12-28 11:41:09 +01:00
Andreas Kling
ffa241250b LibGUI: Make GUI::FileIconProvider::icon_for_executable() a public API
This way we can use it instead of icon_for_path() in a bunch of places
and avoid loading the full FileIconProvider configuration.
2020-12-28 11:41:09 +01:00
Idan Horowitz
a49fd0ff5e Terminal: Created a simple Find window for searching within the terminal
This is simply a gui wrapper around the pre-existing TerminalWidget
methods for finding and scrolling.
2020-12-28 11:40:35 +01:00
Idan Horowitz
0ddde46c19 LibVT: Implement find and scroll helper methods in TerminalWidget
This is mostly based on TextDocument's similar methods, these will
help implement searching within the terminal application.

The support for unicode code points is shaky at best, and should
probably be improved further.
2020-12-28 11:40:35 +01:00
Idan Horowitz
6446135681 LibVT: Create VT::Range and use it to replace selection start / end
Based on GUI::TextRange, This is both a bit more expressive and will
eventually be used for searching within the terminal
2020-12-28 11:40:35 +01:00
Idan Horowitz
6efdabfc6f Base: Rename maximize/minimize icons to a more generic name
This reduces naming confusion when the icons are used for other
use cases that require a triangle shape
2020-12-28 11:40:35 +01:00
Andreas Kling
26cb083c6e FileManager: Created desktop shortcuts should use full basename
A shortcut to ReadMe.md should be called "ReadMe.md", not "ReadMe".
2020-12-28 09:38:11 +01:00
Andreas Kling
327f595f63 Browser: Show destination URLs as tooltips in the bookmarks bar 2020-12-28 01:43:58 +01:00
Andreas Kling
27262b639d Browser: Use Core::Object::remove_all_children() in bookmarks bar 2020-12-28 01:42:41 +01:00
Andreas Kling
71e9d06bb2 WindowServer: Spruce up the move/resize geometry label a little bit
Draw it in a threed style with a little shadow under it.
2020-12-28 01:40:09 +01:00
Linus Groh
58890e03b6 Everywhere: Move AppFile from LibGUI to LibDesktop
This was mentioned in #4574, and the more I think about it the more it
feels just right - let's move it there! :^)
Having to link LaunchServer against LibGUI explicitly should've been
telling enough...
2020-12-28 01:28:07 +01:00
Andreas Kling
97c42694db LibGUI: Make selected item tint color based on focused state
Use the inactive selection color for item icon tinting when the item
view is not focused.
2020-12-28 01:14:01 +01:00
Andreas Kling
0f1235be25 LibGUI: Show a hand cursor when hovering over a GUI::LinkLabel 2020-12-28 01:02:57 +01:00
Andreas Kling
644d5c5404 LibGUI: Switch focus if the currently focused widget is disabled 2020-12-28 01:02:57 +01:00
Brendan Coles
df6106854e Services: Fix typos 2020-12-28 00:55:45 +01:00
Andreas Kling
45d1c08386 Revert "Meta: Remove catchall lines in .gitignore (#4565)"
This reverts commit bee1774b92.

It made our .gitignore ignore *everything*.
2020-12-28 00:16:46 +01:00
Andreas Kling
4e99e013f0 Meta: Import the serenityos.org website
It doesn't seem right to not have the website in version control.
Also this way people can make changes to it. :^)
2020-12-28 00:12:12 +01:00
Andreas Kling
20e2700952 Kernel: Allow Userspace<T> pointers with invalid content
It's not an error to create a Userspace<T> that points to kernel memory
as the point of Userspace<T> is not to validate the address, but rather
to choose safe overloads that do validation before any data transfer
takes place.

Fixes #4581.
2020-12-27 23:43:15 +01:00
Brendan Coles
bceee87f61 LibELF: Reject ELF with program header p_filesz larger than p_memsz 2020-12-27 23:27:07 +01:00
Xavier Cooney
ca0f3db004 LibJS: Implement Array.prototype.sort() 2020-12-27 23:24:33 +01:00
Andreas Kling
a103eae0d4 LibJS: Run "prettier" on the tests :^) 2020-12-27 23:13:52 +01:00
Liav A
72b1998f0d Kernel: Introduce a new partitioning subsystem
The partitioning code was very outdated, and required a full refactor.
The new subsystem removes duplicated code and uses more AK containers.

The most important change is that all implementations of the
PartitionTable class conform to one interface, which made it possible
to remove unnecessary code in the EBRPartitionTable class.

Finding partitions is now done in the StorageManagement singleton,
instead of doing so in init.cpp.

Also, now we don't try to find partitions on demand - the kernel will
try to detect if a StorageDevice is partitioned, and if so, will check
what is the partition table, which could be MBR, GUID or EBR.
Then, it will create DiskPartitionMetadata object for each partition
that is available in the partition table. This object will be used
by the partition enumeration code to create a DiskPartition with the
correct minor number.
2020-12-27 23:07:44 +01:00
Liav A
bc18712adf Build: Fix build of grub image when choosing EBR scheme 2020-12-27 23:07:44 +01:00
Liav A
0f208669af Build: Fix build of grub image when choosing GPT scheme 2020-12-27 23:07:44 +01:00