Commit graph

266 commits

Author SHA1 Message Date
Linus Groh
6f95a6ca27 Taskbar: Use GUI::AppFile 2020-12-27 22:46:52 +01:00
Linus Groh
00402686f3 SystemMenu: Use GUI::AppFile 2020-12-27 22:46:52 +01:00
Linus Groh
bb1d52eaf0 LaunchServer: Use GUI::AppFile 2020-12-27 22:46:52 +01:00
Andreas Kling
04f1f74b85 LibGUI+WindowServer: Tweak hover shadows slightly
Move the shadow 1 more pixel away from the unhovered icon location,
making a total 2 pixel distance between the icon and the shadow.
Also tweak the shadow color to be a darkened variant of the base color
underneath the icon.
2020-12-27 18:43:34 +01:00
Sergey Bugaev
738f5f4d66 SystemServer: Set HOME for services
Fixes https://github.com/SerenityOS/serenity/issues/4484
2020-12-26 14:23:29 +01:00
Sergey Bugaev
95157f8b81 SystemServer: Port to Core::Account
We now have a handy Core::Account class that we can use instead of iterating
over the passwd database ourselves.
2020-12-26 14:23:29 +01:00
Linus Groh
dd2ce8bc8f LaunchServer: Remove icons from LaunchServer::Handler 2020-12-26 01:09:13 +01:00
Linus Groh
d8899ea65b WindowServer: Validate cursor type in SetWindowCursor message handler
Fixes #4536.
2020-12-25 23:07:06 +01:00
Andreas Kling
f1b1558c7b Everywhere: Tweak "2020-2020" => "2020" in copyright headers 2020-12-25 12:24:05 +01:00
Linus Groh
0384eb41ae Taskbar: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Linus Groh
c670a2b52e SystemMenu: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Linus Groh
0729c8ed65 LaunchServer: Ignore empty FileType / Protocol / [Launcher] config values
"Foo=" should be treated the same as "Foo" being missing.
2020-12-24 10:25:18 +01:00
Linus Groh
bed240d4b3 LaunchServer+Base: Stop using Browser as default protocol handler
Browser supports very few protocols (http, https, gemini, file) at the
moment, so there's no point in using it as a catch-all and default
protocol handler. I added an explicit association for gemini to
/bin/Browser instead.

