Commit graph

1331 commits

Author SHA1 Message Date
Lucas CHOLLET
23fa6b1f7b SystemServer: Add Service::try_create to propagate errors
This static method is used to propagate errors at the creation of the
object.
2022-06-09 22:08:04 +02:00
Lucas CHOLLET
dd3b65c762 SystemServer: Propagate more errors
New propagated errors comes from an endgrent call, and all chown+chmod
calls all over the file. For the two last functions, custom C++ wrappers
were used.
Those wrappers were discarding `ENOENT` errors and naively crashing on
other errors, this change introduced in 76e12a48 was used to prevent a
crash if a mouse wasn't detected. There are no reasons to discard and to
not propagate other errors.
2022-06-09 22:08:04 +02:00
Liav A
f62cd52d12 WindowServer: Drop support for the DisplayConnector write interface
All DisplayConnectors should support the mmap interface and it should
provide better performance now, so let's just use it and drop support
for the DisplayConnector's write interface from the WindowServer side.
2022-06-06 20:11:05 +01:00
MacDue
5fc13e1d53 WindowServer: Add IPC calls for changing the cursor highlighting 2022-06-05 22:42:35 +01:00
MacDue
29d8ec1b18 WindowServer: Implement cursor highlighting
This allows drawing a nice cursor highlight with an arbitrary color
and radius in the compositor. The highlight circle is, of course,
antialiased :^).
2022-06-05 22:42:35 +01:00
MacDue
2a49b58269 WindowServer: Factor out config sync check to sync_config_to_disk() 2022-06-05 22:42:35 +01:00
MacDue
fddff5f4f6 LibCore: Remove ConfigFile::write_color_entry()
This method is currently unused and adds an unwanted dependency on
LibGfx.

This also adds some missing `LibGfx/Color.h` includes.
2022-06-05 22:42:35 +01:00
Lorenzo Concas
a67a7229f8 WindowServer: Check that a menu is not null
If an application menu is null, WindowServer crashes
2022-06-03 12:30:32 +01:00
MacDue
5e5a055455 Services: Use Core::Process::spawn() for common process spawn pattern 2022-06-03 12:29:56 +01:00
Karol Kosek
c317275425 Taskbar: Use default buttons in ShutdownDialog 2022-06-02 22:33:00 +02:00
Olivier De Cannière
5a3321b899 Taskbar+Desktop: Add super+D keyboard shortcut
This shortcut has the same effect as pressing the "Show Desktop" button
in the taskbar. This shortcut already exists in Windows.
2022-06-01 19:31:34 +02:00
Olivier De Cannière
12682f0bcc Taskbar: Add toggle_show_desktop()
This function is added to separate the desktop toggling functionality
from the "Show Desktop" button in the taskbar and to enable calling this
behaviour via a keyboard shortcut in a later commit.
2022-06-01 19:31:34 +02:00
Olivier De Cannière
6c202ee4a9 LibGUI: Fix typo in ConnectionToWindowManagerServer 2022-06-01 19:31:34 +02:00
networkException
524f4be5af LibGUI+WindowServer: Propagate action icon changes to buttons and menus
Previously when setting an action's icon we would only change the bitmap
stored by the action. This patch adds logic to propagate that change to
toolbar buttons as well as window menus.

This fixes an issue in SoundPlayer that would cause the play button not
to reflect the play state.
2022-06-01 12:33:06 +01:00
Tim Schumacher
808855d763 DHCPClient: Don't reset the interface if its already configured
Resetting the interface just based on the fact that it already has an IP
assigned doesn't make much sense, considering that we frequently end up
here after having configured an interface via DHCP already.

Instead, just keep the part that prevents us from sending DHCP
discoveries to interfaces that shouldn't be using DHCP.

While we are at it, place some of the logging behind a debug flag, as
this function is apparently meant to be run frequently.

This partially reverts commit e14d4482a1.
2022-05-31 13:21:19 +04:30
montiagne
9e694c9d83 WindowServer: Call screen_resolution_changed after window screens clear
When the user executes chres to change to a new resolution, the
WindowManager removes for each window its intersections with the
screens (window.screens()) and recalculates its rect. Finally, a
Window::set_rect call sets the window's new rectangle. The set_rect
call also triggers a call to Compositor::invalidate_occlusions which
fills for each window the intersections with the screens again in
window.screens().
In case chres switches to an already present resolution the set_rect
call exits prematurely as it checks if the window's rect really
changed. This means that nobody calls invalidate_occlusions
resulting in a rendering issue for each window.

Moving the call to Compositor::screen_resolution_changed after the
clearing of window.screens() and recalc of the window rect for each
window resolves the rendering issue as screen_resolution_changed
calls invalidate_occlusions.
2022-05-29 00:26:20 +01:00
Rafał Babiarz
b162b7eec6 Browser+LibWeb+WebContent: Add ability to inspect session storage 2022-05-28 23:54:06 +01:00
Maciej
1ffba0b8b4 NetworkServer: Support setting default gateway
This commit adds an IPv4Gateway to Network.ini. If that option is set to
value other than 0.0.0.0, the NetworkServer adds a default route (e.g.
with address 0.0.0.0/0) with the specified destination.
2022-05-28 23:33:46 +01:00
Karol Kosek
a41dfc416f WebContent: Depend on ImageDecoder, RequestServer and WebSocket 2022-05-26 21:54:58 +01:00
Maciej
ddd4547e13 NetworkServer: Add a new NetworkServer service
This service is responsible for loading network configuration from a
/etc/Network.ini config file. It sets up static IP address + mask or
starts DHCPClient depending on configuration.
2022-05-26 21:47:27 +01:00
Maciej
e14d4482a1 DHCPClient: Don't discover interfaces other than given by default
Now, the caller needs to give interface names in command-line arguments.
The DHCPClient will perform DHCP discovery only on these adapters. The
service now immediately closes when no interfaces were given.

We don't check if interface has already IP address assigned; we just
reset it to zero so that DHCP resolution will not fail.
2022-05-26 21:47:27 +01:00
Liav A
102ac09ad7 WindowServer: Stop spurious debug spam after flushing the framebuffer
This became apparent when using the VirtIO graphics device, because the
HardwareScreenBackend object needs to allow flushing of the framebuffer
constantly, and due to incorrect if-else flow, even a non-error response
from the ioctl was leading to a debug spam.
2022-05-25 23:33:31 +01:00
MacDue
7c8541b914 Userland: Use GUI::Process::spawn_or_show_error() for spawn() from a GUI 2022-05-25 23:14:22 +01:00
MacDue
3fc0350caf LibCore: Return ErrorOr<pid_t> and support arguments in Process::spawn
This makes the wrapper more like the rest in LibCore, and also
removes the annoying limitation of not supporting arguments.

There are three overloads one for String, char const *, and StringView
argument lists. As long as there are <= 10 arguments the argv list
will be allocated inline, otherwise on the heap.
2022-05-25 23:14:22 +01:00
Karol Kosek
f9940390a3 SystemServer: Create a /dev/full device using numbers 1, 7
Previously, the device wasn't being created.

