Commit graph

22977 commits

Author SHA1 Message Date
Marcus Nilsson 2264de9921 LibGUI/TextEditor: Set cut and copy actions to disabled on init
We can presume that there is nothing to cut or copy on init since
nothing is selected yet.
2021-07-03 17:36:50 +02:00
Tristan Menke 9f117a79f6 Documentation: Add workaround for blackscreen using WSL+QEMU6.x
This workaround disables the in-kernel interrupt controller.
This impacts the VM performance and should probably be removed
when the workaround is no longer needed.

This workaround was posed by stelar7.
See #7523
2021-07-03 17:32:33 +02:00
Andreas Kling e4a55404f1 LibCore: Avoid duplicate '/' in DirIterator::next_full_path()
When the root path of a DirIterator ends with '/', we don't need to
add another '/' before appending the file name.

Fixes an issue where files found by Assistant had 2 leading slashes.
2021-07-03 16:43:08 +02:00
Liav A 70278d57ba Meta: Add a few more graphics devices to the Q35 for testing purposes 2021-07-03 16:28:49 +02:00
Liav A 00e4cc23cb Kernel/Graphics: Unblank the screen when initializing bochs display 2021-07-03 16:28:49 +02:00
Liav A 3fae7ca113 Kernel: Clarify and make it easy to not use raw numbers
Let's put the PCI IDs as enums in the PCI namespace so they're free to
pollute that namespace, but it's also more easier to use them.
2021-07-03 16:28:49 +02:00
Liav A b4e230a7bb Kernel/Graphics: Assert if trying to initialize with the wrong driver 2021-07-03 16:28:49 +02:00
Liav A 053a832fac Kernel: Simplify graphics initialization somewhat
We use a switch-case statements to ensure we try to find the best
suitable driver for a specific graphics card. In case we don't find
such, we use the default statement to initialize the graphics card as a
generic VGA adapter, if the adapter is VGA compatible.

If we couldn't initialize the driver, we don't touch this adapter
anymore.

Also, GraphicsDevice should not be tied to a PCI::Address member, as it
can be theortically be used with other buses (e.g. ISA cards).
2021-07-03 16:28:49 +02:00
Timothy Flynn 27fe2b45e5 Assistant: Convert all Vector<NonnullRefPtr> to NonnullRefPtrVector 2021-07-03 15:41:35 +02:00
Timothy Flynn d69691a26b Assistant: Add provider to run a command in a terminal
Prefix text with "$" in the Assistant text box to run a command in a
forked terminal. For example, "$ top" or "$ top -s pid".
2021-07-03 15:41:35 +02:00
Edwin Hoksberg d5dfc255ed Assistant: Add new URLProvider to open URL's in the browser 2021-07-03 15:27:19 +02:00
Hediadyoin1 d12e14fa95 Userland: Respect red-zone for signal handlers
We were building with red-zone before, but were not accounting for it on
signal handler entries. This should fix that.

Also shorten the stack alignment calculations for this.
2021-07-03 13:20:04 +02:00
Tom 0fcb048448 WindowServer: Rename Window::outer_stack -> Window::window_stack
Also, make it return a reference as aside from only three special
situations (creating, destroying, and moving a window between stacks)
a window should always be on a window stack. Any access during those
brief situations would be a bug, so we should VERIFY this.
2021-07-03 12:27:23 +02:00
Tom 6ec35c91bc WindowServer: Improve occlusion calculations
This solves two problems:
* A window was sometimes deemed occluded when the window rect was
  entirely covered by other rectangles, transparent or opaque. This
  caused a window to stop rendering even if a small portion was still
  visible, e.g. when it was merely covered by a window shadow.
* The window switcher is interested in window updates even when a
  window is entirely covered by another one, or when it is on another
  desktop. This forces windows to be not occluded in those cases.
2021-07-03 12:27:23 +02:00
Tom c06e765a5a WindowServer: Show window's desktop in window switcher if needed
If there are windows on more than one desktop then the window switcher
should show on which one they are located.
2021-07-03 12:27:23 +02:00
Tom cc707270ae Taskbar: Only show the current desktop's window buttons
By tracking what virtual desktop a window is on, and what desktop is
being viewed we can show or hide the window buttons accordingly.
2021-07-03 12:27:23 +02:00
Tom 5acee4b4d0 DisplaySettings: Add new Desktop tab with virtual desktop settings
This allows the user to configure the virtual desktop setup as desired.
2021-07-03 12:27:23 +02:00
Tom 6472ee0eff WindowServer: Support two window switcher modes: all or current desktop
When using the Super+Tab hotkey then all windows will be displayed,
and we will switch to another virtual desktop if needed.

