Commit graph

19887 commits

Author SHA1 Message Date
Ali Mohammad Pur 56a6d7924e AK: Let Result<T, E> know its Value and Error types
It's much easier to ask for T::ValueType than for
RemoveReference<decltype(declval<T>().release_value())>
2021-05-08 22:14:39 +02:00
Ali Mohammad Pur 62af7c4bdf AK+LibCpp: Remove DEBUG_SPAM in favour of per-application defines
What happens if one file defines DEBUG_SPAM, and another doesn't,
then we link them together and get ODR violations? -- @ADKaster
2021-05-08 22:14:39 +02:00
Ali Mohammad Pur 080f2c0e3e AK: Add an optional 'extra' descriptive field to ScopeLogger
Often it's easier to know what the functions are doing with a unique
name next to the function's name :)
2021-05-08 22:14:39 +02:00
Gunnar Beutner d301bd6732 Ports: Fix building icu
LC_MESSAGES was recently added in LibC which makes the hack in the
package.sh script unnecessary. In fact, this breaks building the
port now.
2021-05-08 20:48:23 +02:00
Mart G e0deb46723 Kernel: Traverse ext2 directories blockwise.
Instead of reading in the entire contents of a directory into a large
buffer, we can iterate block by block. This only requires a small
buffer.

Because directory entries are guaranteed to never span multiple blocks
we do not have to handle any edge cases related to that.
2021-05-08 20:01:08 +02:00
Liav A 49b132a92d Kernel/ACPI: Map two pages when reading the FADT
On some cases, the FADT could be on the end of a page, so if we don't
have two pages being mapped, we could easily read from a non-mapped
virtual address, which will trigger the UB sanitizer.

Also, we need to treat the FADT structure as volatile and const, as it
may change at any time, but we should not touch (write) it anyhow.
2021-05-08 19:15:54 +02:00
Liav A f7b5352af0 Kernel/HID: Don't assume that ACPI is initialized 2021-05-08 19:15:54 +02:00
Gunnar Beutner b05a6a1701 Ports: Add port for gettext 2021-05-08 19:14:21 +02:00
Gunnar Beutner 1c3c072a76 LibC: Add stubs for getrlimit()/setrlimit() 2021-05-08 19:14:21 +02:00
Gunnar Beutner 6e80b9fd01 LibPthread: Add implementation for pthread_mutexattr_gettype 2021-05-08 19:14:21 +02:00
Gunnar Beutner 7fea58c4f1 LibC: Add definition for LC_MESSAGES 2021-05-08 19:14:21 +02:00
Gunnar Beutner fc2ddd5843 Ports: Build shared libraries for ffmpeg 2021-05-08 19:14:09 +02:00
Gunnar Beutner be724f184b Ports: Link libtiff against libjpeg
Apparently libtiff uses symbols from libjpeg when that port was
previously built.
2021-05-08 19:14:09 +02:00
Gunnar Beutner 611019e938 Ports: Add port for harfbuzz 2021-05-08 19:13:42 +02:00
Gunnar Beutner 2f3ded4dfd Ports: Add port for libsodium 2021-05-08 18:12:01 +02:00
Gunnar Beutner 5093b76f85 Ports: Add port for libphysfs 2021-05-08 18:11:52 +02:00
Gunnar Beutner 6afb6eb6a9 LibC: Add definition for EDQUOT
This is used by the libphysfs port.
2021-05-08 18:11:52 +02:00
Itamar 8a01167c7d AK: Add missing GenericTraits<NonnullRefPtr>
This enables us to use keys of type NonnullRefPtr in HashMaps and
HashTables.

This commit also includes fixes in various places that used
HashMap<T, NonnullRefPtr<U>>::get() and expected to get an
Optional<NonnullRefPtr<U>> and now get an Optional<U*>.
2021-05-08 18:10:56 +02:00
Itamar 1da0d402b7 AK: Add constructors to Optional that accept non const qualified inputs 2021-05-08 18:10:56 +02:00
Itamar 484823e9d5 AK: Add a non-const overload to HapMap::get()
Additionally, the const version of get() returns Optional<ConstPeekType>
for smart pointers.

