Commit graph

331 commits

Author SHA1 Message Date
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
kleines Filmröllchen 145f983ee1 Demos/CatDog: Introduce inspector & artist states based on open programs
These two new main states are determined by looking at the programs the
user has open. The artist state, using the new artist catdog, is
triggered by PixelPaint and FontEditor, and the inspector state is
triggered by Inspector, Profiler and SystemMonitor. This requires CatDog
to unveil /proc/all, and, for some reason, /etc/passwd.
2022-03-02 18:10:02 +01:00
kleines Filmröllchen 93bb943394 Demos/CatDog: Refactor the main states
CatDog's state was previously handled by a bunch of booleans that all
needed to be in sync pretty accurately, but some of these are exclusive
(like alerted and sleeping). This commit introduces a simple enum for
the main states of CatDog which exclude the roaming and direction
states. The main state determines the standing image of CatDog and will
have further effects in the future.
2022-03-02 18:10:02 +01:00
kleines Filmröllchen 83d9a89275 Demos/CatDog: Let the speech bubble know about the CatDog widget
This will allow us to have better interaction between CatDog's state and
what it's saying.
2022-03-02 18:10:02 +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
thankyouverycool 653f01616c LibGUI+Apps: Adjust Splitter spacings
Different thread highlights between widgets lead to different
visual weights between splitters, even when they have the same
width or height. This means some splitters look best at odd
sizes while others even. This sets the default spacing to the
most commonly used, depending on orientation, and adjusts
spacing for a few apps based on the new paint rect.

The most consistent look across apps requires some manual
tweaking occassionally. Knurlheads, use your discretion!
2022-02-23 18:56:22 +02:00
Lenny Maiorani 0ec688f86e Demos: 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-15 23:00:03 +02: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
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
Jagger De Leo 742cca4bfe Starfield: Add app icon
Previously, Starfield used app-screensaver icon.
2022-02-01 04:11:56 +00:00
Dmitry Petrov 1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
mjz19910 10ec98dd38 Everywhere: Fix spelling mistakes 2022-01-07 15:44:42 +01:00
mjz19910 3102d8e160 Everywhere: Fix many spelling errors 2022-01-07 10:56:59 +01:00
Sam Atkins f6633a1026 LibGUI+Userland: Make SortingProxyModel::create() return ErrorOr
Unfortunately, most of the users are inside constructors, (and two
others are inside callback lambdas) so the error can't propagate, but
that can be improved later.
2021-12-24 05:11:52 -08:00
Astraeus- d12359ff20 WidgetGallery: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Astraeus- 1adc808664 Mouse: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Astraeus- b9579de2b5 ModelGallery: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Astraeus- 683077c894 LibGfxScaleDemo: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Astraeus- 1c189dbba5 LibGfxDemo: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Astraeus- 4db2f5b4ae Eyes: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Astraeus- b02da2442f CatDog: Convert to try_create_default_icon 2021-12-18 23:36:59 +01:00
Sam Atkins 7e05ccaa70 Demos: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Brian Gianforcaro cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
pbrw 4d03852190 WidgetGallery: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw bd61558ed8 Starfield: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 9e3bc3f930 Screensaver: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 14081b8a92 Mouse: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 162c271eb6 ModelGallery: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 601de466cb Mandelbrot: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 8293ad33ee LibGfxScaleDemo: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw dee90b2dc3 LibGfxDemo: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw abf86b7501 Fire: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 2642abb773 Eyes: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 79bc587d03 Cube: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
pbrw 370c5986ab CatDog: Use TRY() a lot more :^) 2021-11-25 08:49:31 +01:00
Andreas Kling 3d126fe921 WidgetGallery: Port to LibMain :^) 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
Pedro Pereira 0ed3520ef5 Starfield: Port to LibMain
Simplified two pledge() by using TRY().
2021-11-22 21:56:20 +01:00
Pedro Pereira efe5f37b04 Starfield: Modify speed by Plus or Minus keypresses
Although this is supposed to be a screensaver, it makes all the sense in
the world that it should support modifying the speed interactively. :^)
2021-11-21 16:40:14 +00:00
Pedro Pereira 7b923d1376 Starfield: Modify speed by command argument
This change allows us to change the speed variable by passing a
-s or --speed argument.
2021-11-21 16:40:14 +00:00
Pedro Pereira 6ac97d4397 Starfield: Support variable speed
This change allows us to modify the speed in which the Starfield is
generated. Increasing the speed also increases the length of each trail.
2021-11-21 16:40:14 +00:00
Andreas Kling 0de33b3d6c LibGfx: Use ErrorOr<T> for Bitmap::try_create()
Another one that was used in a fajillion places.
2021-11-08 00:35:27 +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
Andreas Kling 8262bbf624 LibGfx: Use ErrorOr<T> for Bitmap::cropped() 2021-11-08 00:35:27 +01:00
Andreas Kling 83d1460ee8 LibGfx: Use ErrorOr<T> for Bitmap::try_create_wrapper() 2021-11-08 00:35:27 +01:00
Karol Kosek 657409736a WidgetGallery: Make custom cursors visible only in the cursors tab
Prior to this change, the selected cursor stayed changed throughout
the app, even after switching tabs, which didn't look quite right.
2021-11-08 00:06:55 +01:00
FrHun 54605794f9 Applications: Remove border from GroupBox margins 2021-11-03 16:13:19 +01:00
Ben Wiederhake 3796d417e0 Demos+DevTools+Games: 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 c6247fe414 Everywhere: Rename back-click to backward-click
This matches the current forward-click terminology.
2021-10-27 22:05:58 +03: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 4f1d45705f Demos: Remap mouse button events to physical buttons in MouseDemo
This ensures we paint the left button as clicked when the left mouse
button is pressed (and vice-versa with the right one) when the right
mouse button is set as the primary one in the mouse settings.
2021-10-26 16:51:29 +02:00
Idan Horowitz 14223a9c20 Demos: Change MouseDemo's window title to "Mouse demo"
The previous title ("Mouse button demo") didn't fit in the window's
titlebar, which looked pretty bad.
2021-10-26 16:51:29 +02:00
Peter Elliott e1684860a3 LibGUI: Support drag-to-reorder in TabWidget 2021-10-07 12:19:27 +02:00
Karol Kosek bcfb07bc30 WidgetGallery: Crop animated cursors
Selecting the wait cursor displayed the full sprite image.