When using the Alt+Tab hotkey then only the windows on the current
desktop will be displayed.
2021-07-03 12:27:23 +02:00
Tom 7984c2836d WindowServer: Add API to change virtual desktop settings
This also adds the ability to query how many virtual desktops are
set up, and for the Taskbar to be notified when the active virtual
desktop has changed.
2021-07-03 12:27:23 +02:00
Tom 584b144953 WindowServer: Add basic virtual desktop support
This creates a 2-dimensional array of WindowStack instances, one for
each virtual desktop. The main desktop 0,0 is the main desktop, which
is the desktop used for all stationary windows (e.g. taskbar, desktop).
When adding windows to a desktop, stationary windows are always added
to the main desktop.

When composing the desktop, there are usually two WindowStacks
involved. For stationary windows, the main desktop will be traversed,
and for everything else the current virtual desktop will be iterated.
Iteration is interweaved to preserve the correct order. During the
transition animation, two WindowStacks will be iterated at the same
time.
2021-07-03 12:27:23 +02:00
Timothy 944e5cfb35 Everywhere: Use IPC include syntax
Remove superfluous includes from IPCCompiler's generated output and
add include directives in IPC definitions where appropriate.
2021-07-03 12:16:00 +02:00
Timothy 83fb97c301 IPCCompiler: Add include parsing for endpoints
This will find all lines at the start of the file beginning with # and
copy them straight through.
2021-07-03 12:16:00 +02:00
Gunnar Beutner 128e504de6 Meta: Change the QEMU binary directory to Toolchain/Local/qemu
Previously we'd place the QEMU binaries into the architecture-specific
toolchain directory. This is a problem because the BuildIt.sh script
clears those directories which also removes the QEMU binaries users
may have built earlier. Also, the QEMU binaries are not specific to
the target architecture.
2021-07-03 12:06:20 +02:00
Gunnar Beutner d0c4524234 Meta: Provide better instructions when QEMU is not installed or too old 2021-07-03 12:06:20 +02:00
Gunnar Beutner 0ec1077bcb Meta: Prefer to use the QEMU binaries from the toolchain directory 2021-07-03 12:06:20 +02:00
Maciej Zygmanowski 57340dda36 Base: Add more manpages for command-line utilities 2021-07-03 09:08:25 +02:00
Diego Garza 5d8585df97 Documentation: Add notes for first time setup of the project in CLion
Mention the "Open Project Wizard" where you can set
the CMake options before making the cache.
Remind users to use the "Default" build type
and to build the Toolchain so CMake does not complain.
2021-07-03 08:24:06 +04:30
Noah Rosamilia 2feaf59ab2 3DFileViewer: Add primitive mouse controls 2021-07-03 04:02:52 +02:00
Andreas Kling e8430cf0d3 LibJS: Don't allow delete super.property
This should throw a ReferenceError, since `delete` is not allowed
on super references.
2021-07-03 01:30:30 +02:00
Andreas Kling 1270df257b LibJS: Bring the super keyword in line with the spec
This patch implements spec-compliant runtime semantics for the following
constructs:

- super.property
- super[property]

The MakeSuperPropertyReference AO is added to support this. :^)
2021-07-03 01:12:12 +02:00
Gunnar Beutner 52f9aaa823 Kernel: Use the GS segment for the per-CPU struct
Right now we're using the FS segment for our per-CPU struct. On x86_64
there's an instruction to switch between a kernel and usermode GS
segment (swapgs) which we could use.

This patch doesn't update the rest of the code to use swapgs but it
prepares for that by using the GS segment instead of the FS segment.
2021-07-02 23:33:17 +02:00
Daniel Bertalan 42d197cde7 Kernel: Fix miscellaneous warnings when building with Clang
These small changes fix the remaining warnings that come up during
kernel compilation with Clang. These specific fixes were for benign
things: unused lambda captures and braces around scalar initializers.
2021-07-03 01:56:31 +04:30
Daniel Bertalan 3c6bdb8a61 AK: Make smart pointer factories work with aggregates
Aggregate initialization with brace-enclosed parameters is a
[C++20 feature][1] not yet implemented by Clang. This caused compile
errors if we tried to use the factory functions to create smart pointers
to aggregates.

