Commit graph

291 commits

Author SHA1 Message Date
AnotherTest
887a62582d ProtocolServer: Use an empty Optional<IPC::File> to pass along "no fd"
Passing `-1` wouldn't work, as these are passed to `sendfd()'.
Fixes #4706.
2021-01-01 14:26:43 +01:00
Andreas Kling
af7800d947 WindowServer: Flash modal window when clicking on window blocked by it
This makes window modality a bit more discoverable by indicating to the
user that the modal window must be closed before mouse interaction is
possible in the clicked window.
2021-01-01 01:10:53 +01:00
Andrew Kaster
2b3993b008 LibThread: Hide Thread's constructor, as it is a Core::Object
Just constructing one of these guys on the stack willy nilly will leak
the first reference to them. There might be other C_OBJECTs that have
public constructors, seems like a good place for some static analysis
checks :).

Force users to call the construct() method for it.
2020-12-31 21:59:20 +01:00
Linus Groh
bbe787a0af Everywhere: Re-format with clang-format-11
Compared to version 10 this fixes a bunch of formatting issues, mostly
around structs/classes with attributes like [[gnu::packed]], and
incorrect insertion of spaces in parameter types ("T &"/"T &&").
I also removed a bunch of // clang-format off/on and FIXME comments that
are no longer relevant - on the other hand it tried to destroy a couple of
neatly formatted comments, so I had to add some as well.
2020-12-31 21:51:00 +01:00
AnotherTest
2568a93b5d ProtocolServer: Avoid blocking all downloads when client stops reading
Fixes #4668.
2020-12-31 16:57:09 +01:00
Linus Groh
c0356fc183 WindowServer: Send WindowDeactivated event to windows blocked by modal
When a new modal window is created, we still want to forward the
WindowDeactivated event to its parent window, despite it being blocked
by the newly created modal (which causes WindowServer's Window::event()
to ignore all incoming events from WindowManager for that window).

This fixes the "terminal doesn't stop blinking when blocked by modal
window" bug.
2020-12-31 14:31:05 +01:00
Stephan Unverwerth
b4d1390714 LibGFX: Move default_xxx_font() methods from Font to FontDatabase
When we have an abstract font class it makes no sense to keep
these methods in the Font class.
2020-12-30 20:40:30 +01:00
AnotherTest
6422a04cda AK+ProtocolServer: Properly close download stream fd's
This makes the issue of running out of openable pipes in the
ProtocolServer process much less likely (but still possible).
2020-12-30 20:37:41 +01:00
Andreas Kling
9f5eb49407 WebContent: Pledge "recvfd" :^)
This is needed so we can receive file descriptors from ProtocolServer.

Fixes #4660.
2020-12-30 15:21:29 +01:00
AnotherTest
4a2da10e38 ProtocolServer: Stream the downloaded data if possible
This patchset makes ProtocolServer stream the downloads to its client
(LibProtocol), and as such changes the download API; a possible
download lifecycle could be as such:
notation = client->server:'>', server->client:'<', pipe activity:'*'
```
> StartDownload(GET, url, headers, {})
< Response(0, fd 8)
* {data, 1024b}
< HeadersBecameAvailable(0, response_headers, 200)
< DownloadProgress(0, 4K, 1024)
* {data, 1024b}
* {data, 1024b}
< DownloadProgress(0, 4K, 2048)
* {data, 1024b}
< DownloadProgress(0, 4K, 1024)
< DownloadFinished(0, true, 4K)
```