The new numbers correspond to those in the FullDevice (which is also
a Linux's full device number).

Also, I've tweaked the permissions to give everyone read-write access
to it.
2022-05-23 00:12:00 +02:00
MacDue
857a767ab4 WindowServer: Fix crash when hovering over title buttons
This fixes a crash where if you switched to a theme that has hover
icons for title buttons, then back to a theme that does not. Then
when you next hover over the title buttons the window server would
crash.

This was due to the hover_bitmap multi-scale bitmap pointer being
non-null, but not containing any bitmaps, so hitting an assertion
when painting.
2022-05-18 19:05:18 +02:00
DexesTTP
c00ae53b66 LibWeb: Abstract the LibProtocol ResourceLoader connection
This is the final component that required LibProtocol as a dependency
of LibWeb. With this, we can now remove the dependency, and LibWeb no
longer requires IPC to work :^)
2022-05-15 12:17:36 +02:00
DexesTTP
2a359695c6 LibWeb: Abstract the LibProtocol WebSockets connection
Much like the ImageDecoder change, this moves the underlying connection
of the Web::WebSockets class from LibWeb to LibWebView, removing the
need for LibProtocol in LibWeb for this specific use-case.
2022-05-15 12:17:36 +02:00
DexesTTP
2198091bbc LibWeb: Abstract the image decoding via Web::ImageDecoding::Decoder
After this change, LibWeb now expects Web::ImageDecoding::Decoder to be
pre-initialized with a concrete implementation before using the webpage.
The previous implementation, based on the ImageDecoder service, has been
provided directly through an adapter in LibWebClient, and is now used as
the default value by WebContent.
2022-05-15 12:17:36 +02:00
DexesTTP
dcbbbf5b4a LibWebView: Move OutOfProcessWebView to a new LibWebView library
Also moves WebContentClient and the references to the generated IPC
descriptions, since they are all components of OutOfProcessWebView.

This patch has no functional changes.
2022-05-15 12:17:36 +02:00
Sam Atkins
cdffe556c8 LibGUI+Userland: Make Dialog::ExecResult an enum class 2022-05-13 16:27:43 +02:00
Daniel Bertalan
014b9fd709 AK+DHCPClient: Fix false positive gcc 12 warnings
The compiler would complain about `__builtin_memcpy` in ByteBuffer::copy
writing out of bounds, as it isn't able to deduce the invariant that the
inline buffer is only used when the requested size is smaller than the
inline capacity.

The other change is more bizarre. If the destructor's declaration
exists, gcc complains about a `delete` operation causing an
out-of-bounds array access.

error: array subscript 'DHCPv4Client::__as_base [0]' is partly outside
array bounds of 'unsigned char [8]' [-Werror=array-bounds]
   14 |   ~DHCPv4Client() = default;
      |   ^

This looks like a compiler bug, and I'll report it if I find a suitable
reduced reproducer.
2022-05-12 13:12:37 +02:00
Sam Atkins
6ba03dec35 WindowServer: Save config file when mouse cursor theme is changed
When user code requests the current cursor theme name with
`GUI::ConnectionToWindowServer::the().get_cursor_theme()`, that reads
the name from the config file. If we don't write that out when it's
changed, then users get given an outdated cursor theme instead of the
current one.

In particular, changing the theme in MouseSettings, saving and closing
it, then reopening MouseSettings, would show the wrong theme selected.
So, that's fixed now. :^)
2022-05-12 13:10:49 +02:00
kleines Filmröllchen
bc2f738a84 WindowServer: Make window frame flashing use the highlight color
Now, when windows flash, the "active" color of the window title frame's
flash is the highlight color instead of the standard window color. The
"inactive" color of the flash is still the disabled color as before.

Reasoning behind this change in aesthetics: There are four [1] window
title frame colors with specific UI purposes:
1. "Active" for the normal active window, obvious purpose.
2. "Moving" for the window that is being dragged or resized by the user.
   Responsible for acting as a visual click feedback as a kind of
   subdued button.
3. "Inactive" for any inactive windows, obvious purpose.
4. "Highlight".

The purpose of "Highlight" is in the name, though it's non-obvious what
that exactly entails. Before, only alt-tab selecting windows would use
the highlight color for showing the current target window. In my opinion
this points to the purpose of "highlight" being to move the user's focus
to another window when the simple active state is not enough. Then it
makes sense to have the window flashing use the highlight color. The
entire purpose of window flashing is to shift the user's focus to a
dialog window that might not be close to the window they just clicked.
Using the highlight color enables an even stronger emphasis than before.
It enables a cleaner separation between the purpose of the two frame
colors, as well as making the "Highlight" frame more common.

[1] Technically there are eight, as the title frame has a gradient by
default. We can count the gradient as one color for this purpose.
2022-05-11 21:00:39 +02:00
offtkp
70e2b42b9d WindowServer: Consider screen scaling when getting color under cursor
Multiply the cursor position by the current scaling mode multiplier when
getting the color under the cursor. Also multiply the screen rectangle
before checking if the cursor is within bounds.

Color picker would not account for scaling when getting the color under
the cursor.

Fixes #13906.
2022-05-08 16:36:24 +02:00
Luke Wilde
05748ed607 LibJS: Convert Console to use MarkedVector<Value>
Using a Vector<Value> is unsafe as GC cannot see the stored values.
This is then vended to outside users of ConsoleClient, e.g. LibWeb and
WebContent, which is then outside of LibJS's control.

An example issue is if the client stores it for later use and forgets
to visit the stored values, meaning they can be destroyed at any time.
We can save the client from this by vending a MarkedVector<Value> to
them.
2022-05-07 01:22:09 +02:00
Liav A
b69c8b48fc WindowServer: Separate physical resolution from scaling factors
Physical hardware doesn't care about scale factors as this is a concept
being related to WindowServer and userland applications. To ensure we
provide the correct display resolution details to HardwareScreenBackend
objects, we must keep a separate Gfx::IntRect object that reserve the
correct details.
2022-05-06 23:38:08 +02:00
Liav A
659b0d7fb4 WindowServer: Remove hack to restore graphics after switch from console
This hack is not necessary anymore, because WindowServer will try
constantly to write the framebuffer contents to the display connector
devices. After a switch from console mode to graphical mode, the write
syscall on these devices will not be silently ignored but will actually
write to the framebuffer screen.
2022-05-06 18:05:14 +02:00
Liav A
fb7d9186b2 SystemServer: Boot to text mode if there are no device nodes at /dev/gpu
Otherwise, WindowServer will simply crash and fail due to no hardware to
utilize.
2022-05-06 12:28:19 +02:00
Liav A
7ab51b6df2 SystemServer: Remove search of a FramebufferDevice
As the framebuffer devices are gone by now, searching for them makes no
sense, so instead, let's remove this check now. If the user requested to
boot into text mode, he probably knows what he is doing and we should
not try to warn him about this.
2022-05-06 12:28:19 +02:00
Linus Groh
e5196c8e3d WindowServer: Take vertical menu offset into account when adjusting pos
Unconditionally adding the item height offset to the adjusted vertical
position of a menu leads to an incorrect position if we previously
clamped the translation offset so the menu doesn't go off-screen.

