Commit graph

12536 commits

Author SHA1 Message Date
Andreas Kling 71e8554740 Kernel: Remove the now-unused FS::DirectoryEntry
This object was cumbersome and annoying (mostly due to its manually
managed, statically sized name buffer.) And now we no longer need it!
2020-08-18 18:26:54 +02:00
Andreas Kling 6ad2d31952 Ext2FS: Stop using FS::DirectoryEntry
We were only using this as a temporary helper object while constructing
directories. Create a simpler Ext2FSDirectoryEntry instead for this.
2020-08-18 18:26:54 +02:00
Andreas Kling 108263314a TmpFS: Stop using FS::DirectoryEntry in TmpFSInode
The list of children can just be a bunch of { name, inode }.
2020-08-18 18:26:54 +02:00
Andreas Kling c096cb9352 TmpFS: Avoid unnecessary inode lookup in TmpFSInode::lookup()
We don't have to ask the VFS to find our child inode, we have a pointer
to it right here.
2020-08-18 18:26:54 +02:00
Andreas Kling eeaba41d13 Kernel: Add DirectoryEntryView for VFS directory traversal
Unlike DirectoryEntry (which is used when constructing directories),
DirectoryEntryView does not manage storage for file names. Names are
just StringViews.

This is much more suited to the directory traversal API and makes
it easier to implement this in file system classes since they no
longer need to create temporary name copies while traversing.
2020-08-18 18:26:54 +02:00
Abu Sakib 8abf5048b8 Calendar: Add help menuitem 2020-08-18 17:24:14 +02:00
Sergey Bugaev 4f06cda8f8 2048: Tweak default window size
As requested by @nico
2020-08-18 17:19:52 +02:00
Sergey Bugaev 1671e1ac92 WindowServer+LibVT: Convert some dbgprintf() to dbg()
These kept annoying me, because these were the only two lines in the default
boot log that went unattributed.
2020-08-18 17:19:52 +02:00
Sergey Bugaev 7861ebaad7 2048: Generate more "2" tiles
This is how the original game does it.
2020-08-18 17:19:52 +02:00
Sergey Bugaev 8dd5b0af4e 2048: Move score to a status bar
See how straightforward this was? That's because, thanks to the separation
between the model and the view, we can tweak the view without modifying the
model in any way.
2020-08-18 17:19:52 +02:00
Sergey Bugaev 05ea144961 2048: Separate game logic from the view :^)
Look Ali, it's simple:

* The *model* (in many cases, an instance of GUI::Model, but it doesn't have to
  be) should implement the "business logic" (in this case, game logic) and
  should not concern itself with how the data/state is displayed to the user.

* The *view*, conversely, should interact with the user (display data/state,
  accept input) and should not concern itself with the logic. As an example, a
  GUI::Button can display some text and accept clicks -- it doesn't know or care
  what that text *means*, or how that click affects the app state. All it does
  is it gets its text from *somebody* and notifies *somebody* of clicks.

* The *controller* connects the model to the view, and acts as "glue" between
  them.

You could connect *several different* views to one model (see FileManager), or
use identical views with different models (e.g. a table view can display pretty
much anything, depending on what model you connect to it).

In this case, the model is the Game class, which maintains a board and
implements the rules of 2048, including tracking the score. It does not display
anything, and it does not concern itself with undo management. The view is the
BoardView class, which displays a board and accepts keyboard input, but doesn't
know how exactly the tiles move or merge -- all it gets is a board state, ready
to be displayed. The controller is our main(), which connects the two classes
and bridges between their APIs. It also implements undo management, by basically
making straight-up copies of the game.

Isn't this lovely?
2020-08-18 17:19:52 +02:00
Sergey Bugaev 99efc01b2e 2048: Automatically pick an appropriate font size 2020-08-18 17:19:52 +02:00
Sergey Bugaev 50d81f1e14 2048: Use the original colors 2020-08-18 17:19:52 +02:00
Sergey Bugaev 70356429ae 2048: Tweak cell metrics
This makes the game look closer to the original.

