Commit graph

19702 commits

Author SHA1 Message Date
Timothy Flynn 59193dd6b3 Solitaire: Only start timer when the timer event is needed
The timer is no longer used to trigger a paint event for all updates; it
is only used to paint the new-game and game-over animations. So only run
the timer during those events.
2021-05-05 21:38:45 +02:00
Timothy Flynn 4fc9c1d710 Solitaire: Refactor painting logic to accomodate to-be-added widgets
A series of events led to this change: The goal is to add more widgets
to the Solitaire GML, such as a GUI::Statusbar. To do so without this
change, the window ends up with some black artifacts between the main
Solitaire frame and the added elements, because the GML specifies the
main widget to have fill_with_background_color=false. However, setting
that property to true results in the background color of the widget
interferring with the Solitaire frame trying to manually paint its
background green. This results in flickering and some elements in the
Solitaire frame being painted over by the main background color.

To avoid all of that behavior, this sets fill_with_background_color=true
and the Solitaire frame's background color to green in the GML. Further,
the frame now only queues a paint update on the specific Gfx::Rect areas
that need to be updated. This also means we no longer need to track if a
stack of cards is dirty, because we only trigger a paint event for dirty
stacks.
2021-05-05 21:38:45 +02:00
Timothy Flynn bb7b76e505 Solitaire: Don't invoke srand multiple times
This doesn't need to be invoked each time the game wants something
random.
2021-05-05 21:38:45 +02:00
Timothy Flynn a540ec3519 Solitaire: Convert Solitaire GUI to a frame
Looks a bit nicer as a frame with inset edges.
2021-05-05 21:38:45 +02:00
Timothy Flynn 0ff4eec8a8 Solitaire: Convert Solitaire window to be created from GML
No functionial change here, but this more easily allows for adding GUI
elements to the Solitaire window. This nests the SolitaireWidget as a
child of the main window's widget so that the SolitaireWidget does not
color the entire window green when it paints its background.
2021-05-05 21:38:45 +02:00
Timothy Flynn e1492e9a62 Solitaire: Place files in Solitaire namespace and rename main widget
The purpose is to allow the Solitaire widget to be used in GML. The
macro to register a widget requires a namespace, so this moves all files
in the application to the Solitaire namespace. This also renames the
SolitaireWidget class to Game - this is to avoid the redundancy /
verbosity of typing "Solitaire::SolitaireWidget", and matches many other
games in Serenity (Breakout, 2048, etc.).
2021-05-05 21:38:45 +02:00
Timothy Flynn 15f0ee1727 Solitaire: Replace self-owned timer with Core::Object's timer
This is just a bit nicer than owning a separate timer in the Solitaire
application because LibCore will prevent timer events from firing when
e.g. the window is not visible. Therefore SolitaireWidget doesn't need
need to check for such conditions.
2021-05-05 21:38:45 +02:00
Timothy Flynn cfc3a2ebac Solitaire: Bump stacked cards down to reveal suit
Stacks of cards currently cover the suit completely and players must
click-and-drag cards out of the way to see the suit beneath other cards.
This bumps the stacks down a bit to let players peek the suit without
having to take any action.
2021-05-05 21:38:45 +02:00
Brian Gianforcaro 83dca542bb Meta: Enable linting of shell scripts under Toolchain
Now that everything under Toolchain is shellcheck clean,
remove it from the exception list.
2021-05-05 21:26:37 +02:00
Brian Gianforcaro 8b856bd5a1 Toolchain: Fix expansion bugs and make BuildIt.sh shellcheck compliant
BuildIt.sh had a bunch of SC2086 errors, where we were not quoting
variables in variable expansions. The logic being:

    Quoting variables prevents word splitting and glob expansion,
    and prevents the script from breaking when input contains spaces,
    line feeds, glob characters and such.

    Reference: https://github.com/koalaman/shellcheck/wiki/SC2086

As bcoles noticed in #6772, shellcheck actually found a real bug here,
where the user's build directory included spaces.