Also add some comments to this coordinate math. Always add comments to
coordinate math.
2022-05-05 21:54:53 +02:00
Liav A
e301af8352 Everywhere: Purge all support and usage of framebuffer devices
Long live the DisplayConnector object!
2022-05-05 20:55:57 +02:00
Liav A
aad968cc5e Everywhere: Rename fb prefix function names => graphics_connector 2022-05-05 20:55:57 +02:00
Liav A
10adc27eda Everywhere: Rename FB prefix structure names => Graphics 2022-05-05 20:55:57 +02:00
Liav A
4ff6150f1b WindowServer: Use FB_IOCTL_FLUSH_HEAD to flush a framebuffer if possible
This ioctl is more appropriate when the hardware supports flushing of
the entire framebuffer, so we use that instead of the previous default
FB_IOCTL_FLUSH_HEAD_BUFFERS ioctl.
2022-05-05 20:55:57 +02:00
Liav A
6d7e2596e0 WindowServer: Implement mechanism to restore safe mode setting
Such mechanism will be used by the Intel Graphics driver, because we
lack support of changing the resolution on this driver currently, so,
when WindowServer will try to mode-set the display then it will fail,
and will use the safe mode-setting call instead to be able to show
something on screen.
2022-05-05 20:55:57 +02:00
Liav A
d9a2706079 DisplaySettings+WindowServer: Add support for display connector devices 2022-05-05 20:55:57 +02:00
Liav A
b401f278ad Userland: Re-organize /dev GPU nodes 2022-05-05 20:55:57 +02:00
kleines Filmröllchen
ab49fcfb7c LibAudio+Userland: Remove Audio::LegacyBuffer
The file is now renamed to Queue.h, and the Resampler APIs with
LegacyBuffer are also removed. These changes look large because nobody
actually needs Buffer.h (or Queue.h). It was mostly transitive
dependencies on the massive list of includes in that header, which are
now almost all gone. Instead, we include common things like Sample.h
directly, which should give faster compile times as very few files
actually need Queue.h.
2022-05-03 23:09:20 +02:00
MacDue
44c0672d59 WindowServer: Support hover icons for title buttons
This allows adding "-hover.png" variants of the title button icons.
This can be useful for themes which use the TitleButtonsIconOnly
flag, which otherwise don't have a way of showing the hover state.
2022-05-03 22:00:14 +02:00
Patrick Meyer
5510b98dc8 DHCPClient: Don't crash if DHCP options contain no gateway
Fixes #13879
2022-05-03 12:37:51 +04:30
Peter Elliott
12c7b954e1 Kernel+WindowServer: Move setting tty graphical mode to Userspace
This will allow using the console tty and WindowServer regardless of
your kernel command line. Also this fixes a bug where, when booting in
text mode, the console was in graphical mode, and would not accept
input.
2022-04-29 19:52:32 +02:00
Peter Elliott
287c6228b5 LoginServer: Change login fail message to avoid enumeration attacks
The current message distinguishes between a user that doesn't exist, and
an invalid password. This is considered to be bad practice, because an
attack can first check if a user exists before guessing that users
password.

Also it's just tradition or something.
2022-04-26 21:57:24 -07:00
Moustafa Raafat
0a3467d665 LibConfig+ConfigServer: Write config values synchronously
This patch fixes the issue of pressing the ok button of a settings menu
without saving the changes, or not reverting the changes when pressing
the cancel button because the app has died before the new values make
it to the other end.
2022-04-26 22:51:49 +02:00
MacDue
9b30fe9864 LibGfx+WindowServer: Add theme flag TitleButtonsIconOnly
With this flag set to true only the icon of the title button is painted.
This is useful for themes with a more non-serenity look such as
Coffee and Cupertino (that currently try to hide the button).
2022-04-25 23:45:24 +02:00
Andrew Kaster
f1d47ea618 LibWeb+AudioServer: Remove unused spaceship operators
We aren't actually using these for anything, and the spaceship operator
requires ``<compare>`` from the STL, which we'd rather not include.
2022-04-23 10:43:32 -07:00
kleines Filmröllchen
612dbdc671 AudioServer: Auto-pause new clients
This fixes a bunch of audio clients that don't actually play audio.
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
49b087f3cd LibAudio+Userland: Use new audio queue in client-server communication
Previously, we were sending Buffers to the server whenever we had new
audio data for it. This meant that for every audio enqueue action, we
needed to create a new shared memory anonymous buffer, send that
buffer's file descriptor over IPC (+recfd on the other side) and then
map the buffer into the audio server's memory to be able to play it.
This was fine for sending large chunks of audio data, like when playing
existing audio files. However, in the future we want to move to
real-time audio in some applications like Piano. This means that the
size of buffers that are sent need to be very small, as just the size of
a buffer itself is part of the audio latency. If we were to try
real-time audio with the existing system, we would run into problems
really quickly. Dealing with a continuous stream of new anonymous files
like the current audio system is rather expensive, as we need Kernel
help in multiple places. Additionally, every enqueue incurs an IPC call,
which are not optimized for >1000 calls/second (which would be needed
for real-time audio with buffer sizes of ~40 samples). So a fundamental
change in how we handle audio sending in userspace is necessary.

This commit moves the audio sending system onto a shared single producer
circular queue (SSPCQ) (introduced with one of the previous commits).
This queue is intended to live in shared memory and be accessed by
multiple processes at the same time. It was specifically written to
support the audio sending case, so e.g. it only supports a single
producer (the audio client). Now, audio sending follows these general
steps:
- The audio client connects to the audio server.
- The audio client creates a SSPCQ in shared memory.
- The audio client sends the SSPCQ's file descriptor to the audio server
  with the set_buffer() IPC call.
- The audio server receives the SSPCQ and maps it.
- The audio client signals start of playback with start_playback().
- At the same time:
  - The audio client writes its audio data into the shared-memory queue.
  - The audio server reads audio data from the shared-memory queue(s).
  Both sides have additional before-queue/after-queue buffers, depending
  on the exact application.
- Pausing playback is just an IPC call, nothing happens to the buffer
  except that the server stops reading from it until playback is
  resumed.
- Muting has nothing to do with whether audio data is read or not.
- When the connection closes, the queues are unmapped on both sides.

This should already improve audio playback performance in a bunch of
places.

Implementation & commit notes:
- Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept
  for WavLoader, see previous commit message.
- Most intra-process audio data passing is done with FixedArray<Sample>
  or Vector<Sample>.
- Improvements to most audio-enqueuing applications. (If necessary I can
  try to extract some of the aplay improvements.)
- New APIs on LibAudio/ClientConnection which allows non-realtime
  applications to enqueue audio in big chunks like before.
- Removal of status APIs from the audio server connection for
  information that can be directly obtained from the shared queue.
- Split the pause playback API into two APIs with more intuitive names.

I know this is a large commit, and you can kinda tell from the commit
message. It's basically impossible to break this up without hacks, so
please forgive me. These are some of the best changes to the audio
subsystem and I hope that that makes up for this :yaktangle: commit.

:yakring:
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
cb0e95c928 LibAudio+Everywhere: Rename Audio::Buffer -> Audio::LegacyBuffer
With the following change in how we send audio, the old Buffer type is
not really needed anymore. However, moving WavLoader to the new system
is a bit more involved and out of the scope of this PR. Therefore, we
need to keep Buffer around, but to make it clear that it's the old
buffer type which will be removed soon, we rename it to LegacyBuffer.
Most of the users will be gone after the next commit anyways.
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
d463f6e00a SystemServer: Boot into graphical mode even if there's no video hardware
SystemServer had safety fallbacks to boot into text mode if the user
errorneously specified graphical mode but no video hardware was present.
As it's now possible to do exactly this intentionally, we should allow
it. This would of course make WindowServer fall over and die if
configured improperly, but if you're messing with the kernel command
line in strange ways, you should be able to fix that.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
935f401714 WindowServer: Create the VirtualScreenBackend
This screen backend is just memory-backed and doesn't connect to any
screen hardware. That way, we can boot Serenity without video hardware
but in full graphical mode :^)

