Commit Graph

16622 Commits

Author SHA1 Message Date
Andreas Kling
548f8a0644 AK: TypeCasts.h should include Assertions.h 2021-02-10 09:13:29 +01:00
Andreas Kling
635a5eec75 LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
Andreas Kling
9de1253f44 LibWeb: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
Tom
a807d92a32 WindowServer: Fix switching between shadows and no shadows with themes
We weren't properly handling switching between having a shadow and
not having a shadow when switching themes. This allows an empty string
in the theme configuration for a shadow path, meaning no shadow should
be rendered.
2021-02-10 09:12:49 +01:00
Tom
5d4c4bd372 WindowServer: Occlusion calculation fixes
We didn't properly determine whether a window was fully covered, which
caused some artifacts in certain cases.

Fixes #5283
2021-02-10 09:12:49 +01:00
AnotherTest
338bb73289 AK: Fix build with Clang>=12
Build failure as in https://oss-fuzz-build-logs.storage.googleapis.com/log-79750138-f41e-4f39-8812-7c536f1d2e35.txt
Clang does not appear to like using consteval functions' arguments as
constant expressions, so move all the arguments that need to appear as
constant expressions into the template parameters for now.

This patch should fix the OSS-Fuzz build.
2021-02-10 08:01:47 +01:00
Linus Groh
1fd349b8c2 Userland: Use INET_ADDRSTRLEN for inet_ntop() buffers
There's no point in using different, seemingly randomly sized buffers as
the required size for storing an IPv4 address representation is well
known (16 bytes).
2021-02-09 22:58:19 +01:00
Andreas Kling
f24b674d7a LibWeb+WebContent: Don't relayout page on every scroll event
The WebContent process was redoing page layout every time you scrolled
the page. This was a huge CPU hog for no reason. Fix this by only doing
a relayout when the viewport is resized, not when it moves around.
2021-02-09 22:40:16 +01:00
Tom
964894dee6 WindowServer: Allow specifying different shadows for menus and tooltips
Also update the Redmond 2000 theme to drop shadows more Redmond-like.
2021-02-09 22:27:14 +01:00
Andreas Kling
c9aa7539a6 LibWeb: Make OOPWV resizing flicker-free :^)
When resizing, keep a copy of the last good bitmap we have, and keep
using that until we receive a new one from the WebContent process.
2021-02-09 22:08:55 +01:00
Camisul
8c220dee03 WindowServer: Vertically maximize window
Button now can handle middle and right clicks.
Added 2 new handlers in button class: on_right_click for Right mouse
button and on_middle_click for middle mouse button.

Added functionality to vertically maximize window with middle mouse
click on the maximize window button.

Also added a way to vertically maximize window by resizing window
height-wise lower than the maximum window height.
2021-02-09 21:36:11 +01:00
Tom
e1ee59ac9d WindowServer: Recompute occlusions and re-render shadows on theme change
Since theme changes may change geometrics, which are also affected by
window shadows, we need to recompute occlusions as well as re-render
window frames.
2021-02-09 21:33:54 +01:00
Andreas Kling
ace1b34798 LibWeb: Reset the HTML editing cursor blink cycle on arrow key movement
Also stop exposing the DOM cursor as a mutable reference on Frame,
since event handling code was using that to mess with the text offset
directly. Setting the cursor now always goes through the Frame where
we can reset the blink cycle appropriately.

This makes cursor movement look a lot more natural. :^)
2021-02-09 21:25:38 +01:00
Andreas Kling
2c4829cb14 LibWeb: Remove duplicated locals in EventHandler::handle_mousedown() 2021-02-09 20:49:37 +01:00
Andreas Kling
da7a8fc055 LibGUI: TextEditor widget should default to no wrapping
Since we don't support wrapping in right-aligned text mode, let's keep
the old behavior of wrapping being off-by-default for now.