It also fixes a weird thing where cells were displayed in a wrong order (as if
mirrored or something), and to accommodate for that keyboard actions were also
mixed up. Now it's all working as intended.
2020-08-18 17:19:52 +02:00
Nico Weber 2460980d2c LibWeb: Implement Element.innerText
Reading the property has a few warts (see FIXMEs in the included
tests), but with this the timestamps on http://45.33.8.238/
get localized :^)

Since the Date() constructor currently ignores all arguments,
they don't get localized correctly but are all set to the current
time, but hey, it's still progress from a certain point of view.
2020-08-18 16:58:46 +02:00
Nico Weber 2f85af2a20 LibWeb: Simplify Node::text_content() 2020-08-18 16:58:46 +02:00
AnotherTest 68189f80cc Shell: Document the use of environment/local variables 2020-08-18 16:58:17 +02:00
AnotherTest 32bfb48577 Shell: Update manpage about for loop behaviour around signals 2020-08-18 16:58:17 +02:00
AnotherTest 4ee4c94d60 Shell: Respect the 'PROMPT_EOL_MARK' environment variable
This allows the users to customise what is shown when a command ends
without a newline.
2020-08-18 16:58:17 +02:00
AnotherTest ae9211037e LibLine: Make actual_rendered_string_metrics() static
This function didn't depend on the editor itself.
2020-08-18 16:58:17 +02:00
Muhammad Zahalqa ff577e22a3 Kernel: ProcessorInfo.cpp remove unused headers 2020-08-18 13:41:08 +02:00
AnotherTest bda1d7fd7b LibLine: Setup the keybindings after initialisation
This makes the keybindings that depend on `m_termios` (^W, ^U, etc) work.
2020-08-18 13:40:44 +02:00
Tom a698a58d3c WindowServer: Fix flickering
Rather than blitting and rendering each window every time, only
render what actually changed. And while doing so, only render
the portions that are visible on the screen. This avoids flickering
because flipping framebuffers isn't always perfectly in sync with
the code, so it's possible that the flip happens slightly delayed
and we can briefly see the next iteration having partially completed.

Also, avoid touching the mouse cursor unless it is in an area that
needs updating. This reduces flickering unless it is over an area
that is updated often. And because we no longer render the entire
screen, we'll save the contents below the cursor so that we can
hide it before touching that area.

Fixes #2981
2020-08-18 12:12:27 +02:00
Tom f8903acea2 LibGfx: Add convenience helpers for Rect 2020-08-18 12:12:27 +02:00
Tom a43ba348e1 LibGfx: Add convenience method Point::constrained 2020-08-18 12:12:27 +02:00
Tom 790eacfbd1 LibGfx: Add a few convenience methods to DisjointRectSet 2020-08-18 12:12:27 +02:00
AnotherTest 5b9d563b4b LibLine: Allow the user to override (or add) keybinds in the config file 2020-08-18 12:07:32 +02:00
AnotherTest 32839d40e3 LibLine: Make (almost) all key actions configurable
This moves all internal functions to a new file, and defines the old
keybinds with register_key_input_callback().
2020-08-18 12:07:32 +02:00
AnotherTest d0aab41628 LibLine: Read configuration from a config file 2020-08-18 12:07:32 +02:00
AnotherTest afbeb8f977 LibCore: Add ConfigFile::get_for_lib() 2020-08-18 12:07:32 +02:00
Ben Wiederhake 1176865276 Meta: Explain how to build with ninja
Inspired by #3047, and my struggles to understand how cmake is supposed to work ^^