To create a virtual screen, put something like this in your
WindowServer.ini. There's no way yet to do this through Display
Settings, though an existing virtual screen's settings can be changed
there.
```ini
[Screen0]
Mode=Virtual
Left=1024
Top=0
Width=1920
Height=1080
ScaleFactor=1
```
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
be98ce0f9f WindowServer: Add the screen mode property in the screen configuration
This will allow us to change between a couple of properties, for now
it's only Device and Virtual. (How about Remote :^) ) These get handled
by a different screen backend in the Screen.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
e95ae4a143 WindowServer: Make Screen use ScreenBackend
This will allow us to use other screen backends in the future instead.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
0acffa5ef4 WindowServer: Introduce the ScreenBackend concept
The ScreenBackend is a thin wrapper around the actual screen hardware
connection. It contains all the variables specific to that hardware and
abstracts away operations that deal with controlling the hardware. The
standard ScreenBackend implementor is HardwareScreenBackend, which
contains all the existing frame buffer & ioctl handling code of Screen.
I took this opportunity to introduce ErrorOr wherever sensible.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
1fce201d15 WindowServer: Rename fb_data and friends to flush_rect etc
This was very badly named. All that the "FBData" struct contains is the
currently to-be-flushed rectangles plus a fullness flag, so it should
better be called FlushRectData. This rename is similarly applied to all
variable names.
2022-04-21 13:41:55 +02:00
Sam Atkins
73552c1856 Userland: Always construct Application with try_create() 2022-04-18 12:57:34 +02:00
Thitat Auareesuksakul
c949a4db2d DHCPClient: Send ParameterRequestList option with DHCPRequest packet
We'll need SubnetMask and Router options to be returned with the ACK
packet. So, it's a good idea to request them explicitly in this packet.
2022-04-17 10:25:01 +04:30
Thitat Auareesuksakul
01a602cb51 DHCPClient: Send ServerIdentifier option with DHCPRequest packet
Some DHCP servers (including Mikrotik ones) will NAK the request if the
ServerIdentifier option is not sent with the DHCPRequest packet.
2022-04-17 10:25:01 +04:30
Sam Atkins
c4134e9794 LibCore+Everywhere: Make Core::Stream read_until() return Bytes
This affects BufferedSeekable::read_until() and ::read_until_any_of().
For the reasoning, see the previous commit about Core::Stream::read().
2022-04-16 13:27:51 -04:00
Sam Atkins
3b1e063d30 LibCore+Everywhere: Make Core::Stream::read() return Bytes
A mistake I've repeatedly made is along these lines:
```c++
auto nread = TRY(source_file->read(buffer));
TRY(destination_file->write(buffer));
```

It's a little clunky to have to create a Bytes or StringView from the
buffer's data pointer and the nread, and easy to forget and just use
the buffer. So, this patch changes the read() function to return a
Bytes of the data that were just read.

The other read_foo() methods will be modified in the same way in
subsequent commits.

Fixes #13687
2022-04-16 13:27:51 -04:00
Tom
49de4d5f33 LibDNS: Remove the 'DNS' prefix from the various type and class names
Since all types and class names live in the DNS namespace, we don't
need to spell it out twice each time.
2022-04-15 16:34:26 +01:00
Tom
be4a4144f2 LookupServer: Move DNS related code into new LibDNS library
This allows other code to use the DNSPacket class, e.g. when sent
over IPC.
2022-04-15 16:34:26 +01:00
Aatos Majava
85da8cbb07 TelnetServer: Ignore null and \n when parsing
This fixes issues with carriage return sequences.

Before, using <CR><NUL> as the return sequence wouldn't work at all,
and when using <CR><LF> there was an extra newline after every newline.

After this patch, the behaviour should be closer to the Telnet RFC.
2022-04-14 16:12:16 +02:00
Tim Schumacher
1bdaee475b DHCPClient: Close outgoing sockets after use 2022-04-11 00:15:06 +02:00
kleines Filmröllchen
5319e3a03f LibCore+Userland: Remove File::ensure_parent_directories
We have a much safer and more powerful alternative now, so let's move
the few users over.
2022-04-11 00:08:48 +02:00
kleines Filmröllchen
0fd09b2381 LibCore: Automatically create config directories if necessary
If the .config directory (or its children, like lib) was deleted,
ConfigFile would crash because it would try to open or create a file in
a directory that didn't exist. Therefore, for user and library configs
(but not system configs), ensure that the parent directories exist. This
allows the user to delete the entire .config folder and all apps still
work. (Except those which can't handle missing config. That's a separate
issue though.)

Fixes #13555

Note: Some changes to pledges and unveils are necessary for this to
work. The only one who can recreate .config at the moment is
ConfigServer, as others probably don't pledge the user home directory.
2022-04-11 00:08:48 +02:00
Simon Wanner
206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Ali Mohammad Pur
a42e03b01a Browser+LibWeb+WebContent: Implement per-URL-pattern proxies
...at least for SOCKS5.
2022-04-09 12:21:43 +02:00
Ali Mohammad Pur
45867435c4 RequestServer+LibProtocol: Allow users to specify a per-request proxy 2022-04-09 12:21:43 +02:00
Ali Mohammad Pur
cd9d740107 LibCore+RequestServer: Add support for SOCKS5 proxies 2022-04-09 12:21:43 +02:00
Lady Gegga
e34f199997 WebServer: Add utf-8 charset to Content-Type header for text/plain 2022-04-09 01:14:14 +02:00
Andreas Kling
59e8dedea2 LibWeb: Remove the InProcessWebView widget
Let's simplify our offering by only having the OutOfProcessWebView.
2022-04-06 19:35:07 +02:00
sin-ack
359365a06a InspectorServer: Defer removal of InspectableProcess from table
This prevents a crash when the inspected process closes the socket (i.e.
when the app is exited). This crash was caused by the InspectableProcess
removing itself from the global process table within a callback Function
that is stored as part of the InspectableProcess.
2022-04-06 13:04:03 +02:00
Andreas Kling
217993b1d1 Revert "WebContent: Use ConsoleGlobalObject for the console's global object :^)"
This reverts commit 8296dd9955.
2022-04-05 17:47:52 +02:00
Andreas Kling
1a38ab0ca1 WindowServer+LibGUI: Notify windows when their maximized state changes
Previously, GUI::Window::is_maximized() had to make a synchronous IPC
request to WindowServer in order to find out if the window was indeed
maximized.

This patch removes the need for synchronous IPC by instead pushing the
maximization state to clients when it changes.

The motivation for this change was that GUI::Statusbar was checking
if the containing window was maximized in its resize_event(), causing
all windows with a statusbar to block on sync IPC *during* resize.
Browser would typically block for ~15 milliseconds here every time
on my machine, continuously during live resize.
2022-04-05 17:45:07 +02:00
Andreas Kling
463dc91049 WebContent: Cancel pending paint requests when removing a backing store
If there are pending paint requests waiting to be processed when the
client asks us to remove a backing store, we now prune them from the
request queue.