Since managing the received file descriptor is a pain, LibProtocol
implements `Download::stream_into(OutputStream)`, which can be used to
stream the download into any given output stream (be it a file, or
memory, or writing stuff with a delay, etc.).
Also, as some of the users of this API require all the downloaded data
upfront, LibProtocol also implements `set_should_buffer_all_input()`,
which causes the download instance to buffer all the data until the
download is complete, and to call the `on_buffered_download_finish`
hook.
2020-12-30 13:31:55 +01:00
Idan Horowitz
8159ce384d WindowServer: Added IPC requests for getting and setting mouse settings
These include the mouse acceleration factor and the scroll length
step size.
2020-12-30 11:58:52 +01:00
Idan Horowitz
db409db4e9 WindowServer: Added configurable mouse acceleration and scroll length
The settings are also saved to the config file to survive reboots.
2020-12-30 11:58:52 +01:00
Andreas Kling
7c0e43eb3d CrashDaemon: Move from Applications to Services 2020-12-30 03:20:06 +01:00
Andreas Kling
7dc5a3ead8 LibGUI: Rewrite layout system in terms of min and max sizes
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.

Box layout now works in 3 passes:

    1) Set all items (widgets/spacers) to their min-size
    2) Distribute remaining space evenly, respecting max-size
    3) Place widgets one after the other, adding spacing in between

I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)

This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
2020-12-30 01:36:41 +01:00
Andreas Kling
c9331a96d6 Taskbar: Set min/max size for taskbar buttons
This makes them shrink when the taskbar fills with too many buttons.
It doesn't scale to infinity open windows, but it's better than them
escaping off screen after 6 open windows. :^)
2020-12-30 01:28:28 +01:00
Andreas Kling
3717e5dbae WindowServer: Add a GetGlobalCursorPosition IPC request
This tells you where the mouse cursor is in screen coordinates.
2020-12-28 21:28:40 +01:00
Andreas Kling
a94d1626b5 WindowServer: Remove unnecessary clang-format disabler comment 2020-12-28 11:41:09 +01:00
Andreas Kling
bc67b04399 WindowServer: Don't lookup configuration values in compose()
The compose() function is supposed to be fast since it can execute
60 times per second. Let's not do obviously avoidable things like
configuration value lookups in there. :^)
2020-12-28 11:41:09 +01:00
Andreas Kling
ffa241250b LibGUI: Make GUI::FileIconProvider::icon_for_executable() a public API
This way we can use it instead of icon_for_path() in a bunch of places
and avoid loading the full FileIconProvider configuration.
2020-12-28 11:41:09 +01:00
Idan Horowitz
6efdabfc6f Base: Rename maximize/minimize icons to a more generic name
This reduces naming confusion when the icons are used for other
use cases that require a triangle shape
2020-12-28 11:40:35 +01:00
Andreas Kling
71e9d06bb2 WindowServer: Spruce up the move/resize geometry label a little bit
Draw it in a threed style with a little shadow under it.
2020-12-28 01:40:09 +01:00
Linus Groh
58890e03b6 Everywhere: Move AppFile from LibGUI to LibDesktop
This was mentioned in #4574, and the more I think about it the more it
feels just right - let's move it there! :^)
Having to link LaunchServer against LibGUI explicitly should've been
telling enough...
2020-12-28 01:28:07 +01:00
Brendan Coles
df6106854e Services: Fix typos 2020-12-28 00:55:45 +01:00
Liav A
247517cd4a Kernel: Introduce the DevFS
The DevFS along with DevPtsFS give a complete solution for populating
device nodes in /dev. The main purpose of DevFS is to eliminate the
need of device nodes generation when building the system.

Later on, DevFS will assist with exposing disk partition nodes.
2020-12-27 23:07:44 +01:00
Nathan Lanza
d1891f67ac
AK: Use direct-list-initialization for Vector::empend() (#4564)
clang trunk with -std=c++20 doesn't seem to properly look for an
aggregate initializer here when the type being constructed is a simple
aggregate (e.g. `struct Thing { int a; int b; };`). This template fails
to compile in a usage added 12/16/2020 in `AK/Trie.h`.

Both forms of initialization are supposed to call the
aggregate-initializers but direct-list-initialization delegating to
aggregate initializers is a new addition in c++20 that might not be
implemented yet.
2020-12-27 23:06:37 +01:00
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