Thanks to @bgianfo, who made me realize that ninja can be used just like make.
No idea why I didn't notice that earlier.
2020-08-17 23:05:55 +02:00
Muhammad Zahalqa 8c7b5fb97b
Kernel: Remove unneeded header (#3196)
AK/HashTable.h is not needed from SpuriousInterruptHandler
2020-08-17 22:58:09 +02:00
Luke c2a2552e46 LibWeb: Add more document tests, add comment, text and mixin tests
Also adds a TypeScript definition file for the test runner object.
2020-08-17 22:57:05 +02:00
Luke 8b807e65d7 LibWeb: Add Comment and DocumentFragment bindings, move querySelector...
...{All} to ParentNode. Exposes createDocumentFragment and
createComment on Document. Stubs out the document.body setter. 

Also adds ParentNode back :^).
2020-08-17 22:57:05 +02:00
Luke 7b755e6a58 LibWeb: Make HTMLPreElement's is_type match "listing" and "xmp"
I forgot to add these when I saw that listing and xmp are mapped to
HTMLPreElement.
2020-08-17 22:57:05 +02:00
Andreas Kling d1e83b4f6e FileManager: Make DirectoryView vend indexes from view model
Instead of translating between the sorting proxy and the underlying
file system model at all the DirectoryView API boundaries, just hand
out indexes into the sorting proxy model.

The only thing those indexes are used for on the outside is to
retrieve a GUI::FileSystemModel::Node for an index, so add a nice
helper on DirectoryView that turns a ModelIndex into a Node&.
2020-08-17 22:49:52 +02:00
Andreas Kling f0349323c4 LibGUI: Don't require passing model to FileSystemModel::Node APIs
The Node API was obnoxiously requiring you to pass the model into it
all the time, simply because nodes could not find their way back to
the containing model. This patch adds a back-reference to the model
and simplifies the API.
2020-08-17 22:02:21 +02:00
Andreas Kling 38d8426f32 FileManager: Move the "create new file" action into DirectoryView
This makes it available in both desktop and windowed modes. :^)
2020-08-17 21:34:14 +02:00
Andreas Kling be48f58d41 FileManager: Move "create new directory" action into DirectoryView
This makes it available in both desktop and windowed mode. :^)
2020-08-17 21:34:14 +02:00
Andreas Kling 0ffd319bda FileManager: Partially bring back the desktop context menu 2020-08-17 21:34:14 +02:00
Andreas Kling 66cedfa13b FileManager: Don't pass DirectoryView subview to hooks that don't care 2020-08-17 21:34:14 +02:00
Andreas Kling 0083fe0118 FileManager: Use DirectoryView for both windowed and desktop mode
This patch begins the process of converting FileManager's desktop mode
to using the DirectoryView class.

This will allow us to share most of the code between the two different
runtime modes of FileManager.

We lose a bit of functionality in this patch, but we'll bring it back!
2020-08-17 21:34:14 +02:00
Nico Weber e9b56b5b9c LibWeb: Add Node.textContent
This requires moving remove_all_children() from ParentNode to
Node, which makes ParentNode.cpp empty, so remove it.

It also co-opts the existing Node::text_content() method and
tweaks it slightly to fit the semantics of Node.textContent.
2020-08-17 21:23:11 +02:00
Nico Weber c0c7b4a098 Clock MenuApplet: Use Core::DateTime to simplify the code 2020-08-17 21:23:11 +02:00
Nico Weber a3908732ad LibJS: Add toLocaleString(), toLocaleDateString(), toLocaleTimeString() to Date
These just return a "readable" implementation of the date for now.
2020-08-17 21:23:11 +02:00
Nico Weber 8ebef785eb LibJS: Implement basic functionality of Array.from()
The optional 2nd and 3rd arguments are not yet implemented.

This assumes that `this` is the Array constructor and doesn't yet
implement the more general behavior in the ES6 spec that allows
transferring this method to other constructors.
2020-08-17 21:23:11 +02:00
Andreas Kling a50a9d67ee WindowServer: Close the framebuffer fd in ~Screen() 2020-08-17 18:05:35 +02:00
Andreas Kling 9ddd540ca9 Kernel: Bump process thread count to a 32-bit value
We should support more than 65535 threads, after all. :^)
2020-08-17 18:05:35 +02:00
Andreas Kling b6e18133ae LibWeb: Rename WebContentView => OutOfProcessWebView 2020-08-17 18:05:35 +02:00
Andreas Kling 56c3748dcc LibWeb: Rename PageView => InProcessWebView 2020-08-17 18:05:35 +02:00