This avoids doing completely wasted painting work while resizing the
browser window. :^)
2022-04-05 17:28:33 +02:00
Sam Atkins
8296dd9955 WebContent: Use ConsoleGlobalObject for the console's global object :^)
Seems like this got missed when ESOs were implemented. Now we can use
`$0` again!
2022-04-05 13:02:12 +01:00
cflip
5bb0b6ba7a ClockSettings+Taskbar: Add settings for taskbar clock format 2022-04-04 13:15:13 +02:00
Brian Gianforcaro
09fe9b546f Services: Use default execpromises parameter to pledge(..) 2022-04-03 17:13:51 -07:00
Valtteri Koskivuori
45a81f5a2c Browser+LibWeb+WebContent: Add ability to inspect local storage
The storage inspector now has a new tab for local storage. The next step
would be to persist local storage and receive real-time notifications
for changes to update the table view.
2022-04-03 13:13:10 +01:00
Ben Maxwell
8070a98288 DisplaySettings+WindowServer: Allow updating theme without background
With this change you can now set the theme and background color at the
same time in the Display Settings. Before if both were changed
before hitting 'apply' the theme background color would overwrite
the custom background.
2022-04-03 12:58:46 +02:00
Ben Maxwell
8fa0409ae1 LibGfx: Add list_installed_system_themes() to SystemTheme 2022-04-02 21:50:41 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Linus Groh
04e40b7aaa Browser+WebContent: Add a Debug menu action to disable scripting :^) 2022-03-31 17:08:38 +02:00
Linus Groh
780e5441b4 WebContent: Add plumbing for 'is scripting enabled' setting 2022-03-31 17:08:38 +02:00
Linus Groh
46ad69cd1e LookupServer: Fix confusing copy/paste error in debug message 2022-03-27 18:39:47 +01:00
Timur Sultanov
46710d9efa LookupServer: Use case-insensitive comparison for domain names
Some ISPs may MITM DNS requests coming from clients, changing the case
of domain name in response. LookupServer will refuse responses from
any DNS server in that case. This commit changes the behaviour to
perform a case-insensitive equality check.
2022-03-27 17:36:13 +02:00
circl
eeeaf410fb WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held
items using the scroll wheel. In order to implement this, they
previously would have to either add a hard-coded division by 4, or look
up your mouse settings to adjust correctly.

This commit adds an MouseEvent.wheel_raw_delta_x() and
MouseEvent.wheel_raw_delta_y().
2022-03-27 01:11:27 +01:00
Andreas Kling
bd44d9d641 LibWeb: Show correct element margin values in Inspector "Box Model" view
We were showing the margin-top value for all 4 margin values.
2022-03-25 11:57:30 +01:00
Lenny Maiorani
0b7baa7e5a Services: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-24 20:09:26 -07:00
Andreas Kling
c2d7ef057d WebContent: Remove accidentally committed unveil() call 2022-03-24 23:17:49 +01:00
Andreas Kling
195ef5e26f LibWeb: Bring CSS line-height implementation closer to spec
We now distribute the line-height evenly between the space above and
below inline-level boxes. This noticeably improves our baseline
alignment in many cases.

Note that the "vertical-align: <length>" case is quite awkward, as the
extra height added by the offset baseline must count towards the line
box height.

There's a lot of room for improvement here, but this makes the buckets
container on Acid3 show up in the right place, with the right size.
2022-03-24 22:52:44 +01:00
Kenneth Myhra
4a57be824c Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to
ErrorOr<String>.

The rest of the change is to support the potential of an Error being
returned and subsequent release of the value when no Error is returned.
Unfortunately at this stage none of the places affected can utililize
our TRY() macro.
2022-03-24 11:57:51 +01:00
Andreas Kling
ca85ac26d4 WebContent: Fill OOPWV with palette base color when there's no content 2022-03-23 17:27:20 +01:00
Liav A
e508073168 SystemServer: Create /dev/tty as a character device instead of a symlink
The new device has major number 5, minor number 0, and is represented by
the SelfTTYDevice class in the Kernel.
2022-03-22 20:26:05 +01:00
sin-ack
e212514bbf LookupServer: Return with failure result when lookup fails
This was missed in 4ca0669d1e and the
error condition would still fall through to an ErrorOr unwrapping which
caused a crash.
2022-03-20 12:09:31 +03:30
Ali Mohammad Pur
dff8344336 RequestServer: Keep the EnsureConnection job alive until it finishes
Fixes #12906.
2022-03-19 22:04:35 +01:00
Maciej
c1ca009939 WebServer: Add Content-Length header to HTTP responses
This makes the browser know how much data it should expect.
2022-03-19 22:03:51 +01:00
Tom
9f59d7d9a0 WindowServer: Fix animation crash
If an Animation's on_stop handler cleared itself inside the on_stop
event handler, it would remove itself from the animation map that was
still being iterated, leading to a crash.

To solve this, we'll iterate over the animations using the
remove_all_matching function, which enables us to delete it by simply
returning true when the animation finished. In the event that the
Animation is kept alive elsewhere and the on_stop event clears its own
reference, we need to temporarily bump the reference count. Another
advantage is that we only need to bump the reference count when an
animation is finished, whereas before this we bumped it
unconditionally.
2022-03-18 20:00:30 +01:00
Lenny Maiorani
f912a48315 Userland: Change static const variables to static constexpr
`static const` variables can be computed and initialized at run-time
during initialization or the first time a function is called. Change
them to `static constexpr` to ensure they are computed at
compile-time.

This allows some removal of `strlen` because the length of the
`StringView` can be used which is pre-computed at compile-time.
2022-03-18 19:58:57 +01:00
Linus Groh
9422ae9bb2 LibJS: Add infallible variant of VM::push_execution_context()
It makes no sense to require passing a global object and doing a stack
space check in some cases where running out of stack is highly unlikely,
we can't recover from errors, and currently ignore the result anyway.

This is most commonly in constructors and when setting things up, rather
than regular function calls.
2022-03-18 01:12:12 +01:00
Andreas Kling
e31fe3eeb8 LibWeb: Rename Element::specified_css_values() => computed_css_values()
Let's make it very clear that these are *computed* values, and not at
all the specified values. The specified values are currently discarded
by the CSS cascade algorithm.
2022-03-15 19:48:19 +01:00
Andreas Kling
43ef813f3d LibWeb: Rename Element::computed_style() to resolved_css_values()
This more accurately reflects what's actually being returned.
2022-03-15 19:48:19 +01:00
kleines Filmröllchen
79deb7d6c7 AudioServer: Decrease sample headroom to 5%
This might still be too much, but it's better than what we had before.
2022-03-14 22:46:46 +01:00
Karol Kosek
a5e149c012 WindowServer: Update menu buttons' rects on font change
Prior to this change, after changing the system font, the menu rects
stayed the same, making the menu bar look a bit cramped on larger fonts.
2022-03-14 22:29:57 +01:00
Karol Kosek
fe47e66438 WindowServer: Use font height for item heights in Menus
The height of menu items was relatively small on larger fonts.
2022-03-14 22:29:57 +01:00
Sam Atkins
7535398dbf FileOperation: Port to Core::Stream 2022-03-13 22:38:48 +01:00
Andreas Kling
5779a910e5 LibWeb: Move hit testing to the painting tree 2022-03-11 00:21:49 +01:00
Andreas Kling
ba606d9057 LibWeb: Move PaintingBox to its own .cpp and .h files 2022-03-11 00:21:49 +01:00
Andreas Kling
9461e44afa LibWeb: Use Layout::Box::paint_box() accessor in more places 2022-03-11 00:21:49 +01:00
Andreas Kling
f6497b64ac LibWeb: Rename Painting::Box => Paintable
Calling this "Box" made it very confusing to look at code that used both
Layout::Box and Painting::Box. Let's try calling it Paintable instead.
2022-03-11 00:21:49 +01:00
Andreas Kling
9f5cbcaad3 LibWeb: Hang StackingContext off of the paint boxes
Stacking contexts have nothing to do with layout and everything with
painting, so let's keep them in Painting::Box.
2022-03-11 00:21:49 +01:00
Andreas Kling
a4d51b3dc2 LibWeb: Add Painting::Box and move things from Layout::Box into it
The "paintable" state in Layout::Box was actually not safe to access
until after layout had been performed.