This stops Desktop::Launcher::open() from reporting success for any URL,
which really isn't the case (Browser shows an error page...).
2020-12-24 10:25:18 +01:00
Érico Nogueira Rolim
a8f0e489a4
LibCore: Rename identifiers that can clash with libc macros (#4127)
POSIX allows the default streams (stdin, stdout and stderr) to be
macros, which means that on such systems (musl libc is one) building
Lagom will fail due to the File::std*() names.

Also fix any files that use these identifiers.
2020-12-22 23:37:11 +01:00
Lenny Maiorani
765936ebae
Everywhere: Switch from (void) to [[maybe_unused]] (#4473)
Problem:
- `(void)` simply casts the expression to void. This is understood to
  indicate that it is ignored, but this is really a compiler trick to
  get the compiler to not generate a warning.

Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.

Note:
- Functions taking a `(void)` argument list have also been changed to
  `()` because this is not needed and shows up in the same grep
  command.
2020-12-21 00:09:48 +01:00
Andreas Kling
71587ea241 WindowServer: Put tooltip windows above notification windows 2020-12-19 19:23:47 +01:00
Andreas Kling
48d74c5356 LibHTTP: Make HTTPRequest::from_raw_request() take a ReadonlyBytes
This allows us to get rid of some ByteBuffer::wrap() usage.
2020-12-19 18:29:13 +01:00
Tom
07badd9530 WindowServer: Add the ability to animate cursors
This adds the ability to specify cursor attributes as part of their
file names, which allows us to remove hard coded values like the hot
spot from the code. The attributes can be specified between the last
two dots of the file name. Each attribute begins with a character,
followed by one or more digits that specify a uint value.

Supported attributes:
x: The x-coordinate of the cursor hotspot
y: The y-coordinate of the cursor hotspot
f: The number of animated frames horizontally in the image
t: The number of milliseconds per frame

For example, the filename wait.f14t100.png specifies that the image
contains 14 frames that should be cycled through at a rate of 100ms.
The hotspot is not specified, so it defaults to the center.
2020-12-17 19:40:05 +01:00
Brendan Coles
3c9a3a9405 EchoServer: Add a simple echo server 2020-12-16 17:29:12 +01:00
Brendan Coles
3e72fd68b0 TelnetServer: replace getopt with LibCore ArgsParser 2020-12-16 17:26:55 +01:00
Andreas Kling
3c9dcec442 LibWeb: Merge Document::layout() and Document::update_layout()
There is now only Document::update_layout().
2020-12-14 10:39:57 +01:00
Andreas Kling
b9b7b2b28a LibCore: Make IODevice::read_line() return a String
Almost everyone using this API actually wanted String instead of a
ByteBuffer anyway, and there were a bunch of slightly different ways
clients would convert to String.

Let's just cut out all the confusion and make it return String. :^)
2020-12-13 11:54:11 +01:00
Andreas Kling
eda9fb13cc LibWeb+WebContent: Add on_load_finish hook to web views
This isn't entirely symmetrical with on_load_start as it will also fire
on reloads and back/forward navigations. However, it's good enough for
some basic use cases, and we can do more sophisticated notifications
later on when we need them.
2020-12-08 23:36:19 +01:00
Ben Wiederhake
4427da989f WindowServer: Initial wallpaper must not be NULL
This used to crash 'pape -c' on a fresh image. Note that the special value
is '', the empty string, and *not* NULL, i.e. an unset string. An empty
string implies that the wallpaper is not an image, but rather a solid color.
2020-12-08 09:37:30 +01:00
Andreas Kling
17e25890be WindowServer: Don't crash when pressing return after opening menu
There isn't always a hovered item, so let's not assume things.
2020-12-07 19:40:12 +01:00
Andreas Kling
484134d818 LookupServer: Put debug spam behind a macro 2020-12-06 01:16:39 +01:00
Julian Offenhäuser
503aebaefc WindowServer: Allow for more flexible tiling
The desktop can now be split up into halves (both vertical and
horizontal) and quarters by dragging a window into the corresponding
edge or corner.

This makes tiling behave more like you would expect from similiar
window managers.
2020-12-06 00:19:04 +01:00
Julian Offenhäuser
980acd0db7 AudioServer: Fix issue when adding a BufferQueue to Mixer
Previously, the Mixer class would only check for an added BufferQueue
if the list of active queues was empty. If more than one client
connected to AudioServer, its queue would never be added to the list of
active queues.

This fix adds a flag that, when set, will cause the sound thread to wait
for a new BufferQueue.
2020-12-05 10:10:27 +01:00
Andreas Kling
15e35b0d71 LibWeb: Layout viewport rect was lagging behind when resizing
Layout was using an outdated viewport rect that we set *after* doing
a layout due to resize. That meant that layout-in-response-to-resize
was always lagging behind the current size of the view.

The root of this problem was how Frame kept both a viewport rect
(with both scroll offset and size) and a frame size. To fix this,
only store the viewport scroll offset, and always use the frame size.
This way they can't get out of sync and the problem goes away. :^)

Fixes #4250.
2020-12-02 23:50:19 +01:00
Tom
f68115aba3 Taskbar: Wait on all waitable children in SIGCHLD handler
We need to call waitpid until no more waitable children are available.
This is necessary because SIGCHLD signals may coalesce into one when
multiple children terminate almost simultaneously.

Also, switch to EventLoop's asynchronous signal handling mechanism,
which allows more complex operations in the signal handler.
2020-12-02 12:57:25 +01:00
Tom
d6174f9c79 SystemServer: Wait on all waitable children in SIGCHLD handler
We need to call waitpid until no more waitable children are available.
This is necessary because SIGCHLD signals may coalesce into one when
multiple children terminate almost simultaneously.

This fixes random zombie processes sticking around after e.g. closing
Browser.

Also, switch to EventLoop's asynchronous signal handling mechanism,
which allows more complex operations in the signal handler.
2020-12-02 12:57:15 +01:00
Brendan Coles
b9bbf377d6 AudioServer: Mixer: limit max volume to 100 2020-11-29 10:15:36 +01:00
Andreas Kling
5aeab9878e LibWeb: Rename LayoutNode classes and move them into Layout namespace
Bring the names of various boxes closer to spec language. This should
hopefully make things easier to understand and hack on. :^)

Some notable changes:

- LayoutNode -> Layout::Node
- LayoutBox -> Layout::Box
- LayoutBlock -> Layout::BlockBox
- LayoutReplaced -> Layout::ReplacedBox
- LayoutDocument -> Layout::InitialContainingBlockBox
- LayoutText -> Layout::TextNode
- LayoutInline -> Layout::InlineNode

Note that this is not strictly a "box tree" as we also hang inline/text
nodes in the same tree, and they don't generate boxes. (Instead, they
contribute line box fragments to their containing block!)
2020-11-22 15:56:27 +01:00
Andreas Kling
adabcf24ec Everywhere: Add missing <AK/ByteBuffer.h> includes
All of these files were getting ByteBuffer.h from someone else and then
using it. Let's include it explicitly.
2020-11-15 13:11:21 +01:00
Andreas Kling
ebaf20547c WindowServer: Show modal window's cursor over blocked windows
When a window is blocked by a modal window from the same application,
we now prefer the modal window's cursor instead of the hovered window.
2020-11-10 19:30:22 +01:00
Tom
75f61fe3d9 AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe
This makes most operations thread safe, especially so that they
can safely be used in the Kernel. This includes obtaining a strong
reference from a weak reference, which now requires an explicit
call to WeakPtr::strong_ref(). Another major change is that
Weakable::make_weak_ref() may require the explicit target type.
Previously we used reinterpret_cast in WeakPtr, assuming that it
can be properly converted. But WeakPtr does not necessarily have
the knowledge to be able to do this. Instead, we now ask the class
itself to deliver a WeakPtr to the type that we want.

