Commit graph

195 commits

Author SHA1 Message Date
thankyouverycool 10afd5a721 Applets: Update Audio applet FrameShape and adjust dimensions
Uses the new Window FrameShape. Fixes margins for erroneously
elided CheckBoxes. Demystifies the numbers used to calculate the
slider window rect.
2022-02-25 19:38:23 +01:00
Nícolas F. R. A. Prado eebdd86fbd ClipboardHistory: Add Time column
Add a Time column to ClipboardHistory that shows the time when each
item in the list was copied.
2022-02-24 08:47:55 +01:00
Lenny Maiorani f2d8c488ec Userland/Applets: 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-02-13 21:27:17 +00: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
Maciej 99e3e42fa5 Keymap Applet: Spawn KeyboardSettings when clicking 2022-02-04 21:30:31 +01:00
Timur Sultanov b9c558f6c6 WindowServer+Keymap+LibGUI: Add widget to display current keymap 2022-02-03 00:47:22 +01:00
kleines Filmröllchen 4efe6210ee Applets/Audio: Use Array for the volume level bitmaps 2022-01-28 23:40:25 +01:00
Dmitry Petrov 1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
sin-ack 2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
kleines Filmröllchen be6418cc50 Everywhere: Use my new serenityos.org e-mail :^) 2022-01-14 11:54:09 +01:00
creator1creeper1 d92558b3b3 Applets/Audio: Propagate errors by extracting out GUI initialization
This commit extracts out the GUI initialization in AudioWidget into
the new try_initialize_graphical_elements function. This function
is now able to use try_set_main_widget instead of set_main_widget.
It's only called by the fallible try_create method.
2022-01-11 09:19:09 -08:00
creator1creeper1 b4eed25872 Applets/ResourceGraph: Propagate errors in create_applet
We now return an error if we fail to parse the applet spec in the
expected format. We can now also use try_set_main_widget instead of
set_main_widget.
2022-01-11 09:19:09 -08:00
Maciej 310fdd87d1 ClipboardHistory: Update to new glyph format 2022-01-09 00:18:46 +01:00
creator1creeper1 74d1eb6502 Applets/ResourceGraph: Propagate errors in JSON decoding 2022-01-03 16:01:42 +01:00
creator1creeper1 e46f08ff33 Applets/Network: Propagate errors using custom try_create
We now move-construct the bitmaps into the NetworkWidget.
2022-01-03 16:01:42 +01:00
creator1creeper1 f125d52622 Applets/Network: Propagate errors with try_set_main_widget
Use try_set_main_widget instead of set_main_widget.
2022-01-03 16:01:42 +01:00
creator1creeper1 43ecf1d429 Applets/Audio: Propagate errors using custom try_create
We now move-construct the bitmaps into the AudioWidget.
2022-01-03 16:01:42 +01:00
creator1creeper1 a550c20c35 Applets/Audio: Propagate errors with try_set_main_widget
Use try_set_main_widget instead of set_main_widget.
2022-01-03 16:01:42 +01:00
Elyse c78a8b94c5 Everywhere: Refactor 'muted' to 'main_mix_muted' in all AudioConnections
The 'muted' methods referred to the 'main mix muted' but it wasn't
really clear from the name. This change will be useful because in the
next commit, a 'self muted' state will be added to each audio client
connection.
2021-12-24 00:19:01 -08:00
Astraeus- 3e4e055c76 ClipboardHistory: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Andreas Kling c3733bea92 Applets/ClipboardHistory: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Jelle Raaijmakers 2565f458d1 ClipboardHistory: Add debug dump action
This allows for easy dumping of clipboard data to the debug console.
2021-11-30 10:52:18 +01:00
Brian Gianforcaro cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Ralf Donau f53bc19b8a Applets/Audio: Remove unveiling /tmp/portal/config 2021-11-24 19:46:03 +01:00
Andreas Kling 365379bcb1 Applets/Audio: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling 24bf74a177 WorkspacePicker: Port to LibMain :^) 2021-11-23 15:44:59 +01:00
Andreas Kling 51484bec82 Applets: Rename DesktopPicker => WorkspacePicker
This is consistent with the rest of the system.
2021-11-23 15:44:59 +01:00
Andreas Kling b03f8d18c5 Applets/Network: Port to LibMain :^)
This opens up using TRY() for syscalls and Core::Object creation.
2021-11-23 15:44:59 +01:00
Andreas Kling 21a5fb0fa2 LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo().