As a first step towards making this harder to mess up accidentally,
this patch moves painting information from Layout::Box to a new class:
Painting::Box. Every layout can have a corresponding paint box, and
it holds the final used metrics determined by layout.

The paint box is created and populated by FormattingState::commit().

I've also added DOM::Node::paint_box() as a convenient way to access
the paint box (if available) of a given DOM node.

Going forward, I believe this will allow us to better separate data
that belongs to layout vs painting, and also open up opportunities
for naturally invalidating caches in the paint box (since it's
reconstituted by every layout.)
2022-03-11 00:21:49 +01:00
Sam Atkins
10429e1043 WebContent: Return empty JSON object if element has no box model
The blank string "" does not parse as JSON, and so the InspectorWidget
would fail to update the box-model information when inspecting elements
with no box, (for example, `<head>`) showing stale values instead. Now,
they show all 0s.

You could argue that InspectorWidget should be more resilient when given
invalid JSON strings, but making sure we only pass valid ones works
too.
2022-03-10 17:30:09 +01:00
Sam Atkins
b5ea14b884 WebContent: Show box-model metrics for (some) pseudo-elements
This only applies to pseudo-elements which have a Layout::Box, so this
excludes any that are InlineNodes.
2022-03-10 17:30:09 +01:00
Sam Atkins
0326ad34df Browser+LibWeb+WebContent: Show style for pseudo-elements :^)
This expands the InspectorWidget::Selection to include an optional
PseudoElement, which is then passed over IPC to request style
information for it.

As noted, this has some pretty big limitations because pseudo-elements
don't have DOM nodes:
- Declared style has to be recalculated when it's requested.
- We don't display the computed style.
- We don't display custom properties.
2022-03-10 17:30:09 +01:00
Ben Abraham
7594350376 Browser: Show currently loading host and remaining resource count 2022-03-10 00:51:05 +01:00
Sahan Fernando
2939f65753 SystemServer: Create device files for gpus on startup
We are adding a new class of file, a GPU device. These devices have
major number 28, and are bound to files named /dev/gpuN.
2022-03-09 14:58:48 +03:30
javabird25
9246ad96b3 LoginServer: Add a label for login fail messages 2022-03-08 22:12:21 +01:00
Vrins
39a5076f40 Browser+LibWeb: Add an Element size preview widget to inspector
This Adds an element size preview widget to the inspector widget
in a new tab. This functions similar to chrome and firefox and
shows the margin, border, padding, and content size of the selected
element in the inspector.

The colors for the size preview widget are taken from the chrome
browser.
2022-03-08 22:09:52 +01:00
Linus Groh
1422bd45eb LibWeb: Move Window from DOM directory & namespace to HTML
The Window object is part of the HTML spec. :^)
https://html.spec.whatwg.org/multipage/window-object.html
2022-03-08 00:30:30 +01:00
Andreas Kling
5ace66a903 LibGfx: Rename RGBA32 => ARGB32
The ARGB32 typedef is used for 32-bit #AARRGGBB quadruplets. As such,
the name RGBA32 was misleading, so let's call it ARGB32 instead.

Since endianness is a thing, let's not encode any assumptions about byte
order in the name of this type. ARGB32 is basically a "machine word"
of color.
2022-03-04 23:40:21 +01:00
Lenny Maiorani
d5fdc6096c Libraries: Make CharacterBitmap instances at compile-time
`CharacterBitmap` instances are generated at run-time and put on the
heap, but they can be created in a `constexpr` context and stored in
static memory.

Also, remove additional `width` and `height` `static` values in favor
of using the `constexpr` member functions of `CharacterBitmap`.

These changes also include the removal of some initialization code
which tests if the `CharacterBitmap` is created since it is always
created and removes function-local `static` values which cause
run-time branches to ensure it is initialized each time the function
is called.
2022-03-04 17:41:08 +01:00
MacDue
6ff041dcfc WindowServer: Treat window frames with a border radius as transparent
Without this, there are repainting artefacts when the window is moved.
2022-03-02 21:56:57 +01:00
MacDue
c2fcc3a621 WindowServer: Disable shadow rendering for themes with a border-radius
The current shadow renderer only works for purely rectangular windows,
when enabled with border radiuses the corners are wrong.
2022-03-02 21:56:57 +01:00
Lenny Maiorani
f5fd2f3857 Services: Port FileOperation to LibMain 2022-02-28 13:57:26 +01:00
Idan Horowitz
feb00b7105 Everywhere: Make JSON serialization fallible
This allows us to eliminate a major source of infallible allocation in
the Kernel, as well as lay down the groundwork for OOM fallibility in
userland.
2022-02-27 20:37:57 +01:00
Itamar
493f604dba SpiceAgent: Rename ClipboardServerConnection
Rename ClipboardServerConnection=>ConnectionToClipboardServer.

This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar
935d023967 Userland: Rename WindowServerConnection=>ConnectionToWindowServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar
af132fdbd1 Userland: Rename WindowManagerServerConnection
Rename WindowManagerServerConnection=>ConnectionToWindowManagerServer.

This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar
d88da82e28 Userland: Rename IPC::ServerConnection=>IPC::ConnectionToServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar
3a71748e5d Userland: Rename IPC ClientConnection => ConnectionFromClient
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
2022-02-25 22:35:12 +01:00
thankyouverycool
e1a72c6df8 Taskbar: Update ClockWidget FrameShape and adjust dimensions
Uses the new Window FrameShape. Fixes some erroneously elided text
and incorrect calendar window placement.
2022-02-25 19:38:23 +01:00
Jan Grau
9311b685fe Taskbar: Minimize/activate window on Super+Digit event
Handle the SuperDigitKeyPressed event in the taskbar. Toggle the
respective taskbar button.
2022-02-24 18:57:20 +00:00
Jan Grau
6992a07afc LibGUI+WindowServer: Add new WMEvent Super+Digit
This adds a keyboard event for Super+0 to Super+9. Later to be consumed
in the taskbar.

Currently only this keyboard sequence is supported:
  - Super key down
  - Digit key down

But not this:
  - Super key down
  - Digit key down
  - Digit key up
  - Digit key down
