Commit Graph

6052 Commits

Author SHA1 Message Date
Marcus Nilsson
e0cf6f3cf0 TextEditor: Reset editor width when disabling preview mode
When disabling preview mode, reset the fixed width of m_editor so that
it fills out the window again even after resizing the splitter.
2021-07-03 17:36:50 +02:00
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
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
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
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
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
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
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
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
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
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
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
Hediadyoin1
f4072a5038 LibM: Add long double defines of Math Constants 2021-07-02 19:50:43 +02:00
Hendiadyoin1
c74d7adac6 LibM: Implement path for negative powers 2021-07-02 19:50:43 +02:00
Andreas Kling
71fc7ac7ac LibJS: Make SuperCall a proper AST node and clean up evaluation 2021-07-02 19:39:09 +02:00
Andreas Kling
d81f4d5228 LibJS: NewExpression doesn't need compute_this_and_callee()
Now that NewExpression is separated from CallExpression, it doesn't
have to use the ad-hoc compute_this_and_callee() logic.
2021-07-02 18:43:25 +02:00
Andreas Kling
814549b846 LibJS: Split out NewExpression evaluation from CallExpression
This patch adds an override for NewExpression::execute() in the AST
interpreter to separate the logic from CallExpression. As a result,
both evaluation functions are simplified.

Both expressions are still largely non-conforming, but this makes
it easier to work on improving that since we can now deal with them
separately. :^)
2021-07-02 18:25:32 +02:00
Andreas Kling
bad1acf137 LibJS: Break out ArgumentListEvaluation AO from CallExpression 2021-07-02 17:54:34 +02:00
Marcus Nilsson
05e8bea736 PixelPaint: Reset layer widgets when closing last tab
When closing the last tab the layer list widget and layer properties
widget did not reset since they still had a pointer to the image.
2021-07-02 17:54:01 +02:00
Marcus Nilsson
54d4df668a PixelPaint: Add layer to image before setting properties
Previously when opening an image with layers that had properties like
visibility set, PixelPaint would crash when trying to trigger
layer_did_modify_properties() without in image. Avoid this by
adding the layer to the image before setting the properties.
2021-07-02 17:54:01 +02:00
Spencer Dixon
48731e9f17 LibThreading: Add new detach() API to Thread
Sometimes you don't care about `joining()` the result of a thread. The
underlying pthread implementation already existed for detaching and
now we expose it to the higher level API.
2021-07-02 17:52:45 +02:00
Idan Horowitz
f8f3ff65fe LibJS: Bring %TypedArray%.prototype.set slightly closer to spec
Specifically, instead of using the internal {get, put}_by_index methods
we now use the GetValueFromBuffer and SetValueInBuffer abstract
operations, as required by the specification.

While i was here i also replaced a couple custom detached array buffer
error messages with the existing ErrorType::DetachedArrayBuffer.
2021-07-02 15:53:51 +01:00
Spencer Dixon
e6f0b2d817 Assistant: Add a new FileProvider to assist in searching the filesystem
When searching in Assistant, we now dispatch some background jobs to
query the whole filesystem. Activating a result will use the Desktop
launcher's default way of opening that file or directory.
2021-07-02 16:47:14 +02:00
Spencer Dixon
00f93b2545 LibThreading: Add ability to cancel ongoing BackgroundActions
Handlers of the BackgroundAction are responsible for checking if the
action has been cancelled and returning early.
2021-07-02 16:47:14 +02:00
Spencer Dixon
4a3958c8ae Assistant: Remove Result::Kind in favor of native typeid
I was unaware of the `typeid` construct in C++ which can be used to
achieve the same thing I was doing with this extra Kind enum.
2021-07-02 16:47:14 +02:00
Ali Mohammad Pur
ccbc54358d LibJS: Allow patterns in parenthesized arrow function parameters 2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
2e00731ddb LibJS: Allow 'yield' and 'await' as function expression names
The spec says so, and test262 checks for this too.
2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
a6fe27423a LibJS: Allow binding patterns as for in/of targets 2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
bd9f28bba6 LibJS: Allow 'yield' as a variable name outside of generator functions 2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
0292ad33eb LibJS: Make a slash after a curly close mean not-division
There's no grammar rule that allows this.
2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
46ef333e9c LibJS: Parse generator functions in class expressions too 2021-07-02 14:59:03 +02:00
Spencer Dixon
609a0aa75d Assistant: Change to home directory when spawning applications
When launching Terminal via Taskbar we change to the users home
directory. For consistency, let's also `chdir` to `/home/anon` when
launching apps via Assistant's AppProvider.
2021-07-02 14:16:56 +02:00
Tom
26e9140ea1 WindowServer: Fix redrawing menu window that already existed
This fixes redrawing a menu where the window menu is reused at a
different location or with different content.
2021-07-02 13:12:29 +02:00
Brian Gianforcaro
179d8f6815 LibELF: Use StringView literal to avoid string allocations 2021-07-02 10:51:20 +04:30
Brian Gianforcaro
1498dcd9e1 DynamicLoader: Use string view literal to remove a allocation on startup
The ""sv operator switches a const char* to String conversion into
just a StringView literal.
2021-07-02 10:51:20 +04:30
Ali Mohammad Pur
b538e15548 LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
62ca81fdcc LibJS: Implement the %TypedArray%.set() function 2021-07-02 04:53:01 +04:30