Since LibCore builds on other systems than SerenityOS, we now have to
make sure that wrappers work with just a standard C library underneath.
2021-11-23 11:33:36 +01:00
Mustafa Quraish 4d302e0e88 Everywhere: Use Application::construct() with Main::Arguments directly
Use the updated API everywhere we are currently manually passing in
`arguments.argc` and `arguments.argv`.
2021-11-22 21:13:42 -08:00
Mustafa Quraish 2fbcab46bf Everywhere: Use ArgsParser::parse() with Main::Arguments directly
Use the updated API everywhere we are currently manually passing in
`arguments.argc` and `arguments.argv`.
2021-11-22 21:13:42 -08:00
Andreas Kling b65a039db7 Applets/ResourceGraph: Port to LibMain :^)
This simplifies a bunch of calls to pledge() and unveil().
2021-11-22 23:52:47 +01:00
Andreas Kling d0db6c472c Applets/ResourceGraph: Remove unnecessary unveiling of /etc/passwd
This used to be needed by Core::ProcessStatisticsReader, but since we no
longer use that for the CPU graph, we can just lose it (along with a
FIXME about it.)
2021-11-22 23:52:47 +01:00
Ben Wiederhake d6c686e8bf ClipboardHistory: Properly display bitmap depth 2021-11-21 11:49:06 +00:00
Ben Wiederhake f22c0ffe0c LibGUI+Everywhere: Make sync requests to Clipboard server more obvious 2021-11-21 11:49:06 +00:00
Andreas Kling 587f9af960 AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
Also add slightly richer parse errors now that we can include a string
literal with returned errors.

This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
Andreas Kling d21dc1f451 Everywhere: Replace "virtual desktop" => "workspace" 2021-11-13 12:48:43 +01:00
Andreas Kling 235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Ben Wiederhake 465af4c4d4 Applications: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Filiph Sandström d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Idan Horowitz 350c5a751d ResourceGraph: Use /proc/stat instead of /proc/all for CPU usage stats
This results in a quite large speedup, as generating /proc/all takes a
very long time.
2021-10-07 21:09:38 +02:00
thankyouverycool 92fffc3abc LibGUI: Rename CallOnChange => AllowCallback and implement elsewhere
This is a helpful option to prevent unwanted side effects, distinguish
between user and programmatic input, etc. Sliders and SpinBoxes were
implementing it idiosyncratically, so let's generalize the API and
give Buttons and TextEditors the same ability.
2021-09-22 21:35:42 +02:00
David Isaksson 122f440672 AudioApplet: Refactor window resizing 2021-09-19 21:52:32 +02:00
David Isaksson df32f1b7de AudioApplet: Get values from AudioServer instead of the config file 2021-09-19 21:52:32 +02:00
David Isaksson bd48abab8b AudioApplet: Make sure to set the internal volume on slider change
This fixes the issue that the percent label doesn't update.
2021-09-19 21:52:32 +02:00
David Isaksson 3f6ccf63fe AudioApplet: Round the volume to the nearest integer 2021-09-19 21:52:32 +02:00
David Isaksson c1458e8061 AudioApplet: Update the volume slider on update from audio server 2021-09-19 21:52:32 +02:00
Mustafa Quraish 441e601689 ClipboardHistory: Listen for configuration changes
Resize the clipboard history size dynamically by listening for config
changes. This is currently not ideal since we don't have the callbacks
for `Config::Listener::config_i32_did_change`, so for now we are just
taking the string and attempting to convert it to an int.
2021-09-18 03:33:25 +00:00
Mustafa Quraish b1a3bb638b ClipboardHistory: Use config file to set number of history items
The number of items in history was hardcoded to 20 earlier, now
we try to load this value from a config file. The default if none
is available is still 20.
2021-09-18 03:33:25 +00:00
kleines Filmröllchen 152ec28da0 Audio: Change how volume works
Across the entire audio system, audio now works in 0-1 terms instead of
0-100 as before. Therefore, volume is now a double instead of an int.
The master volume of the AudioServer changes smoothly through a
FadingProperty, preventing clicks. Finally, volume computations are done
with logarithmic scaling, which is more natural for the human ear.