2022-02-24 18:57:20 +00:00
Tom
97e18a6ce1 WindowServer: Mark window frame as invalidated when updating title
We need to set Window::m_invalidated_frame to true when invalidating
the title, otherwise we may miss re-rendering the frame if nothing
else triggers it.
2022-02-21 20:34:36 -08:00
Marco Cutecchia
8ede1a6a6f WindowServer: Add IPC call to remove a menu's item 2022-02-21 16:31:56 +01:00
Linus Groh
929074ddea WebContent: Push execution context before ConsoleGlobalObject init
This fixes a crash of the browser when loading any page. LibWeb
immediately pops the 'running execution context' after creating an
interpreter, but it's needed to have a 'current realm' during
initialization of the ConsoleGlobalObject for NativeFunction::create()
to work.
Once this is done, we can immediately pop the execution context again.
2022-02-21 13:51:34 +00:00
Linus Groh
f2ca64cecd WebContent: Remove unused JS Lexer/Parser includes 2022-02-21 13:51:34 +00:00
Ali Mohammad Pur
ce057115fc RequestServer: Bump the ConnectionCache concurrent connection limit to 4
With ECDHE, our TLS handshake performance has increased, so we can
afford to bump this limit to 4, and get some faster loads :^)
2022-02-18 16:12:42 +03:30
Ali Mohammad Pur
0e173da86f WebServer: Close the socket if Connection: keep-alive isn't requested 2022-02-18 13:19:26 +01:00
Sam Atkins
cd0ffe5460 LibCore+Everywhere: Return ErrorOr from ConfigFile::sync()
Currently this method always succeeds, but that won't be true once we
switch to the Core::Stream API. :^)

Some of these places would ideally show an error message to the user,
since failure to save a file is significant, but let's not get
distracted right now.
2022-02-16 19:49:41 -05:00
Sam Atkins
8260135d4d LibCore+Everywhere: Return ErrorOr from ConfigFile factory methods
I've attempted to handle the errors gracefully where it was clear how to
do so, and simple, but a lot of this was just adding
`release_value_but_fixme_should_propagate_errors()` in places.
2022-02-16 19:49:41 -05:00
Andreas Kling
9c78c1bf81 WebContent: Exit peacefully when client dies during synchronous IPC
If we're waiting for the client (typically Browser) to respond to a
synchronous IPC message from our side (e.g window.alert()) and the
client disconnects instead, just exit peacefully.

Ultimately a WebContent process lives to serve its client. When the
client dies, there is no need for WebContent anymore.
2022-02-16 12:03:05 +01:00
Liav A
6c0467f56b SystemServer: Remove now unnecessary call to chmod on /dev/audio
Don't use chmod now that DevTmpFS honors permission mode when creating
new directories.
2022-02-14 08:45:32 -05:00
James Puleo
e4c182d855 WindowServer: Remove extraneous whitespace in WindowServer.ipc 2022-02-14 16:38:42 +03:30
James Puleo
a0e7a4b9a8 WindowServer+Userland: Pass wallpapers as Gfx::Bitmap instead of path
The WindowServer _really_ does not need to know the filesystem path to
it's wallpaper, and allows setting arbitrary wallpapers (those outside
of `/res/wallpapers`).

The GUI::Desktop will keep track of the path to the wallpaper (if any),
and save it to config if desired (to be persisted).

This avoids the need to `unveil` paths to the wallpaper, fixing #11158
2022-02-14 16:38:42 +03:30
sin-ack
72ef1d7c06 SystemServer: Remove Socket.h header + use Core::System in some places
Various Core::System functions are still missing so not all raw syscalls
were converted just yet.
2022-02-14 11:44:09 +01:00
sin-ack
4ca0669d1e LookupServer: Convert to Core::Stream::UDPSocket 2022-02-14 11:44:09 +01:00
Vitaly Dyachkov
53ff271c6f WindowServer: Consolidate tiled and maximized window rects calculation
Calculating tiled and miximized window frame have a lot in common. In
fact, we can look at maximized window state as a special case of the
tile type. It simplifies the code since there is a lot of cases when
we take an action only if the window is maximized or tiled.
2022-02-14 11:41:06 +01:00
Liav A
bf8c93fe0a AudioServer: Use first audio channel in the /dev/audio directory
For now, just use the first audio channel in the /dev/audio directory.
In the future we can add support for watching and loading other channels
so we can route audio to multiple sound cards on the system.
2022-02-14 11:39:19 +01:00
Liav A
a1f3a48ed5 SystemServer: Create audio channel device nodes in /dev/audio directory 2022-02-14 11:39:19 +01:00
Idan Horowitz
c8ab45e79f Userland: Run gml-format
This brings the existing GML files up to spec with the new requirements
2022-02-13 02:36:35 +02:00
Andreas Kling
8b8a1449c4 RequestServer: Make value copy of the URL in ensure_connection()
I saw what looked like a UAF of this URL in a RequestServer crash,
and it seems reasonable to make a copy here since we end up passing
them to Core::deferred_invoke().
2022-02-12 22:30:50 +01:00
Vitaly Dyachkov
32b8795091 LibConfig: Rename pledge_domains(String) => pledge_domain(String)
pledge_domains() that takes only one String argument was specifically
added as a shortcut for pledging a single domain. So, it makes sense to
use singular here.
2022-02-11 18:06:39 +01:00
Idan Horowitz
873f4d5de6 RequestServer: Recreate socket if it reached EOF
This ensures we don't continue using a socket that has EOF'ed (meaning
the protocol has disconnected in the case of TCP) for new requests.
2022-02-11 18:11:32 +02:00
Timothy Flynn
2397836f8e LibSQL+SQLServer: Introduce and use ResultOr<ValueType>
The result of a SQL statement execution is either:
    1. An error.
    2. The list of rows inserted, deleted, selected, etc.

(2) is currently represented by a combination of the Result class and
the ResultSet list it holds. This worked okay, but issues start to
arise when trying to use Result in non-statement contexts (for example,
when introducing Result to SQL expression execution).

What we really need is for Result to be a thin wrapper that represents
both (1) and (2), and to not have any explicit members like a ResultSet.
So this commit removes ResultSet from Result, and introduces ResultOr,
which is just an alias for AK::ErrorOrr. Statement execution now returns
ResultOr<ResultSet> instead of Result. This further opens the door for
expression execution to return ResultOr<Value> in the future.

Lastly, this moves some other context held by Result over to ResultSet.
This includes the row count (which is really just the size of ResultSet)
and the command for which the result is for.
2022-02-10 23:11:13 +01:00
Andreas Kling
8d104b7de2 LibWeb: Perform CSS custom property cascade once instead of per-property
Previously we would re-run the entire CSS selector machinery for each
property resolved. Instead of doing that, we now resolve a final set of
custom property key/value pairs at the start of the cascade.
2022-02-10 20:52:11 +01:00
Timothy Flynn
373b467302 LibSQL+SQLServer: Move LibSQL/SQLResult.[h,cpp] to LibSQL/Result.[h,cpp]
Rename the file to match the new class name.
2022-02-10 12:20:35 +00:00
Timothy Flynn
6620f19979 LibSQL+SQLServer: Return the new Result class from statement executions
We can now TRY anything that returns a SQL::Result or an AK::Error.
2022-02-10 12:20:35 +00:00
Ali Mohammad Pur
cb7becb067 LibTLS+RequestServer: Add an option to dump TLS keys to a log file
This file allows us to decrypt TLS messages in wireshark, which can help
immensely in debugging network stuff :^)
2022-02-09 21:23:25 +01:00
Linus Groh
bc183dbbcb LibJS: Replace uses of MarkedValueList with MarkedVector<Value>
This is effectively a drop-in replacement.
2022-02-09 12:25:27 +00:00
Andreas Kling
3f9fc0f690 Browser+LibWeb: Add "Dump Local Storage" item to Browser's Debug menu 2022-02-08 21:53:20 +01:00
Ali Mohammad Pur
5dceba29a4 RequestServer: Avoid Vector OOB access in ConnectionCache
`it.is_end()` could be updated to return false for a previously-invalid
iterator after we append a new socket, copy its value out to a local
variable to not hit this behaviour.
2022-02-08 18:47:19 +00:00
Luke Wilde
f71f404e0c LibWeb: Introduce the Environment Settings Object
The environment settings object is effectively the context a piece of
script is running under, for example, it contains the origin,
responsible document, realm, global object and event loop for the
current context. This effectively replaces ScriptExecutionContext, but
it cannot be removed in this commit as EventTarget still depends on it.