For example, if the value in the HashMap is OwnPtr<u32>,
HashMap::get() const returns Optional<const u32*>.
2021-05-08 18:10:56 +02:00
Itamar b816bd0806 AK: Add ConstPeekType to Traits
Also, the PeekType of smart pointers is now T* instead of const T*.

Note: This commit doesn't compile, it breaks HashMap::get() for some
types. Fixed in the next commit.
2021-05-08 18:10:56 +02:00
Itamar 77d462426b HackStudio: Remove redundant insertion to m_open_files
previous_open_project_file already exists in m_open_files under the
active_file() key.
2021-05-08 18:10:56 +02:00
Mart G 25a5e59f79 Kernel: Place ext2 dir entries so they don't span multiple blocks
Ext2 dir entries spanning multiple blocks are not allowed.
If they do occur they are flagged as corrupt by e2fsck for example.
2021-05-08 15:25:50 +02:00
r-paiva 293a5c2b49 Kernel-VFS: Fixed kernel crash if parent custody is null
In VFS::rename, if new_path is equal to '/', then, parent custody is
set to null.
VFS::rename would then use parent custody without checking it first.

Fixed VFS::rename to check both old and new path parent custody
before actually using them.
2021-05-08 15:22:47 +02:00
r-paiva 90b6f999e5 Utilities: Fix mv command requesting incorrect path
When moving multiple files by using *, e.g.,: mv * /new_path/
If there was an error while trying to move a file to the new path
the next file in the file list to be moved would have its path
incorrectly set.

- Fixed mv loop to always append the correct path to the destination
path.
- Added proper error message when mv fails.
2021-05-08 15:22:47 +02:00
Brendan Coles 2fe6242f15 Themes: Faux Pas: Set RubberBandFill transparency 2021-05-08 14:08:14 +01:00
Maciej Zygmanowski ece300e1e3 LibGUI: Add missing <AK/Function.h> include 2021-05-08 13:19:24 +01:00
Andreas Kling 2905e10513 LibGUI+TextEditor: Make TextDocument modified state track undo stack
This was quite unreliable before. Changes to the undo stack's modified
state are now reflected in the document's modified state, and the
GUI::TextEditor widget has its undo/redo actions updated automatically.

UndoStack is still a bit hard to understand due to the lazy coalescing
of commands, and that's something we should improve upon (e.g with more
explicit, incremental command merging.) But for now, this is a nice
improvement and undo/redo finally behaves in a way that feels natural.
2021-05-08 13:49:34 +02:00
Andreas Kling ee19f7c0aa LibGUI: Use UndoStack::on_state_change inside TextDocument/TextEditor
Have TextDocument listen for state changes on the internal undo stack,
and forward those to all clients via a new virtual function.

This simplifies updating the can_undo / can_redo states of TextEditor.
2021-05-08 13:49:34 +02:00
Andreas Kling 0cb6103928 LibGUI: Add UndoStack::on_state_change hook
This will allow clients to react to the undo stack changing state.
It's invoked when the stack or clean index are changed.
2021-05-08 13:49:34 +02:00
Andreas Kling 74a4571f02 LibGUI: Reverse internal direction of GUI::UndoStack
The undo stack was very difficult to understand as it grew by adding
new undo commands to the front of the internal vector. This meant we
had to keep updating indices as the stack grew and shrank.

This patch makes the internal vector grow by appending instead.
2021-05-08 13:49:34 +02:00
Andreas Kling 2ef4fbc5c1 Revert "LibGUI: Fix undo stack reporting wrong modified state"
This reverts commit 0b7e19e2bb.