Close: #6772
2021-05-05 21:26:37 +02:00
Brian Gianforcaro f558a44610 Toolchain: Make BuildFuseExt2.sh shellcheck compliant
BuildFuseExt2.sh was saying it should be run under /bin/sh but it is
using bash extensions like pushd/popd, ${BASH_SOURCE[0]}, etc. So just
run it under bash to avoid any potential issues.
2021-05-05 21:26:37 +02:00
Brian Gianforcaro b4927a753d Toolchain: Make BuildPython.sh shellcheck compliant
Shellcheck is unable to source non-literal includes,
so inform shellcheck to just ignore this include.
2021-05-05 21:26:37 +02:00
Sergey Bugaev 37a59f7f40 Base: Start LookupServer on boot
I can't say I like starting yet another thing on boot... but now that
LookupServer provides mDNS (and optionaly DNS) services to other hosts,
we have to start it on boot, not when the first local client connects.
2021-05-05 21:16:17 +02:00
Sergey Bugaev bb06e720de LookupServer: Implement basic mDNS support :^)
The implementation is extremely basic, and is far from fully conforming
to the spec. Among other things, it does not really work in case there
are multiple network adapters.

Nevertheless, it works quite well for the simple case! You can now do
this on your host machine:

$ ping courage.local

and same on your Serenity box:

$ ping host-machine-name.local
2021-05-05 21:16:17 +02:00
Sergey Bugaev fd76e07399 LookupServer: Implement DNSName::operator==() 2021-05-05 21:16:17 +02:00
Sergey Bugaev 78459b92d5 Kernel: Implement IP multicast support
An IP socket can now join a multicast group by using the
IP_ADD_MEMBERSHIP sockopt, which will cause it to start receiving
packets sent to the multicast address, even though this address does
not belong to this host.
2021-05-05 21:16:17 +02:00
Idan Horowitz b9c367e13b Meta: Add action to tweet each commit on push 2021-05-05 21:12:09 +02:00
Spencer Dixon 2156c728cd
Kernel: Fix writes to ProcFS (#6879)
When using `sysctl` you can enable/disable values by writing to the
ProcFS. Some drift must have occured where writing was failing due to
a missing `set_mtime` call. Whenever one `write`'s a file the modified
time (mtime) will be updated so we need to implement this interface in
ProcFS.
2021-05-05 21:07:13 +02:00
Andreas Kling 773c17b6a0 Documentation: Update FAQ a bit and move it into Documentation/
This was hiding on the serenityos.org website previously, where not
many people found it. Let's put it in a more natural location, and
also make sure to link to it from the README.
2021-05-05 20:03:02 +02:00
Ali Mohammad Pur a51113c58e AK: Add a Variant<Ts...> implementation
Also adds an AK::Empty struct, because 'empty' variants are useful, but
this implementation leaves that to the user (i.e. a variant cannot
actually be empty, but it can contain an instance of Empty - i.e. a
byte).
Note that this is more of a constrained Any type, but they basically do
the same things anyway :^)
2021-05-05 19:02:51 +02:00
Ali Mohammad Pur ab03c6fadf AK: Export integer_sequence_generate_array() 2021-05-05 19:02:51 +02:00
Ali Mohammad Pur b361793ad8 AK: Add min() and max() methods to Array<T, N>
...That are only defined when min() and max() are defined on the
elements.
2021-05-05 19:02:51 +02:00
Brian Gianforcaro 11306d7121
Kernel: Modify TimeManagement::current_time(..) API so it can't fail. (#6869)
The fact that current_time can "fail" makes its use a bit awkward.
All callers in the Kernel are trusted besides syscalls, so assert
that they never get there, and make sure all current callers perform
validation of the clock_id with TimeManagement::is_valid_clock_id().