This has been borrowed from the MouseSettings.
2021-09-20 15:59:34 +02:00
Karol Kosek d1846867cd WidgetGallery+MouseSettings: Use LexicalPath::basename() 2021-09-20 15:59:34 +02:00
Karol Kosek 9ddd2fdcc5 WidgetGallery: Simplify cursor change code
The code here wasn't updated when a new file icons appeared, so double-
-clicking a cursor didn't always set it to the correct one.

Also, the cursor list is sorted alphabetically, by the file name.
So if a theme used a different file naming in Config.ini, then
the previous code would also be incorrect.

Here we will just take the bitmap icon from the model.

Closes: #10142
2021-09-20 15:59:34 +02:00
Brian Gianforcaro a34ea51ca4 Fire: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Brian Gianforcaro ddfdfc2342 Cube: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Mustafa Quraish c545d4ffcb WidgetGallery: Add GUI::ValueSlider widget
This was a cool slider and was missing from the gallery completely.
Vertical mode for this isn't enabled, and it looked awfully crammed
in the bottom along with the other horizontal sliders, so for now
I've just added this to the top, and it controls the opacity of the
image along with the opacity slider.
2021-09-11 11:37:39 +02:00
Ben Wiederhake f717008bde CatDog: Switch to new mouse-tracking method 2021-09-08 10:53:49 +02:00
Ben Wiederhake c6546c7b03 Eyes: Switch to new mouse-tracking method 2021-09-08 10:53:49 +02:00
Mustafa Quraish 1da081bf86 Mandelbrot: Use the new Zoom cursor
It makes it really clear now that you can use the mouse to zoom
when you see the zoom cursor.
2021-09-04 03:35:23 +02:00
Andreas Kling c915174563 Userland: Remove IRC Client
The IRC Client application made some sense while our main communication
hub was an IRC channel. Now that we've moved on, IRC is just a random
protocol with no particular relevance to this project.

This also has the benefit of removing one major client of the single-
process Web::InProcessWebView class.
2021-08-24 16:37:28 +02:00
sin-ack b30b7de2d2 ModelGallery: Add the new Model Gallery application :^)
This is an application analogous to WidgetGallery, in that it tests
various capabilities of LibGUI models. Right now it is pretty bare, but
as more work towards LibGUI models is done regarding persistent model
indices, more demos will be added.
2021-08-23 12:25:26 +04:30
Maciej Zygmanowski 040a723f1f WindowServer: Add support for cursor themes
Now you can specify a CursorTheme key in /etc/WindowServer.ini. The
cursors are loaded from /res/cursor-themes/<name> directory. This
directory contains a Config.ini file with format similar to previous
Cursor section, except it uses relative paths.

This commit adds also Default theme, which uses cursors being
previously in /res/cursors.