https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
2022-02-08 17:47:44 +00:00
thankyouverycool
1cd77fd1b4 WindowServer: Preserve cursor position when dragging between states
Previously windows would end up in awkward positions relative to
the move cursor when dragging between tile types or unmaximizing.
This feels a bit more ergonomic.
2022-02-08 16:37:46 +01:00
thankyouverycool
ee637b44fb WindowServer: Add Vertically/HorizontallyMaximized WindowTileTypes
VerticallyMaximized tiling replaces set_vertically_maximized() to
take advantage of tiling ergonomics.

Middle-clicking a window's maximize button now tiles vertically;
secondary-clicking tiles horizontally.

Adds Super+Alt+Arrow shortcuts for both. Super+Left/Right tiling
shortcuts now let windows shift between tile types directly.
2022-02-08 16:37:46 +01:00
thankyouverycool
32be05957a WindowServer: Fix comments in WindowManager 2022-02-08 16:37:46 +01:00
thankyouverycool
1607fd511f WindowServer: Unify Window restore rects
Previously, different rects were used to restore tiled and maximized
windows, creating edge cases for inconsistent restoration. All states
now restore m_floating_rect, which saves the last valid size and
location of a window while free-floating.
2022-02-08 16:37:46 +01:00
thankyouverycool
3d7e701451 WindowServer: Rename Window::tiled() => tile_type() and add is_tiled()
This seems more consistent with naming conventions across the system
and makes conditionals easier to read.
2022-02-08 16:37:46 +01:00
davidot
1c4c251be3 LibJS+Everywhere: Remove all VM::clear_exception() calls
Since VM::exception() no longer exists this is now useless. All of these
calls to clear_exception were just to clear the VM state after some
(potentially) failed evaluation and did not use the exception itself.
2022-02-08 09:12:42 +00:00
Ali Mohammad Pur
3bf828e0f9 RequestServer: Reenable socket notifications unconditionally
There's a possible window where the notifications are disabled, and any
request coming at that time will never get any data if it relies on
socket notifications.
2022-02-07 21:52:23 +01:00
kleines Filmröllchen
6ee597369d Meta+Userland: Run the GML formatter on CI and pre-commit
Now that the GML formatter is both perserving comments and also mostly
agrees to the existing GML style, it can be used to auto-format all the
GML files in the system. This commit does not only contain the scripts
for running the formatting on CI and the pre-commit hook, but also
initially formats all the existing GML files so that the hook is
successfull.
2022-02-07 18:39:50 +01:00
Andreas Kling
65bd4477db LibWeb: Plumb OOPWV focus state across the IPC boundary
This makes focus outlines show up in OOPWV at last! :^)
2022-02-06 22:13:13 +01:00
sin-ack
64f135d90f LibCore+Userland: Remove Core::TCPSocket :^)
This was deprecated in favor of Core::Stream::TCPSocket, and now has no
users.
2022-02-06 17:28:17 +00:00
Ali Mohammad Pur
63b4c35ec7 WebSocket: Pledge rpath and unveil /etc/timezone
This is required for timezone stuff, otherwise we'd just crash.
2022-02-06 13:10:10 +01:00
Ali Mohammad Pur
aafc451016 Userland: Convert TLS::TLSv12 to a Core::Stream::Socket
This commit converts TLS::TLSv12 to a Core::Stream object, and in the
process allows TLS to now wrap other Core::Stream::Socket objects.
As a large part of LibHTTP and LibGemini depend on LibTLS's interface,
this also converts those to support Core::Stream, which leads to a
simplification of LibHTTP (as there's no need to care about the
underlying socket type anymore).
Note that RequestServer now controls the TLS socket options, which is a
better place anyway, as RS is the first receiver of the user-requested
options (though this is currently not particularly useful).
2022-02-06 13:10:10 +01:00
Andreas Kling
270aa9e5d0 Browser: Add Debug menu action for dumping the stacking context tree 2022-02-05 22:50:39 +01:00
Rummskartoffel
85c3852b8f KeyboardPreferenceLoader: Don't crash when "Keymaps" is empty 2022-02-03 14:57:46 +01:00
Timur Sultanov
c7bd47c87c Base+WindowsServer+keymap: Store multiple keymaps in a config 2022-02-03 00:47:22 +01:00
Timur Sultanov
b9c558f6c6 WindowServer+Keymap+LibGUI: Add widget to display current keymap 2022-02-03 00:47:22 +01:00
Timur Sultanov
68a01f0e27 WindowManager: Basic support for system keymap switching 2022-02-03 00:47:22 +01:00
thankyouverycool
96895cd22c Everywhere: Fully qualify font names by including their slope
Fixes typefaces of the same weight but different slopes being
incorrectly returned for each other by FontDatabase.
2022-02-01 10:06:26 +01:00
Lenny Maiorani
b0a54518d8 Everywhere: Remove redundant inline keyword
`constexpr` implies `inline` so when both are used it is redundant.
2022-01-29 21:45:17 +02:00
networkException
e2df145e14 WindowServer: Allow checking checkable entries in a menu using space 2022-01-29 11:22:02 +01:00
Daniel Bertalan
7d11edbe17 Userland: Fix unnecessary heap allocation of singleton objects
In order to avoid having multiple instances, we were keeping a pointer
to these singleton objects and only allocating them when it was null.

We have `__cxa_guard_{acquire,release}` in the userland, so there's no
need to do this dance, as the compiler will ensure that the constructors
are only called once.
2022-01-28 23:31:00 +01:00
Ali Mohammad Pur
c1184c1fde RequestServer: Replace disconnected sockets in the grace period too
We previously only replaced disconnected sockets on the queued-request
path, leading to attempts to send requests on a disconnected socket if
the disconnection happened in the deletion grace period.
2022-01-28 23:29:32 +01:00
Timothy Flynn
acfcad0b06 Revert "FileSystemAccessServer: Display times in the local time zone"
This reverts commit fa016a72fd.
2022-01-28 15:13:35 +00:00
Timothy Flynn
8599ee3049 Revert "Userland: Invoke tzset in apps that care about time zones"
This reverts most of commit ede5c9548e.
The one change not reverted is ClockWidget.h, so that the taskbar clock
can continue to notice time zone changes.
2022-01-28 15:13:35 +00:00
Timothy Flynn
fa016a72fd FileSystemAccessServer: Display times in the user's local time zone 2022-01-28 12:25:20 +00:00