Commit graph

331 commits

Author SHA1 Message Date
Jelle Raaijmakers 48d5cde299 Tubes: Remove unused includes 2023-04-11 06:38:18 -04:00
Jelle Raaijmakers be303facb8 3DFileViewer+Tubes: Add map_fixed to pledges
Both applications eventually reach LibGPU's loading of a dynamic library
(e.g. LibSoftGPU) which requires this pledge.

The pledge was always required, but went unchecked until 01318d8f9b.
2023-04-11 06:38:18 -04:00
Lucas CHOLLET 496b7ffb2b LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
Karol Kosek 797968c310 LibGUI+Userland: Make TabWidget::*add_tab() take title using new string 2023-03-16 09:58:42 +01:00
Nico Weber f1a3028ef1 LibGfx: Change BMPWriter API to be consistent with other image writers 2023-03-12 21:32:21 +01:00
Nico Weber 9b297c634f LibGfx: Make QOIWriter use ErrorOr
In addition to it now handling allocation failures, the encode() API is
now consistent with PNGWriter.
2023-03-12 13:23:34 +00:00
Andreas Kling a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Andreas Kling b4022dc844 Screensaver: Remove outdated comment about NonnullPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling 33e87d1627 Userland: Fix remaining smart pointer const-correctness issues 2023-02-21 00:54:04 +01:00
Sam Atkins 6b66e39df4 LibGUI+Userland: Stop returning Layout from Widget::(try_)set_layout()
Nobody uses this return value any more. It also lets us remove a whole
bunch of `(void)` casts. :^)
2023-02-18 16:56:56 +00:00
Sam Atkins 77ad0fdb07 Userland: Specify margins and spacing in the GUI::Layout constructor 2023-02-18 16:56:56 +00:00
FrHun 90b019b4c4 WidgetGallery: Use dynamic layout techniques in the sliders tab 2023-02-17 16:25:57 +00:00
Tim Schumacher 874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher 606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Karol Baraniecki 506c26acce LibGUI+Userland: Switch order of parameters for InputBox::show
Because usage of the input_type parameter is now higher than of the
placeholder parameter, this makes for a cleaner API.
2023-02-04 18:46:39 -07:00
Karol Baraniecki 8095d9276b Userland: Replace manual checking by using GUI::InputType::NonemptyText
Do this where we were already checking if the input was empty after the
InputBox was submitted. Those places gain interactive input validation.

:^)
2023-02-04 18:46:39 -07:00
Linus Groh 9c08bb9555 AK: Remove try_ prefix from FixedArray creation functions 2023-01-28 22:41:36 +01:00
Tim Schumacher 82a152b696 LibGfx: Remove try_ prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit
it.
2023-01-26 20:24:37 +00:00
Arda Cinar 8f4c67672c LibGfxDemo: Draw diagonal dotted and dashed lines 2023-01-17 22:54:18 +01:00
Lucas CHOLLET c0ada49a24 WidgetGallery: Use the non-deprecated API of LibFileSystemAccessClient
The patch is tiny as WidgetGallery is only using `LibFSAC` for its file
picker.
2023-01-15 16:39:12 +00:00
Liav A e241b47fee Userland: Remove a bunch of unveil calls on /sys/kernel/processes
These are not needed anymore since the introduction of the new
get_root_session_id syscall.
2023-01-13 13:41:30 +01:00
Sam Atkins e181b1cb82 Userland: Use Core::Timer::create_foo() factory functions where possible 2023-01-12 11:25:51 +01:00
Andreas Kling c55739bbc0 LibGfx: Make Rect::align_within() correct for TopCenter and BottomCenter
Also update the LibGfxDemo to actually show off these alignments.
2023-01-09 19:54:26 +01:00
Andrew Kaster ddf348daeb Everywhere: Use ElapsedTimer::elapsed_time() for comparisons
Simplify a lot of uses of ElapsedTimer by converting the callers to
elapsed_time from elapsed, as the AK::Time returned is better for unit
conversions and comparisons against constants.
2023-01-07 14:51:04 +01:00
Sam Atkins f0395a2042 LibGUI+Userland: Rename try_load_from_gml() -> load_from_gml() :^)
It's the only one, so the `try` prefix is unnecessary now.
2023-01-07 14:39:30 +01:00
Sam Atkins 54b1326165 Userland: Replace all uses of load_from_gml with try_load_from_gml
MOAR FIXMES! ;^)
2023-01-07 14:39:30 +01:00
Karol Kosek 247db3fdd0 LibFileSystemAccessClient: Rename try_* functions to try_*_deprecated
These functions return the deprecated `Core::File` class, so let's mark
it as such to avoid possible confusion between future non try_*
functions which will use Core::Stream family classes and to possibly
grab someone's attention. :^)
2023-01-07 10:53:43 +00:00
Sam Atkins 0c24522635 LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off!