Also, WeakLink is no longer specific to a target type. The reason
for this is that we want to be able to safely convert e.g. WeakPtr<T>
to WeakPtr<U>, and before this we just reinterpret_cast the internal
WeakLink<T> to WeakLink<U>, which is a bold assumption that it would
actually produce the correct code. Instead, WeakLink now operates
on just a raw pointer and we only make those constructors/operators
available if we can verify that it can be safely cast.

In order to guarantee thread safety, we now use the least significant
bit in the pointer for locking purposes. This also means that only
properly aligned pointers can be used.
2020-11-10 19:11:52 +01:00
AnotherTest
6d1e47e7dd LibGUI+WindowServer: Make DragOperation hold a MimeData instance
...instead of maybe bitmap + a single mime type and its corresponding data.
This allows drag&drop operations to hold multiple different kinds of
data, and the views/applications to choose between those.
For instance, Spreadsheet can keep the structure of the dragged cells,
and still provide text-only data to be passed to different unrelated editors.
2020-11-08 21:46:13 +01:00
Brendan Coles
fb5ea8a212 WindowServer+LibGfx: Add Gfx::StandardCursor::Hidden cursor 2020-11-02 20:58:07 +01:00
Brendan Coles
328915a279 ChessEngine: Use pledge and unveil 2020-11-02 13:16:09 +01:00
AnotherTest
812e3ecedd LibProtocol+LibGemini+LibHTTP: Provide root certificates to LibTLS
Now we (almost) verify all the sites we browse.
Certificate verification failures should not be unexpected, as the
existing CA certificates are likely not complete.
2020-10-30 23:42:03 +01:00
AnotherTest
a461526b07 LibHTTP+ProtocolServer+LibGemini: Remove Request::schedule()
This API is only used for HttpRequest, but replicated in GeminiRequest
without an actual user, so remove it and construct the job like the rest
of the protocols.
2020-10-30 23:42:03 +01:00
Uma Sankar Yedida
9ccae7a908 WindowServer+LibGfx: Added Crosshair cursor 2020-10-30 19:10:15 +01:00
Andreas Kling
3ec19ae4b6 LibGUI+LibGfx+WindowServer: Auto-generate disabled action icons :^)
This patch adds a simple filter that makes button and menu item icons
have that "'90s disabled" look when disabled. It's pretty awesome.
2020-10-27 21:25:40 +01:00
Andreas Kling
ce4ee1df1b WindowServer: Improve look of drag&drop items somewhat
This just adds a bit of padding around items. There's lots of room for
improvement here.
2020-10-27 20:45:38 +01:00
Linus Groh
7eee39b850 LookupServer: Support multiple nameservers
The configuration key [DNS] Nameserver has been renamed to Nameservers
and accepts a comma-separated list of nameserver addresses, which will
be queried in the given order until a response has been received.

The new default value is still Cloudflare's 1.1.1.1 as well as their
secondary DNS server 1.0.0.1.
2020-10-25 18:52:20 +01:00
Linus Groh
2440112d53 LookupServer: Replace unused 'did_timeout' with 'did_get_response'
did_timeout is a bool& parameter of lookup() that used to be set when
the UDP connection timed out, but this behaviour was broken in e335d73.
I replaced it with a more useful 'did_get_response' parameter that is
being set after the UDP socket connected, sent its request and got a
response - it might still be bogus data but we know the communication
was successful.
2020-10-25 18:52:20 +01:00
Linus Groh
75864b5a85 LookupServer: Replace dbg()/dbgprintf() with dbgln() 2020-10-25 18:52:20 +01:00
Andreas Kling
cfe1c132cb WindowServer: Raise menu item icons slightly when hovered :^)
Same effect as LibGUI toolbar buttons.
2020-10-25 15:32:19 +01:00
Andreas Kling
3ba6dceee3 Taskbar: Make quicklaunch buttons larger and reduce spacing
The end result is almost identical, but now it's a little easier to
hit the buttons with the cursor. :^)
2020-10-25 15:32:19 +01:00
Andreas Kling
20ca3d4a99 LibGfx+WindowServer: Handle taller window title fonts better
If the window title font is taller than the theme's specified title
height, compute the title height based on the font instead. :^)
2020-10-24 00:26:13 +02:00