Let's reverse the direction of the undo stack to fix the confusion.
2021-05-08 13:48:15 +02:00
Brendan Coles 29e323269c Themes: Faux Pas: Set HoverHighlight to white 2021-05-08 12:28:48 +01:00
Linus Groh 5468a23fc2 Base: Fix path to LibJS tests in test-js(1) man page 2021-05-08 12:04:55 +01:00
Brendan Coles dbb88d7dd4 Themes: Add Light theme 2021-05-08 11:13:03 +01:00
Linus Groh 67b47013d2 LibWeb: Use list-style-type circle/square for nested unordered lists
An idea shamelessly stolen from other UAs :^)
2021-05-08 10:49:16 +01:00
Linus Groh dfa546702a Utilities/CMakeLists: Put all entries in alphabetical order 2021-05-08 10:07:11 +01:00
bleusakura 87de32df59
dd: Add ability to use k, M, & G suffixes for block sizes 2021-05-08 10:03:31 +01:00
Carlos César Neves Enumo 0b7e19e2bb LibGUI: Fix undo stack reporting wrong modified state
Since the `redo` action never goes back to `index: 0`,
we have to mark the clean index as being the current
non-empty index for the undo/redo navigation to work properly.

The problem is that if we never `undo`, the stack index stays at zero,
which is the empty container waiting for commands. In that situation,
if we save the document, it registers the clean index as being 1
(the non-empty index) but because the stack index has never left zero,
the document was being reported as modified, being out of sync with
the window modified state.
2021-05-08 09:55:45 +01:00
Ali Mohammad Pur 3c01de4f0b Utilities/CMakeLists: Put 'file' entry in alphabetical order 2021-05-08 10:54:29 +02:00
Jesse Buhagiar e8cd89a538 LibGL: Move polygon clipping to Clipper class
This code has also been optimised to be much more memory
friendly by removing a _lot_ of extraneous copies. The result
is that, when profiled, it's around 8x faster than the previous
implementation.

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-05-08 10:13:22 +02:00
Jesse Buhagiar 834f3c64f0 Demos: Add OpenGL teapot demo :^)
Every GL library needs an implementation of this!
Currently drawn with "pixel vomit" colours as we don't
yet support lighting via the GL library.

This also ships with a super basic Wavefront OBJ loader.
2021-05-08 10:13:22 +02:00
Stephan Unverwerth 5ff248649b LibGL: Add software rasterizer
This is based mostly on Fabian "ryg" Giesen's 2011 blog series
"A trip through the Graphics Pipeline" and Scratchapixel's
"Rasterization: a Practical Implementation".

The rasterizer processes triangles in grid aligned 16x16 pixel blocks,
calculates barycentric coordinates and edge derivatives and interpolates
bilinearly across each block.

This will theoretically allow for better utilization of modern processor
features such as SMT and SIMD, as opposed to a classic scanline based
triangle rasterizer.

This serves as a starting point to get something on the screen.
In the future we might look into properly pipelining the main loop to
make the rasterizer more flexible, enabling us to enable/disable
certain features at the block rather than the pixel level.
2021-05-08 10:13:22 +02:00
Stephan Unverwerth e6c0600499 LibGL: Add back face culling functions
Adds all needed functions to support back face culling
and implements back face culling in the SoftwareGLContext.
2021-05-08 10:13:22 +02:00
Ali Mohammad Pur eff3c8a954 LibGL: Implement glColor4(ub,f)v 2021-05-08 10:13:22 +02:00
Ali Mohammad Pur 193b53344a LibGL: Implement glVertex2f(v) 2021-05-08 10:13:22 +02:00
Ali Mohammad Pur 6b11a5688d LibGL: Implement glVertex3fv 2021-05-08 10:13:22 +02:00
Ali Mohammad Pur f601f12801 LibGL: Implement glOrtho and underlying functions 2021-05-08 10:13:22 +02:00
Jesse Buhagiar f07a7f7b94 LibGL: Impement glLoadMatrixf and underlying function 2021-05-08 10:13:22 +02:00
Jesse Buhagiar ea0df0b5da LibGL: Implement glScalef 2021-05-08 10:13:22 +02:00