I have fuzzed this change locally for a bit to make sure I didn't
miss any obvious regression.
2021-05-05 18:51:06 +02:00
Brian Gianforcaro 64b4e3f34b
Kernel: Add Processor::is_bootstrap_processor() function, and use it. (#6871)
The variety of checks for Processor::id() == 0 could use some assistance
in the readability department. This change adds a new function to
represent this check, and replaces the comparison everywhere it's used.
2021-05-05 18:48:26 +02:00
Tom 72a61fe137 Kernel: Remove shadowing member variable from FileDescriptionBlocker
FileDescriptionBlocker::m_should_block was shadowing the parent's
FileBlocker::m_should_block variable, which would cause should_block()
to return the wrong value.

Found by @gunnarbeutner
2021-05-05 18:44:40 +02:00
Idan Horowitz 37903db2b4 LibWeb: Remove double comma in FrameLoader debug logging 2021-05-05 16:37:26 +01:00
Linus Groh 346560d7c8 LibJS/Tests: Use hasOwnProperty() for duplicate test check
The current way of doing this would also traverse the prototype chain,
and therefore yield false positive results for keys like "toString".
2021-05-05 15:58:53 +01:00
Linus Groh d9702ff561 Spreadsheet: Use shrink-to-fit for cell fg/bg color input layout
This fixes an issue where the bottom of both color inputs was cut off
due to insufficient, hardcoded height.
2021-05-05 15:30:45 +01:00
setepenre 8978325af8 Base: Add manpage for groups(1) 2021-05-05 15:12:30 +01:00
setepenre 580b335053 Userland: Add groups program 2021-05-05 15:12:30 +01:00
setepenre 56010379f9 LibCore: Call setgrent before looping on groups in get_extra_gids 2021-05-05 15:12:30 +01:00
Brendan Coles aee735889e Base: Fix typos and spelling errors in man pages 2021-05-05 12:22:08 +01:00
Brian Gianforcaro 56fccf1667 Base: Minor cleanup of a few man pages.
- Fix some typos and formatting.

- Add links to Mitigations from unveil / pledge.
2021-05-05 12:24:16 +02:00
Brian Gianforcaro 325e491d34 Base: Add a boot_parameters(7) to document kernel boot parameters. 2021-05-05 12:24:16 +02:00
Luke 2cc6b919f7 LibWeb: Implement EventTarget.dispatchEvent
Used by Web Platform Tests to test events
2021-05-04 23:41:44 +01:00
Luke 7f6baf8b17 LibWeb: Add Document.{images,embeds,plugins,links,forms,scripts} 2021-05-04 23:40:43 +01:00
Luke 19731fc14c LibWeb: Use HTML-uppercased qualified name for the Element node name
For regular elements, this is just the qualified name.
However, for HTML elements in HTML documents, it is the qualified name
uppercased.

This is used by jQuery to determine the document is an HTML document.
Not having this made jQuery assume the document was XML, causing
weird behaviour.

To do this, an internal string of qualified name is created.
This is to prevent constantly regenerating it. This is allowed by
the spec.

This is the same for the HTML-uppercased qualified name.
2021-05-04 23:24:03 +01:00
Luke 7c6c7ca542 LibWeb: Add createDocument and createDocumentType for DOMImplementation
Both required for the acid3 test.
createDocument is used extensively in Web Platform Tests.
2021-05-04 22:59:15 +01:00
Luke 5952bc1ea4 LibWeb: Add support for extended attributes on IDL parameters
Also adds support for [LegacyNullToEmptyString] for parameters.
2021-05-04 22:59:15 +01:00
Luke b816000d47 LibWeb: Expose HTMLInputElement.name 2021-05-04 22:03:14 +01:00
Idan Horowitz fbc93a3a2f
Meta: Remove link to man6 from man.serenityos.org
We don't currently have any man6 entries.
2021-05-04 22:02:50 +01:00
Linus Groh ca88892c29 Meta: Mention man.serenityos.org in the README :^) 2021-05-04 21:52:46 +01:00
Sergey Bugaev 7f98aaa65a Userland: Pledge wpath & cpath in strace
...while we open the output file.
2021-05-04 22:36:58 +02:00
Sergey Bugaev 72125827da Userland: Refactor head(1) to not use stdio
This fixes extensive copying data around, and also makes head(1) in
bytes mode read exactly as much data as it needs.

Also, rename --characters to --bytes: that's exactly what it does
(actual character counting is way more complicated), and that's what
the option is called in GNU coreutils.

Fixes https://github.com/SerenityOS/serenity/issues/6852
2021-05-04 22:36:58 +02:00
Ali Mohammad Pur d288f6654e AK: Make LEB128 capable of reading into any type
And not just ssize_t/size_t.
This is useful in cases where the output size is supposed to be larger
than size_t.
2021-05-04 22:33:35 +02:00
Ali Mohammad Pur 48260b5054 AK: Move the LEB128 logic to AK and make it usable with InputStream 2021-05-04 22:33:35 +02:00
Idan Horowitz 8cc6372b14 Meta: Strip man prefix from generated man page directories 2021-05-04 22:05:12 +02:00
Idan Horowitz d29f17e882 Meta: Use correct hrefs for man pages in man.serenityos.org/index.html 2021-05-04 22:05:12 +02:00
Idan Horowitz e96ac568a7 Meta: Track Meta/Websites/man.serenityos.org changes in manpages action 2021-05-04 22:05:12 +02:00
Ali Mohammad Pur 8449521064 Meta: Remove existing test directories before copying new ones in
Previously, we would end up with `js-tests/Tests` and `web-tests/Tests`
because the previous directories were already there.
2021-05-04 21:55:30 +02:00