Fixes #5275.
2021-02-09 20:28:29 +01:00
Nico Weber
106939c11f Base: Fill in rightmost pixel in crosshair cursor
gimp claimed that the rightmost white pixel was actually transparent.
It didn't look transparent in Serenity, but I painted it white like
the other inner pixels anyways.
2021-02-09 20:10:00 +01:00
Nico Weber
ae98f575d9 Base: Add 2x versions of most cursors
I upsampled them in gimp using the "None" filter and manually cleaned up
the outline. The drop shadow is just upsampled using "None" and looks a
bit rough -- someone who knows how to do this either has to re-create
the shadow on the 2x bitmaps, or we need to remove the shadow from the
resource and render it in code at some point. Still, looks a lot better
than with the upsampled 1x bitmaps.
2021-02-09 20:10:00 +01:00
Andreas Kling
085f80aeac Kernel: Remove unused root directory computation in Process creation
sys$fork() already takes care of children inheriting the parent's root
directory, so there was no need to do the same thing when creating a
new user process.
2021-02-09 19:18:13 +01:00
Andreas Kling
1f277f0bd9 Kernel: Convert all *Builder::appendf() => appendff() 2021-02-09 19:18:13 +01:00
Andreas Kling
764af6cdec AK: Use StringBuilder::appendff() instead of appendf() 2021-02-09 19:18:13 +01:00
Tom
db0149056f WindowServer: Don't render shadow for frameless windows
Fixes CatDog rendering odd square shadow.
2021-02-09 19:18:00 +01:00
Tom
3d374954eb WindowServer: Try harder to avoid re-rendering window shadow
We only really need to re-render the simple window shadow when
the size of the frame changes. So, for all other cases only re-render
the window frame without rendering the shadow.
2021-02-09 18:47:43 +01:00
Tom
0ce4b9d7db WindowServer: Implement simple window shadows
This implements simple window shadows around most windows, including
tooltips. Because this method uses a bitmap for the shadow bits,
it is limited to rectangular window frames. For non-rectangular
window frames we'll need to implement a more sophisticated algorithm.
2021-02-09 18:47:43 +01:00
Itamar
72fdab7bfb LanguageServers/Cpp: ParserAutoComplete engine inspects header files
... and performs preprocessing on the source code before parsing.

To support this, we are now able to keep track of multiple
files in the autocomplete engine. We re-parse a file whenever it is
edited.
2021-02-08 23:10:38 +01:00
Itamar
02038a0ede LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class 2021-02-08 23:10:38 +01:00
Itamar
bed06b13f3 LanguageServers/Cpp: Add FileDB and pass project_root in Greet()
FileDB wraps the access to the contents of project files.

When asked to fetch a file, FileDB will either return its in-memory
model of the file if it has been "opened" by the language-server
protocol, or otherwise fetch it from the filesystem.

Previously, the cpp language server did not pledge "rpath" and got
access to the contents of files whenever they were opened by the
language client.
However, features like inspection of header files require the language
server to get the content of files that were not opened by the client.

The language server now pledges rpath but makes sure to only unveil
the project's directory and /usr/include.
2021-02-08 23:10:38 +01:00
Itamar
bed3261723 LibCpp: Start working on a C preprocessor
We currently handle basic #define statements as well as ifdef and else
branches.
2021-02-08 23:10:38 +01:00
Itamar
2d2b3ba5ed LibCpp: Include CPP_DEBUG in AK/Debug.h 2021-02-08 23:10:38 +01:00
Itamar
8ed65d7b48 LibCpp: Parse If statements 2021-02-08 23:10:38 +01:00
Andreas Kling
e8f040139b Kernel: Remove unused Thread::is_runnable_state() 2021-02-08 23:07:33 +01:00
Andreas Kling
4ff0f971f7 Kernel: Prevent execve/ptrace race
Add a per-process ptrace lock and use it to prevent ptrace access to a
process after it decides to commit to a new executable in sys$execve().