Note that this could be 4-5 different commits, but as they change each
other's code all the time, it makes no sense to split them up.
2021-09-12 23:38:57 +02:00
Karol Kosek 09685d0239 AudioApplet: Fix initial mute state
During conversion from Core::ConfigFile to LibConfig
in c646efaf49, the requested key name
has been changed from 'Mute' to 'Muted', resulting in using always
the default value.
2021-09-04 21:01:28 +02:00
Peter Elliott 33d7fdca28 Everywhere: Use my cool new @serenityos.org email address 2021-09-01 11:37:25 +04:30
Joe Bentley c2f62a03ff AudioApplet: Fix applet positioning bug
Currently when clicking the percentage toggle, there is a delay
in moving the applet window position. This is because after
the applet is resized, the applet area is repositioned
asynchronously. This takes advantage of the new AppletAreaRectChange
event to reposition the slider window when necessary.
2021-08-31 16:49:22 +02:00
Mustafa Quraish 525a7e487b AudioApplet: Remove wpath and cpath priviliges 2021-08-27 23:17:05 +02:00
Mustafa Quraish c646efaf49 AudioApplet: Use LibConfig instead of Core::ConfigFile
No longer need to store `RefPtr<Core::ConfigFile>` :^)
2021-08-27 23:17:05 +02:00
networkException acde7d12b0 Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open
This patch brings the ConfigFile helpers for opening lib, app and system
configs more inline with the regular ConfigFile::open functions.
2021-08-22 01:32:25 +02:00
networkException 938051feb8 Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writing 2021-08-22 01:32:25 +02:00
sin-ack e11d177618 Userland+LibGUI: Add shorthand versions of the Margins constructor
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
2021-08-18 10:30:50 +02:00
sin-ack 9c9a5c55cb Userland+LibGUI: Make Margins arguments match CSS ordering
Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
2021-08-18 10:30:50 +02:00
kleines Filmröllchen 65c8fa9f91 AudioApplet: Persist settings and respect audio server settings
The audio applet uses the user configuration file "AudioApplet.ini" to
persist its settings, currently only whether the audio percentage should
be shown.

Since the audio server now may have specific settings when it starts,
the audio applet respects them by reading these same settings once when
it starts. Therefore, the audio server settings are not immediately
overridden by the audio applet defaults, as was the case before this
change.

A minor change was done to the way that the audio volume is calculated;
doubles are now used.
2021-08-17 01:21:17 +02:00
sin-ack ca2c81251a Everywhere: Replace Model::update() with Model::invalidate()
Most of the models were just calling did_update anyway, which is
pointless since it can be unified to the base Model class. Instead, code
calling update() will now call invalidate(), which functions identically
and is more obvious in what it does.

Additionally, a default implementation is provided, which removes the
need to add empty implementations of update() for each model subclass.

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-08-06 19:14:31 +02:00
kleines Filmröllchen 619c924042 AudioWidget: Proper volume changes when scrolling on the widget
Because setting the slider's value in the mousewheel handler will cause
the volume logarithm logic and the volume setting to happen anyways, we
don't need to do it in the mousewheel handler again. By just moving the
slider up and down with the scroll wheel, we mimic normal SliderWidget
behavior that doesn't exhibit the multiple previous bugs.
2021-08-04 11:36:36 +02:00
Thomas Wagenveld df6db8b8cc Userland: Make representation of 'null' IPv4-address friendlier
Show an empty column rather than 'null' in SystemMonitor and show
'no IP' in the network applet if the adapter has no IPv4-address
configured.
2021-08-03 10:20:51 +02:00
Thomas Wagenveld 3a40287776 Userland: Add network adapter link status to SystemMonitor and applet
Add a column named 'Link status' to the Network tab in SystemMonitor
showing the speed and duplex if the link is up.
Add the link speed behind the existing text in the applet or show
'down' if the link is down.
2021-08-03 10:20:51 +02:00
Brian Gianforcaro 2faa73ff7d Applets: Remove unused header includes 2021-08-01 08:10:16 +02:00
TheFightingCatfish 0c53c2dfa2 LibGUI: Add a ClipboardClient for GUI::Clipboard
Anyone who inherits from `GUI::Clipboard::ClipboardClient` will receive
clipboard notifications via `clipboard_content_did_change()`.