The WidgetGallery is updated to match the new cursor path format.
2021-08-23 01:41:53 +02:00
Andreas Kling 20b104dead WidgetGallery: Remove menubar 2021-08-20 01:27:39 +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
Nico Weber 5c3440c5db Mandelbrot: Add a View menu with zoom actions 2021-08-14 19:50:44 +02:00
Nico Weber 19068945de Mandelbrot: Extract reset() method 2021-08-14 19:50:44 +02:00
Nico Weber ad7bfe017f Mandelbrot: Extract zoom() method 2021-08-14 19:50:44 +02:00
sin-ack 1be59d663a Mandelbrot: Only recalculate missing areas after panning
We can reuse the areas that we have from before and just recalculate
the areas that are fresh. This makes panning super smooth. :^)
2021-08-10 09:48:12 +02:00
sin-ack d28802ad22 Mandelbrot: Add panning
Adds the ability to use the middle-mouse click to pan the current view.
2021-08-10 09:48:12 +02:00
sin-ack faec8bbe45 Mandelbrot: Add mousewheel zooming
This allows the user to zoom in with a up scroll of the mousewheel and
zoom out with a down scroll.
2021-08-10 09:48:12 +02:00
sin-ack a08dd5b99c Mandelbrot: Use a GUI::Frame to paint into
This allows us to have a frame border which looks nicer.
2021-08-10 09:48:12 +02:00
sin-ack 07f5e12568 WidgetGallery: Change model update() functions to invalidate()
These functions reload the whole model contents and thus can be moved to
invalidate(), which saves us from the need to manually call update() on
them.
2021-08-08 14:45:23 +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
Timothy 73c1b1617a Everywhere: Replace most cases of exit() with Application::quit()
Application::quit() is nicer for most cases where exit() is used. Cases
where exit() is used intentionally for early termination are left
intact.
2021-08-03 18:55:52 +02:00
Brian Gianforcaro 4374e1e213 Demos: Remove unused header includes 2021-08-01 08:10:16 +02:00
Andreas Kling 687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +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
Hendiadyoin1 ed46d52252 Everywhere: Use AK/Math.h if applicable
AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19 16:34:21 +04:30
Marcus Nilsson 22611ca136 WidgetGallery: Pledge thread
This is needed to use the file picker dialog.
2021-07-17 23:30:58 +02:00
Marcus Nilsson 57fc6eb9be WidgetGallery: Remove unused include 2021-07-17 23:30:58 +02:00
Daniel Bertalan c6fafd3e90 AK+Userland: Add generic AK::abs() function and use it
Previously, in LibGFX's `Point` class, calculated distances were passed
to the integer `abs` function, even if the stored type was a float. This
caused the value to unexpectedly be truncated. Luckily, this API was not
used with floating point types, but that can change in the future, so
why not fix it now :^)

Since we are in C++, we can use function overloading to make things
easy, and to automatically use the right version.

This is even better than the LibC/LibM functions, as using a bit of
hackery, they are able to be constant-evaluated. They use compiler
intrinsics, so they do not depend on external code and the compiler can
emit the most optimized code by default.

Since we aren't using the C++ standard library's trick of importing
everything into the `AK` namespace, this `abs` function cannot be
exported to the global namespace, as the names would clash.
2021-07-08 10:11:00 +02:00
Andreas Kling 36cc011ae4 Fire: Make the main widget a GUI::Frame 2021-07-05 02:38:31 +02:00
Andreas Kling 782a5c88ce WindowServer: Make most remaining WindowServer IPC calls async
The only remaining sync call from client to server is now the call
that switches a window's backing store. That one actually relies on
the synchronization to hand over ownership of the backing stores,
so it has to stay synchronous for now.
2021-07-04 23:15:16 +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
Brian Gianforcaro 06ea31d0d5 CatDog: Enhance the speech bubble artificial intelligence
Enable cat dog to greet you, and help you with yak shave sessions.
2021-06-07 21:52:16 +02:00
Ali Mohammad Pur 51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Stephan Unverwerth 10ceeb092f Everywhere: Use s.unverwerth@serenityos.org :^) 2021-05-29 12:30:08 +01:00
Linus Groh d60ebbbba6 Revert "Userland: static vs non-static constexpr variables"
This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
2021-05-21 10:30:52 +01:00
Lenny Maiorani 800ea8ea96 Userland: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-21 10:07:06 +01:00
Linus Groh 9dd3203cc6 LibGfx: Add missing TextAlignment::BottomLeft 2021-05-21 08:04:31 +02:00
Andreas Kling 8a6c37deef LibGfx: Remove Gfx::FontDatabase::default_bold_fixed_width_font()
Ask for a bold_variant() of the default_fixed_width_font() instead.
2021-05-20 20:55:29 +02:00
Andreas Kling 6a012ad79f LibGfx: Remove Gfx::FontDatabase::default_bold_font()
Instead use default_font().bold_variant() in cases where we want a bold
variant of the default font. :^)
2021-05-20 20:55:29 +02:00
Marcus Nilsson 41e74d4d31 CatDog: Don't show context menu when clicking outside of widget
The context menu for CatDog was shown when right clicking anywhere on
the screen because of global cursor tracking being enabled.
Also fix event not being passed by reference.

Fixes #7285
2021-05-19 23:14:07 +02:00
Erik Biederstadt 585e7890cd 3DFileViewer: Move Demos/GLTeapot to Applications/3DFileViewer
Also changes the category to `Graphics`
2021-05-19 19:34:12 +01:00
Erik Biederstadt 132ecfc47b GLTeapot: Adds a help menu to the GLTeapot demo
Having a help menu maintains better consistency with the other GUI apps
 on the system.
2021-05-19 19:34:12 +01:00