Fixes #5230.
2021-02-08 23:05:41 +01:00
Andreas Kling
4b7b92c201 Kernel: Remove two unused fields from sys$execve's LoadResult 2021-02-08 22:31:03 +01:00
Andreas Kling
4cd2c475a8 Kernel: Make the space lock a RecursiveSpinLock 2021-02-08 22:28:48 +01:00
Andreas Kling
0d7af498d7 Kernel: Move ShouldAllocateTls enum from Process to execve.cpp 2021-02-08 22:24:37 +01:00
Andreas Kling
9ca42c4c0e Kernel: Always hold space lock while calculating memory statistics
And put the locker at the top of the functions for clarity.
2021-02-08 22:23:29 +01:00
Andreas Kling
8bda30edd2 Kernel: Move memory statistics helpers from Process to Space 2021-02-08 22:23:29 +01:00
Andreas Kling
b1c9f93fa3 Kernel: Skip generic region lookup in sys$futex and sys$get_stack_bounds
Just ask the process space directly instead of using the generic region
lookup that also checks for kernel regions.
2021-02-08 22:23:29 +01:00
Itamar
b31a514cce LibCpp: Depend on LibSyntax
We need this now that the C++ syntax highlighter is in LibCpp.
2021-02-08 22:02:40 +01:00
Linus Groh
22c6783db2 ping: Replace two magic numbers with ICMP_* macros 2021-02-08 20:00:08 +01:00
Linus Groh
2b03e95354 LibC: Define ICMP header type constants in netinet/ip_icmp.h
Let's get rid of some magic numbers soon. :^)
2021-02-08 20:00:08 +01:00
Andreas Kling
412cb66666 Revert "DynamicLoader: Remove unnecessary math functions"
This reverts commit b1f1f5afcf.

Unfortunately this broke dbgln() in the dynamic loader. We need to
figure out how to link libgcc into it properly.
2021-02-08 19:58:10 +01:00
Andreas Kling
f39c2b653e Kernel: Reorganize ptrace implementation a bit
The generic parts of ptrace now live in Kernel/Syscalls/ptrace.cpp
and the i386 specific parts are moved to Arch/i386/CPU.cpp
2021-02-08 19:34:41 +01:00
Andreas Kling
45231051e6 Kernel: Set the dumpable flag before switching spaces in sys$execve() 2021-02-08 19:15:42 +01:00
Andreas Kling
d746639171 Kernel: Remove outdated code to dump memory layout after exec load 2021-02-08 19:07:29 +01:00
Tom
15a1d9aa94 WindowServer: Cache rendered window frame in bitmap
This only renders the window frame once until the size of the window
changes, or some other event requires re-rendering. It is rendered
to a temporary bitmap, and then the top and bottom part is stored
in one bitmap as well as the left and right part. This also adds
an opacity setting, allowing it to be rendered with a different
opacity.

This makes it easier to enhance window themes and allows using
arbitrary bitmaps with e.g. alpha channels for e.g. shadows.
2021-02-08 19:02:04 +01:00
Tom
8ff34f96b6 WindowServer: Calculate transparent frame occlusions
If a window frame has transparency, include these areas in the
transparency rendering area so that we can render them flicker-free.
2021-02-08 19:02:04 +01:00
Andreas Kling
f1b5def8fd Kernel: Factor address space management out of the Process class
This patch adds Space, a class representing a process's address space.

- Each Process has a Space.
- The Space owns the PageDirectory and all Regions in the Process.

This allows us to reorganize sys$execve() so that it constructs and
populates a new Space fully before committing to it.

Previously, we would construct the new address space while still
running in the old one, and encountering an error meant we had to do
tedious and error-prone rollback.

Those problems are now gone, replaced by what's hopefully a set of much
smaller problems and missing cleanups. :^)
2021-02-08 18:27:28 +01:00
Andreas Kling
b2cba3036e Kernel: Remove unused MemoryManager::validate_range()
This is no longer used since we've switched to using the MMU to
generate EFAULT errors.
2021-02-08 18:27:28 +01:00
Andreas Kling
cf5ab665e0 Kernel: Remove unused Process::for_each_thread_in_coredump() 2021-02-08 18:27:28 +01:00
Andreas Kling
1cec5f3d4c Build: Allow setting DBGLN_NO_COMPILETIME_FORMAT_CHECK via CMake flag 2021-02-08 18:27:28 +01:00