Update ClipboardHistoryModel, TextEditor and TerminalWidget to inherit
from this class.
2021-07-27 23:49:25 +02:00
Andreas Kling 027bfc4eff DesktopPicker: Make sure the applet always ends up in the same place 2021-07-22 09:17:01 +02:00
FrHun 7bfd319652 NetworkApplet: Omit unnecessary newline in tooltip 2021-07-22 04:33:41 +02:00
Andreas Kling c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
LuK1337 de09a92bf8 DesktopPicker: Add mouse wheel control
This lets us use scroll wheel up/down to move between columns and
shift + scroll wheel up/down to move between rows.
2021-07-21 18:04:30 +04:30
Peter Elliott 01248d28ef Applets: Add DesktopPicker applet
This applet displays a grid of desktops, and shows the user what virtual
desktop they are on. When clicked, the desktop will be changed.
2021-07-19 18:21:40 +02:00
brapru 4563d6da8d Applets: Add tooltip for Clipboard History 2021-07-19 10:31:40 +02:00
Tom a635ff4e60 Everywhere: Make tracking cpu usage independent from system ticks
This switches tracking CPU usage to more accurately measure time in
user and kernel land using either the TSC or another time source.
This will also come in handy when implementing a tickless kernel mode.
2021-07-18 22:08:26 +02:00
Tom 7e77a2ec40 Everywhere: Improve CPU usage calculation
As threads come and go, we can't simply account for how many time
slices the threads at any given point may have been using. We need to
also account for threads that have since disappeared. This means we
also need to track how many time slices we have expired globally.

However, because this doesn't account for context switches outside of
the system timer tick values may still be under-reported. To solve this
we will need to track more accurate time information on each context
switch.

This also fixes top's cpu usage calculation which was still based on
the number of context switches.

Fixes #6473
2021-07-18 22:08:26 +02:00
Tom c144d358ae ResourceGraph: Handle more than 4 GiB of memory 2021-07-14 18:24:55 +02:00
Daniel Bertalan f14a4994b0 Everywhere: Don't promote float to double where not needed
The `float => double => float` round trip seen in a couple of places
might pessimize the code. Even if it's truncated to an int in the end,
it's weird not to use the functions with the `f` suffixes when working
with single precision floats.
2021-07-08 10:11:00 +02:00
Gunnar Beutner 631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Linus Groh 5e48769487 Applets/Network: Replace fprintf(stderr) with dbgln()
This is an applet, so we're not going to see its stderr anyway.
2021-05-31 17:44:01 +01:00
Andreas Kling a1e133cc6b LibCore: Make ProcessStatisticsReader return results in a Vector
The HashMap API was overkill and made using this less ergonomic than
it should be.
2021-05-23 11:10:15 +02:00
Gunnar Beutner e087a65775 Userland: Rename loop0 to loop
Now that the kernel picks a different name for the loopback adapter
we should update userland to account for this.
2021-05-22 15:42:54 +01:00
Andreas Kling 31d4bcf5bf Userland: Tighten a *lot* of pledges! :^)
Since applications using Core::EventLoop no longer need to create a
socket in /tmp/rpc/, and also don't need to listen for incoming
connections on this socket, we can remove a whole bunch of pledges!
2021-05-13 23:28:40 +02:00
Ali Mohammad Pur 1ae8775a1b LibCore+Everywhere: Move SeekMode out of IODevice 2021-05-12 11:00:45 +01:00
Ali Mohammad Pur a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
Andreas Kling b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00
Linus Groh ebdeed087c Everywhere: Use linusg@serenityos.org for my copyright headers 2021-04-22 22:51:19 +02:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling 73aa59ccf1 Network.Applet: Avoid JsonObject copy and use StringBuilder::appendff() 2021-04-17 01:27:29 +02:00
Nicholas-Baron 73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
Andreas Kling ff312d8aa6 Applets: Remove unused UserName applet 2021-04-15 20:38:12 +02:00
thankyouverycool 08f11d01d9 FontEditor+ClipboardHistory: Use system-wide Clipboard
Glyphs can now be copied between editors.
2021-04-07 19:27:01 +02:00
Dawid Wolosowicz 1f65c2a981 Network: Make the applet use an alpha channel 2021-04-05 14:30:35 +02:00
Dawid Wolosowicz 3f73816316 ClipboardHistory: Make the applet use an alpha channel 2021-04-05 14:30:35 +02:00
Andreas Kling 436a1dce34 ResourceGraph.Applet: Host both CPU and memory applet in one process
No reason we can't host these in the same process, and then we have
one less process to dynamically link at boot. :^)
2021-04-04 20:13:55 +02:00
Andreas Kling 0069020e6c WindowServer+LibGUI: Rename WindowType::MenuApplet => Applet 2021-04-04 17:55:50 +02:00
Andreas Kling 23cc88f83b Userland: Rename *.MenuApplet => *.Applet
These are no longer displayed in the menu, so it doesn't make sense to
call them menu applets. :^)
2021-04-04 16:29:55 +02:00