This does the following, in one big, awkward jump:
- Replace all uses of `set_main_widget<Foo>()` with the `try` version.
- Remove `set_main_widget<Foo>()`.
- Rename the `try` version to just be `set_main_widget` because it's now
  the only one.

The majority of places that call `set_main_widget<Foo>()` are inside
constructors, so this unfortunately gives us a big batch of new
`release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06 13:36:02 -07:00
MacDue a1726b1ba5 LibGfx: Avoid rounding/truncating glyph positions till blitting
This keeps some overloads that accept ints to avoid adding calls to
.to_type<float>() all over the place.
2023-01-05 12:09:35 +01:00
Timothy Flynn 9c5915b5b4 Screensaver: Add a screensaver launcher application
Similar to the Settings application, this adds a single Screensaver
application to launch all screensaver demos. This is to declutter the
taskbar menu a bit.
2023-01-03 17:56:55 +01:00
Timothy Flynn 10bf86de2c Demos: Rename Screensaver to GradientScreensaver
This is to avoid naming conflicts with an upcoming Screensaver launcher
application.
2023-01-03 17:56:55 +01:00
Andreas Kling 0fe4f4fe53 Demos: Remove "Cube" application
This wasn't doing anything interesting enough to justify being its own
demo application. If we need a spinning cube, we can just load a cube
model into 3DFileViewer. :^)
2023-01-03 15:43:10 +01:00
Ben Wiederhake 6b7ce19161 Everywhere: Remove unused includes of LibC/stdlib.h
These instances were detected by searching for files that include
stdlib.h, but don't match the regex:

\\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_
uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex
it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs|
ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble
n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o
penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo
c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete
nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou
l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use anything from the stdlib.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Andreas Kling 88ebc44cbf Demos: Remove "Mouse" application
This was a plain-looking test app for debugging mouse events.
Mouse events work now, and if we want mouse testing facilities, they
can be added to MouseSettings instead.
2023-01-02 15:29:12 +01:00
Andreas Kling 6760653d62 Demos: Remove "Fire" application
This served no purpose other than looking somewhat neat.
2023-01-02 15:29:12 +01:00
HawDevelopment a21703f1df Demos: Add ability to use scroll wheel in starfield
This change adds the ability to use the scroll wheel to change
the speed in starfield.
2022-12-28 14:49:05 -05:00
Jelle Raaijmakers 18b6bdb563 Demos+LibDesktop: Centralize screensaver logic
We have 3 demos with pretty similar window logic and quitting behavior
on user activity, so centralize that into `Desktop::Screensaver`.
2022-12-27 12:38:08 +01:00
Stephan Unverwerth 60c9e3bfc6 Demos: Remove VirGLDemo
All interesting code from the demo now lives in LibVirtGPU.
2022-12-26 09:39:20 +01:00
Andre Eisenbach e80f0b23e3 CatDog: Simplify animation frame logic and fix minor bugs
Moved all images into a Vector instead of storing every animation frame
in its own member variable. This greatly simplifies the bitmap selection
logic and removes redundant if() checks.

Also fixes minor state bugs. For example, CatDog woudld go to sleep
immediately after actively moving for > 5 seconds. Also fixes arbitrary
hardcoded values for mouse offset movement tresholds as well as
inconsistent movement increments. This allows clicking anywhere on the
CatDog window without moving CatDog.

In addition to removing many member variables, the API interface is
also cleaned up a bit to expose less CatDog internals. Nobody likes
exposed CatDog internals ;).

Variables and function are also renamed where necessary to (hopefully)
improve readability.
2022-12-16 08:50:35 -07:00
Baitinq c4f68bde57 VirGLDemo: Make a factory function for Demo and propagate errors
This removes a measly 1 FIXME :))
2022-12-15 12:35:19 +00:00
Andreas Kling cba9df1c53 CatDog: Make a factory function for CatDog and propagate errors
This fixes an astonishing 22 FIXMEs. :^)
2022-12-14 15:05:52 +00:00
Tim Schumacher 8940f2da7f LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
FrHun 59028515c0 LibGUI: Split OpacitySlider into vertical and horizontal helper classes 2022-12-09 00:25:30 +01:00
Andreas Kling d88c7fee32 LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>
This is a first step towards handling PNG encoding failures instead of
just falling over and crashing the program.

This initial step will cause encode() to return an error if the final
ByteBuffer copy fails to allocate. There are more potential failures
that will be surfaced by subsequent commits.

Two FIXMEs were killed in the making of this patch. :^)
2022-12-08 13:01:11 +00:00
Andreas Kling 95b4ffad39 Mandelbrot: Make it possible for export_image to return an error
...and if we do get an error, present it to the user.
2022-12-08 13:01:11 +00:00
Filiph Sandström 01cdd3f181 WindowServer+MouseSettings: Improve buttons_switched naming
Before this commit it was a bit ambiguous which buttons the function
name were referring to; this instead now makes it clear that it's
related to mouse input. Additionally, this also fixes incorrect getter
naming leftover from yesteryear.
2022-12-08 07:04:09 -05:00
MacDue 27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue 7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
Linus Groh 57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Andreas Oppebøen b716c14c32 MouseDemo: Eliminate visual artifacts when filling in the color
The drawing had several visual artifacts with the colors not perfectly
filling out their outlines. By re-using the path for both stroke and
fill, we ensure that the exact same floating point coordinates are
used. Drawing the fill first and the stroke after also helps eliminate
artifacts.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 54edd162a9 MouseDemo: Draw blue color for longer to indicate double click
When double-clicking, the button remains blue a bit longer. This
provides a convenient way to test the double click speed.

Piggybacks the timer for the scroll indicators, which is a bit weird,
but not noticeable.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 3cf81f1930 MouseDemo: Restart timer when scrolling to avoid blinking indicator
When scrolling, a timer is triggered to hide the indicator cross. When
we continuously scroll, the indicator cross would then blink once the
timer kicks in. Instead, let's cancel the current timer and schedule a
new one, making the indicator visually smooth.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 2c142e4c57 MouseDemo: Show distinct colors for primary vs secondary button
This shows mouse down of primary button in blue color,
and secondary button in light blue color.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 903bfc3d68 MouseDemo: Replace constructor with initialization at member definition
This adheres to CodingStyle.md#other-punctuation which states:
> Prefer initialization at member definition whenever possible

Since the zero-arg constructor was only initializing members, it was
simply removed.
2022-11-30 12:56:29 +00:00
Tim Schumacher ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Liav A 5dfb2b18f3 Applications: Use new global variables at /sys/kernel/ directory 2022-10-25 15:33:34 -06:00
demostanis 34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
demostanis 1eac02c9a4 CatDog: Make it always on top 2022-10-13 12:37:54 +01:00
Ali Mohammad Pur 166a905951 Userland: Properly populate GENERATED_SOURCES
We previously put the generated headers in SOURCES, which did not mark
them as GENERATED (and did not produce a proper dependency).
This commit moves all generated headers into GENERATED_SOURCES, and
removes useless header SOURCES.
2022-10-12 15:55:15 +01:00
Timothy Flynn 7cab86ad28 Userland: Unveil /proc/all in applications which require it
These were missed in 7af5eef. It is needed for any application using
e.g. FileSystemAccessServer.
2022-10-03 17:09:21 +01:00
Timothy Flynn 25e0ab3ee4 Userland: Tighten promises by removing 'proc' where it isn't used
This is a partial revert of commit 7af5eef. After 97d15e9, the 'proc'
promise is not needed for operations using getsid().

This also fixes launching several applications in which 7af5eef added
the 'proc' promise only in the second call to pledge().
2022-10-03 17:09:21 +01:00
Peter Elliott 7af5eef0dd SystemServer+LoginServer+Userland: Switch to sid-based sockets
This commit does three things atomically:
- switch over Core::Account+SystemServer+LoginServer to sid based socket
  names.
- change socket names with %uid to %sid.
- add/update necessary pledges and unveils.

Userland: Switch over servers to sid based sockets

Userland: Properly pledge and unveil for sid based sockets
2022-10-03 11:11:29 +02:00
networkException 4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
Ben Wiederhake c214d31c5e Everywhere: Fix order of includes and #pragma once 2022-09-18 18:30:05 -07:00
Andrew Kaster 8ed5ed3ec0 LibGL: Make GL::create_context fallible
Propagate errors in places that are already set up to handle them, like
WebGLRenderingContext and the Tubes demo, and convert other callers
to using MUST.
2022-09-16 15:32:38 +02:00
Linus Groh 81f1183e28 Tubes: Run clang-format 2022-09-11 23:24:33 +01:00
Jelle Raaijmakers 9dfe50170e Demos: Add Tubes :^) 2022-09-11 22:45:49 +01:00
networkException 1346a653e4 WidgetGallery: Port file picker to use FileSystemAccessClient
Previously we would unveil the home directory of anon to allow showing
anything in the file picker. This patch removes direct access to the
home directory and instead makes WidgetGallery connect to
FileSystemAccessServer to open a file, making the application more user
agnostic and allowing directories outside /home/anon to be shown.
2022-09-10 20:41:16 +01:00
MacDue b609dd7348 Eyes: Add an option to show/hide the window frame
This works the same as in the Cube demo, and now allows enjoying
the eyes without any obstructions :^)

The window frame can now be disabled with the -h/--hide-window
command-line option, or via toggle in the GUI.
2022-08-25 13:42:17 +02:00
thankyouverycool 0d4fd4e2a6 LibGfx+LibGUI+WindowServer+Apps+Demos: Replace ToolWindows
with the RenderAbove WindowMode. This mode will ensure child
windows always draw above their parents, even when focus is lost.
RenderAbove modals are automatically themed the same as the old
ToolWindows. Fixes ToolWindows rendering above ALL normal windows,
regardless of parent. We can't rely on WindowType to create these
sort of effects because of WindowManager's strict display hierarchy.
2022-08-25 13:28:50 +02:00
thankyouverycool f833473df0 Apps+Demos+Dialogs: Remove unnecessary minimum window sizes
The new layout system conveniently calculates these for us now.
In the case of Mandelbrot where it needs to be overriden, make
sure to disable obey min widget size first. In EmojiInputDialog's
case, the window needs to be resized instead to center correctly.
2022-08-25 13:28:50 +02:00
Lucas CHOLLET bee5bcda73 Everywhere: Replace hardcoded anon's uid in unveil path with %uid 2022-08-14 21:52:35 +01:00
Lucas CHOLLET c5b7c9f479 LibCore+LaunchServer: Move portal directory to /tmp/user/%uid
The `/tmp/user` directory is owned by root, this solution prevents
malicious users to interfere with other users' portals.

This commit also moves `launch`'s portal in the user directory.
2022-08-14 21:52:35 +01:00
Linus Groh 8150d71821 Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_' 2022-07-22 23:09:43 +01:00
Lucas CHOLLET 70846d701c LaunchServer+SystemServer: Move the portal to a user-specific directory
Various changes are needed to support this:
 - The directory is created by Core::Account on login (and located in
   /tmp).
 - Service's sockets are now deleted on exit (to allow re-creation)
 - SystemServer needs to handle SIGTERM to correctly destroy services.
2022-07-19 11:15:14 +01:00
FrHun dfefd1ec88 WidgetGallery: Make inspectable
WidgetGallery is only a demo anyways, and the perfect target to test the
Inspector.
2022-07-15 12:38:35 +02:00
sin-ack 3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
FrHun 53215be7ae WidgetGallery: Repair GML layout on BasicsTab 2022-07-04 11:15:40 +02:00
FrHun 8dd08d47f1 Applications: Remove usages of deprecated implicit conversions
These deprecated conversions are currently in place to make the system
compile, but they are to be removed soon. This prepares that.
2022-06-28 17:52:42 +01:00
FrHun 8081a8a5de LibGUI: Add layout spacer support to GML
This is a bit of a hack, but it is an easy way to finally get spacers
into GML.
This will translate well if spacers are later to become child objects of
the continer widget.
2022-06-10 21:26:06 +01:00
MacDue 8ac5f625e9 LibGfx: Rename draw_ellipse/circle to fill_ellipse/circle
This makes these functions more consistent with the non-aa painter.
2022-06-01 19:33:45 +02:00
Sam Atkins cdffe556c8 LibGUI+Userland: Make Dialog::ExecResult an enum class 2022-05-13 16:27:43 +02:00
Sam Atkins 84b98da259 Userland: Set tab-widget properties in GML instead of code 2022-05-11 20:16:43 +02:00
MacDue 739d870091 Fire: Ignore mouse events outside the window (to the left)
This fixes a small issue where if you drag the cursor outside the
window on the left-hand side, the fire demo will still respond to
the mouse events, but wrapped around to the right of the window.
2022-05-08 18:15:12 +02:00
MacDue 934ea4faf1 Fire: Replace #defines with constexprs 2022-05-08 18:15:12 +02:00
EWouters 053fc51b7d Mandelbrot: Remove image export confirmation dialog
Andreas mentioned this dialog is not needed in the monthly update
video[^1].

[^1]: https://youtu.be/yUmHEYs5n34?t=364
2022-05-08 16:38:19 +02:00
MacDue cf5b6c5c8d Demos/Eyes: Render eyes antialiased
This looks good, and is a good way to test ellipse rendering is
working properly.
2022-05-07 22:59:02 +02:00
Liav A b401f278ad Userland: Re-organize /dev GPU nodes 2022-05-05 20:55:57 +02:00
EWouters d3bc3da873 Mandelbrot: Add BMP and QOI image formats as options for export
Inspired by #13558 I added the option to export as QOI to the
Mandelbrot demo. I added BMP as well for completeness.
2022-04-20 08:19:25 -04:00
Simon Wanner 206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
MacDue 593aa9aff1 Demos/LibGfxScaleDemo: Use BGRA8888 bitmap in canvas
Previously BGRx8888 was used, which produces artifacts with the new
antialiased window frames with border radii, which require alpha
blending whilst painting.
2022-03-26 18:24:11 +00: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 c2d11d5aa0 Eyes: Add 'Contents' action to help menu 2022-03-18 01:10:16 +01:00
Sahan Fernando 683de841e5 Kernel: Sandbox each GPU3DDevice file description into own host context 2022-03-14 17:38:18 +03:30
Sahan Fernando fd5eaf6494 Demos: Create demo for VirGL gpu device
This is a simple demo for VirGL, that does the bare minimum required to
create and render a spinning cube (with one color per face).
2022-03-09 14:58:48 +03:30
Paulo Henrique Silva 0b3c1b4c79 Mandelbrot: Add Help menu with standard About action
Noticed that Mandelbrot didn't use the standard About action in the Help
menu. As a first patch to Serenity, this patch fixes it.
2022-03-08 18:34:14 +01:00
kleines Filmröllchen 81c042a8cd Demos/CatDog: Show different messages depending on state
There are two new sets of messages for the new application-dependent
main states of CatDog. With the current Array-based system, all message
collections must have the same number of messages, but that's not a
problem.
2022-03-02 18:10:02 +01:00