As a (temporary) fix, [the LWG's previously proposed solution][2] is
implemented by this commit.

Now, wherever it's not possible to direct-initialize, aggregate
initialization is performed.

[1]:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html
[2]: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2089
2021-07-03 01:56:31 +04:30
Daniel Bertalan fda9f394d1 Kernel: Fix always-true comparison warnings 2021-07-03 01:56:31 +04:30
Daniel Bertalan b9f30c6f2a Everywhere: Fix some alignment issues
When creating uninitialized storage for variables, we need to make sure
that the alignment is correct. Fixes a KUBSAN failure when running
kernels compiled with Clang.

In `Syscalls/socket.cpp`, we can simply use local variables, as
`sockaddr_un` is a POD type.

Along with moving the `alignas` specifier to the correct member,
`AK::Optional`'s internal buffer has been made non-zeroed by default.
GCC emitted bogus uninitialized memory access warnings, so we now use
`__builtin_launder` to tell the compiler that we know what we are doing.
This might disable some optimizations, but judging by how GCC failed to
notice that the memory's initialization is dependent on `m_has_value`,
I'm not sure that's a bad thing.
2021-07-03 01:56:31 +04:30
Daniel Bertalan 45a82b2a5b Kernel: Fix struct forward declared as class 2021-07-03 01:56:31 +04:30
Daniel Bertalan 842249aff5 LibC: Don't use C++ attribute syntax in C-visible headers
Fixes errors when building Clang's compiler-rt, which compiles in C11
more.
2021-07-03 01:56:31 +04:30
Daniel Bertalan 3162c9e214 AK: Make (Nonnull)OwnPtr work with abstract classes
Clang produced a compile error at this requires statement if `T` was an
abstract class.
2021-07-03 01:56:31 +04:30
Daniel Bertalan b97a00d4b1 Kernel: Add missing override specifiers
The `#pragma GCC diagnostic` part is needed because the class has
virtual methods with the same name but different arguments, and Clang
tries to warn us that we are not actually overriding anything with
these.

Weirdly enough, GCC does not seem to care.
2021-07-03 01:56:31 +04:30
Linus Groh 33a341f5e1 Meta: Add Gunnar to the project reviewers in CONTRIBUTING.md :^) 2021-07-02 22:04:26 +01:00
Andreas Kling fd43d1e205 LibJS: Improve ResolveBinding + add GetIdentifierReference
ResolveBinding now matches the spec, while the non-conforming parts
are moved to GetIdentifierReference.

Implementing this properly requires variable bindings.
2021-07-02 22:22:21 +02:00
Max Wipfli 4b87dd5c5c Tests: Add test for String::find with empty needle
This adds a test case for String::find and String::find_all with empty
needles. The expected behavior is in line with what the C++ standard
library (and other languages standard libraries) expect.
2021-07-02 21:54:21 +02:00
Max Wipfli 9cc35d1ba3 AK: Implement String::find_any_of() and StringView::find_any_of()
This implements StringUtils::find_any_of() and uses it in
String::find_any_of() and StringView::find_any_of(). All uses of
find_{first,last}_of have been replaced with find_any_of(), find() or
find_last(). find_{first,last}_of have subsequently been removed.
2021-07-02 21:54:21 +02:00
Max Wipfli 17eddf3ac4 AK: Add input bounds checking to String::substring()
This checks for overflow in String::substring(). It also rearranges some
declarations in the header.
2021-07-02 21:54:21 +02:00
Max Wipfli 268d81a56c AK: Add String::find_last() and inline String::find() methods
This adds the String::find_last() as wrapper for StringUtils::find_last,
which is another step in harmonizing the String and StringView APIs
where possible.

This also inlines the find() methods, as they are simple wrappers around
StringUtils functions without any additional logic.
2021-07-02 21:54:21 +02:00
Max Wipfli d7a104c27c AK: Implement StringView::find_all()
This implements the StringView::find_all() method by re-implemeting the
current method existing for String in StringUtils, and using that
implementation for both String and StringView.

The rewrite uses memmem() instead of strstr(), so the String::find_all()
argument type has been changed from String to StringView, as the null
byte is no longer required.
2021-07-02 21:54:21 +02:00
Max Wipfli 3bdaed501e AK+Everywhere: Remove StringView::find_{first,last}_of(char) methods
This removes StringView::find_first_of(char) and find_last_of(char) and
replaces all its usages with find and find_last respectively. This is
because those two methods are functionally equivalent.
find_{first,last}_of should only be used if searching for multiple
different characters, which is never the case with the char argument.

This also adds the [[nodiscard]] to the remaining find_{first,last}_of
methods.
2021-07-02 21:54:21 +02:00
Max Wipfli 56253bf389 AK: Reimplement StringView::find methods in StringUtils
This patch reimplements the StringView::find methods in StringUtils, so
they can also be used by String. The methods now also take an optional
start parameter, which moves their API in line with String's respective
methods.

This also implements a StringView::find_ast(char) method, which is
currently functionally equivalent to find_last_of(char). This is because
find_last_of(char) will be removed in a further commit.
2021-07-02 21:54:21 +02:00
Max Wipfli 3ea65200d8 AK: Implement StringView::to_{lower,upper}case_string
This patch refactors StringImpl::to_{lower,upper}case to use the new
static methods StringImpl::create_{lower,upper}cased if they have to use
to create a new StringImpl. This allows implementing StringView's
to_{lower,upper}case_string using the same methods.

It also replaces the usage of hand-written to_ascii_lowercase() and
similar methods with those from CharacterTypes.h.
2021-07-02 21:54:21 +02:00
Andreas Kling 5ce9305c5f LibJS: Implement the PrepareForOrdinaryCall abstract operation
This is used by VM::call_internal() and VM::construct() which roughly
map to function objects' [[Call]] and [[Construct]] slots in the spec.

Reorganizing this code revealed something weird: NativeFunction gets
its strictness by checking VM::in_strict_mode(). In other words,
it inherits the strict flag from the caller context. This is quite
weird, but many test-js tests rely on it, so let's preserve it until
we can think of something nicer.
2021-07-02 21:44:08 +02:00